]> source.dussan.org Git - vaadin-framework.git/commitdiff
#5547 Table horizontal scroller goes out of sync in Chrome when changing visible...
authorHenri Sara <henri.sara@itmill.com>
Wed, 18 May 2011 09:56:28 +0000 (09:56 +0000)
committerHenri Sara <henri.sara@itmill.com>
Wed, 18 May 2011 09:56:28 +0000 (09:56 +0000)
svn changeset:18881/svn branch:6.6

src/com/vaadin/terminal/gwt/client/Util.java

index 70af13bd4bf3a689f176ecab73736507c263c058..7edad795fecffdbf86cb018d2e75210576fc4b89 100644 (file)
@@ -589,6 +589,7 @@ public class Util {
 
             // check the scrolltop value before hiding the element
             final int scrolltop = elem.getScrollTop();
+            final int scrollleft = elem.getScrollLeft();
             elem.getStyle().setProperty("overflow", "hidden");
 
             Scheduler.get().scheduleDeferred(new Command() {
@@ -598,7 +599,7 @@ public class Util {
 
                     if (scrolltop > 0 || elem.getScrollTop() > 0) {
                         int scrollvalue = scrolltop;
-                        if (scrolltop == 0) {
+                        if (scrollvalue == 0) {
                             // mysterious are the ways of webkits scrollbar
                             // handling. In some cases webkit reports bad (0)
                             // scrolltop before hiding the element temporary,
@@ -610,6 +611,25 @@ public class Util {
                         elem.setScrollTop(scrollvalue - 1);
                         elem.setScrollTop(scrollvalue);
                     }
+
+                    // fix for #5547: Table horizontal scroll sometimes not
+                    // updated when collapsing/expanding columns
+                    if (BrowserInfo.get().isChrome()
+                            && (scrollleft > 0 || elem.getScrollLeft() > 0)) {
+                        int scrollvalue = scrollleft;
+
+                        if (scrollvalue == 0) {
+                            // mysterious are the ways of webkits scrollbar
+                            // handling. In some cases webkit may report a bad
+                            // (0) scrollleft before hiding the element
+                            // temporary, sometimes after.
+                            scrollvalue = elem.getScrollLeft();
+                        }
+                        // fix another bug where scrollbar remains in wrong
+                        // position
+                        elem.setScrollLeft(scrollvalue - 1);
+                        elem.setScrollLeft(scrollvalue);
+                    }
                 }
             });
         }