diff options
author | John Ahlroos <john@vaadin.com> | 2013-05-16 11:12:48 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-17 06:12:20 +0000 |
commit | 609acd1bec1a724fdf37a1363696c1b92ca34261 (patch) | |
tree | d555a82081b52965602546e428e0e16319cb1533 | |
parent | 611e5f9030d4d783a53ce99150680008b1ec4065 (diff) | |
download | vaadin-framework-609acd1bec1a724fdf37a1363696c1b92ca34261.tar.gz vaadin-framework-609acd1bec1a724fdf37a1363696c1b92ca34261.zip |
Fixed table height rendering in Android 2.3 #11331
Change-Id: I085d825459416b1487873660c7baf9b0cdb476d2
-rw-r--r-- | client/src/com/vaadin/client/BrowserInfo.java | 9 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VScrollTable.java | 16 |
2 files changed, 25 insertions, 0 deletions
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(); + } } } |