Reviewers: jlabanca,
Please review this at http://gwt-code-reviews.appspot.com/78810 Affected files: M user/src/com/google/gwt/user/client/ui/ScrollPanel.java Index: user/src/com/google/gwt/user/client/ui/ScrollPanel.java diff --git a/user/src/com/google/gwt/user/client/ui/ScrollPanel.java b/user/src/com/google/gwt/user/client/ui/ScrollPanel.java index 4c9c82f155b8a96236fcb58cc1f5f3113e9dd396..e0a6ee735ba79d4febb5d80e6df603aa6f46f799 100644 --- a/user/src/com/google/gwt/user/client/ui/ScrollPanel.java +++ b/user/src/com/google/gwt/user/client/ui/ScrollPanel.java @@ -27,15 +27,26 @@ import com.google.gwt.user.client.Element; */ @SuppressWarnings("deprecation") public class ScrollPanel extends SimplePanel implements SourcesScrollEvents, - HasScrollHandlers { + HasScrollHandlers, RequiresResize, ProvidesResize { + + private Element containerElem; /** * Creates an empty scroll panel. */ public ScrollPanel() { setAlwaysShowScrollBars(false); + + containerElem = DOM.createDiv(); + getElement().appendChild(containerElem); + // Prevent IE standard mode bug when a AbsolutePanel is contained. - DOM.setStyleAttribute(getElement(), "position", "relative"); + DOM.setStyleAttribute(containerElem, "position", "relative"); + + // Hack to account for the IE6/7 scrolling bug described here: + // http://stackoverflow.com/questions/139000/div-with-overflowauto-and-a-100-wide-table-problem + DOM.setStyleAttribute(getElement(), "zoom", "1"); + DOM.setStyleAttribute(containerElem, "zoom", "1"); } /** @@ -90,6 +101,13 @@ public class ScrollPanel extends SimplePanel implements SourcesScrollEvents, return DOM.getElementPropertyInt(getElement(), "scrollTop"); } + public void onResize() { + Widget child = getWidget(); + if ((child != null) && (child instanceof RequiresResize)) { + ((RequiresResize) child).onResize(); + } + } + /** * @deprecated Use the {...@link HandlerRegistration#removeHandler} * method on the object returned by {...@link #addScrollHandler} instead @@ -195,6 +213,10 @@ public class ScrollPanel extends SimplePanel implements SourcesScrollEvents, super.setWidth(width); } + protected Element getContainerElement() { + return containerElem; + } + private native void ensureVisibleImpl(Element scroll, Element e) /*-{ if (!e) return; --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
