]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed table height rendering in Android 2.3 #11331
authorJohn Ahlroos <john@vaadin.com>
Thu, 16 May 2013 08:12:48 +0000 (11:12 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 17 May 2013 06:12:20 +0000 (06:12 +0000)
Change-Id: I085d825459416b1487873660c7baf9b0cdb476d2

client/src/com/vaadin/client/BrowserInfo.java
client/src/com/vaadin/client/ui/VScrollTable.java

index f0a4ccde0a8665e1c79d31c738e2b849b644cddd..5185f829fe8736082da3a3e58c7bfe051c05b100 100644 (file)
@@ -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.
index 8705a826cc149afd30a5d8756078081db87a5db5..e2e82a1959efeb075804baa60681b739729e2565 100644 (file)
@@ -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();
+            }
         }
     }