From: Matti Tahvonen Date: Wed, 17 Dec 2008 14:31:28 +0000 (+0000) Subject: fixes #2363 X-Git-Tag: 6.7.0.beta1~3526 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=56c9ae61767f35b85daadda613d2e8f60d4e31d9;p=vaadin-framework.git fixes #2363 svn changeset:6254/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/Util.java b/src/com/itmill/toolkit/terminal/gwt/client/Util.java index 021663a31e..bc03935ec6 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/Util.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/Util.java @@ -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 ""; + } + + }-*/; + } diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java index 8d1abb27d4..6918a5cbfc 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java @@ -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