]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #2363
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 17 Dec 2008 14:31:28 +0000 (14:31 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 17 Dec 2008 14:31:28 +0000 (14:31 +0000)
svn changeset:6254/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/Util.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java

index 021663a31e2c4784dc4c1d9493beeb70cae1eea3..bc03935ec613f1ef4dfc42804c125e06c14255e6 100644 (file)
@@ -75,6 +75,12 @@ public class Util {
      *            run componentSizeUpdated lazyly
      */
     public static void notifyParentOfSizeChange(Widget widget, boolean lazy) {
+        if (!(widget instanceof Paintable)) {
+            ApplicationConnection.getConsole().log(
+                    "Notified widget must be paintable not "
+                            + widget.getClass().getName());
+            return;
+        }
         if (lazy) {
             latelyChangedWidgets.add(widget);
             lazySizeChangeTimer.schedule(LAZY_SIZE_CHANGE_TIMEOUT);
@@ -101,6 +107,7 @@ public class Util {
         for (Widget widget : widgets) {
             ApplicationConnection.getConsole().log(
                     "Widget " + Util.getSimpleName(widget) + " size updated");
+
             Widget parent = widget.getParent();
             while (parent != null && !(parent instanceof Container)) {
                 parent = parent.getParent();
@@ -642,4 +649,40 @@ public class Util {
         return getRequiredHeight(widget.getElement());
     }
 
+    /**
+     * Detects what is currently the oveflow style attribute in given element.
+     * 
+     * @param pe
+     * @return
+     */
+    public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe) {
+        String overflow = getComputedStyle(pe, "overflow");
+        if (overflow != null) {
+            if (overflow.equals("auto") || overflow.equals("scroll")) {
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    private static native String getComputedStyle(
+            com.google.gwt.dom.client.Element el, String p)
+    /*-{
+
+        if (el.currentStyle) {
+            // IE
+            return el.currentStyle[p];
+        } else if (window.getComputedStyle) {
+            //Sa, FF, Opera
+            return document.defaultView.getComputedStyle(el,null).getPropertyValue(p);
+        } else {
+            // fall back for non IE, Sa, FF, Opera
+            return "";
+        }
+
+     }-*/;
+
 }
index 8d1abb27d4051a9b5e60336cadb449c4690333d8..6918a5cbfc2df1ac2515f968675921f0d16642f5 100644 (file)
@@ -522,7 +522,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
         FloatSize extra = locationToExtraSize.get(getLocation(child));
         return new RenderSpace(pe.getOffsetWidth() - (int) extra.getWidth(), pe
                 .getOffsetHeight()
-                - (int) extra.getHeight(), true);
+                - (int) extra.getHeight(), Util.mayHaveScrollBars(pe));
     }
 
     @Override