Reviewers: Frank,

Description:
Fixing a bug in CustomScrollPanel that leads to an infinite loop in
Safari 3 because the browser updates the scroll position of the outer
element, which triggers a scroll event, which repeats the loop. We now
check the scroll positions before updating them.


Please review this at http://gwt-code-reviews.appspot.com/1421806/

Affected files:
  M user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java


Index: user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java
===================================================================
--- user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java (revision 10081) +++ user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java (working copy)
@@ -527,12 +527,16 @@
     }

     /*
- * Ensure that the viewport is anchored to the corner. If the user click and
-     * drags the content, its possible to shift the viewport and reveal the
+ * Ensure that the viewport is anchored to the corner. If the user clicks + * and drags the content, its possible to shift the viewport and reveal the
      * hidden scrollbars.
      */
-    getElement().setScrollLeft(0);
-    getElement().setScrollTop(0);
+    if (getElement().getScrollLeft() != 0) {
+      getElement().setScrollLeft(0);
+    }
+    if (getElement().getScrollTop() != 0) {
+      getElement().setScrollTop(0);
+    }
   }

   /**


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

Reply via email to