Revision: 6354
Author: [email protected]
Date: Tue Oct 13 05:52:22 2009
Log: Fixes IE bug in ScrollPanel at 100% width; Adds  
Requires/ProvidesResize.
Review: http://gwt-code-reviews.appspot.com/78810
http://code.google.com/p/google-web-toolkit/source/detail?r=6354

Modified:
  /trunk/user/src/com/google/gwt/user/client/ui/ScrollPanel.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/ScrollPanel.java      Tue May 
 
12 11:20:32 2009
+++ /trunk/user/src/com/google/gwt/user/client/ui/ScrollPanel.java      Tue Oct 
 
13 05:52:22 2009
@@ -27,15 +27,26 @@
   */
  @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");
    }

    /**
@@ -89,6 +100,13 @@
    public int getScrollPosition() {
      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}
@@ -194,6 +212,10 @@
    public void setWidth(String width) {
      super.setWidth(width);
    }
+
+  protected Element getContainerElement() {
+    return containerElem;
+  }

    private native void ensureVisibleImpl(Element scroll, Element e) /*-{
      if (!e)

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to