From 609acd1bec1a724fdf37a1363696c1b92ca34261 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Thu, 16 May 2013 11:12:48 +0300 Subject: [PATCH] Fixed table height rendering in Android 2.3 #11331 Change-Id: I085d825459416b1487873660c7baf9b0cdb476d2 --- client/src/com/vaadin/client/BrowserInfo.java | 9 +++++++++ .../src/com/vaadin/client/ui/VScrollTable.java | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index f0a4ccde0a..5185f829fe 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -388,10 +388,19 @@ public class BrowserInfo { && (getOperatingSystemMajorVersion() == 3 || getOperatingSystemMajorVersion() == 4); } + public boolean isAndroid23() { + return isAndroid() && getOperatingSystemMajorVersion() == 2 + && getOperatingSystemMinorVersion() == 3; + } + private int getOperatingSystemMajorVersion() { return browserDetails.getOperatingSystemMajorVersion(); } + private int getOperatingSystemMinorVersion() { + return browserDetails.getOperatingSystemMinorVersion(); + } + /** * Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome * 4, 8 for Internet Explorer 8. diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 8705a826cc..e2e82a1959 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -6692,6 +6692,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private void setContainerHeight() { if (!isDynamicHeight()) { + + /* + * Android 2.3 cannot measure the height of the inline-block + * properly, and will return the wrong offset height. So for android + * 2.3 we set the element to a block element while measuring and + * then restore it which yields the correct result. #11331 + */ + if (BrowserInfo.get().isAndroid23()) { + getElement().getStyle().setDisplay(Display.BLOCK); + } + containerHeight = getOffsetHeight(); containerHeight -= showColHeaders ? tHead.getOffsetHeight() : 0; containerHeight -= tFoot.getOffsetHeight(); @@ -6699,7 +6710,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (containerHeight < 0) { containerHeight = 0; } + scrollBodyPanel.setHeight(containerHeight + "px"); + + if (BrowserInfo.get().isAndroid23()) { + getElement().getStyle().clearDisplay(); + } } } -- 2.39.5