Fixes IE bug in ScrollPanel at 100% width; Adds Requires/ProvidesResize.
Review: http://gwt-code-reviews.appspot.com/78810

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6354 8db76d5a-ed1c-0410-87a9-c151d255dfc7
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 4c9c82f..e0a6ee7 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 @@
  */
 @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 @@
     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 @@
     super.setWidth(width);
   }
 
+  protected Element getContainerElement() {
+    return containerElem;
+  }
+
   private native void ensureVisibleImpl(Element scroll, Element e) /*-{
     if (!e)
       return;