Revision: 10085
Author:   jlaba...@google.com
Date:     Tue Apr 26 12:54:13 2011
Log: 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.

Review at http://gwt-code-reviews.appspot.com/1421806

http://code.google.com/p/google-web-toolkit/source/detail?r=10085

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

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java Tue Apr 26 05:06:08 2011 +++ /trunk/user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java Tue Apr 26 12:54:13 2011
@@ -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