]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes IE scrollbar issues (#16634)
authorHenrik Paul <henrik@vaadin.com>
Tue, 10 Feb 2015 09:06:52 +0000 (11:06 +0200)
committerVaadin Code Review <review@vaadin.com>
Tue, 10 Feb 2015 09:31:04 +0000 (09:31 +0000)
Change-Id: Ic948fb801f3bca5101ba630c99bd321f3e4f24bb

WebContent/VAADIN/themes/base/escalator/escalator.scss
client/src/com/vaadin/client/widget/escalator/ScrollbarBundle.java
client/src/com/vaadin/client/widgets/Escalator.java

index ad09207ce02335d189bb342e7f84513111d51bbe..606dc6a7dda730072053c1dbed852ad169c7b9ab 100644 (file)
@@ -6,7 +6,7 @@
 
   .#{$primaryStyleName}-scroller {
     position: absolute;
-    z-index: 20;
+    z-index: 1;
     outline: none;
     @include box-sizing(border-box);
   }
@@ -31,6 +31,7 @@
     position: absolute;
     overflow: hidden;
     @include box-sizing(border-box);
+    z-index: 5;
   }
 
   .#{$primaryStyleName}-tablewrapper > table {
index d7122329b7220647df26db760a8fccd2678150d1..ef8713b82f3bc59193bd7410df5689eefbea12bb 100644 (file)
@@ -226,13 +226,14 @@ public abstract class ScrollbarBundle implements DeferredWorker {
 
         @Override
         protected void internalSetScrollbarThickness(double px) {
-            root.getStyle().setWidth(px, Unit.PX);
+            root.getStyle().setPaddingRight(px, Unit.PX);
+            root.getStyle().setWidth(0, Unit.PX);
             scrollSizeElement.getStyle().setWidth(px, Unit.PX);
         }
 
         @Override
         protected String internalGetScrollbarThickness() {
-            return root.getStyle().getWidth();
+            return scrollSizeElement.getStyle().getWidth();
         }
 
         @Override
@@ -295,13 +296,14 @@ public abstract class ScrollbarBundle implements DeferredWorker {
 
         @Override
         protected void internalSetScrollbarThickness(double px) {
-            root.getStyle().setHeight(px, Unit.PX);
+            root.getStyle().setPaddingBottom(px, Unit.PX);
+            root.getStyle().setHeight(0, Unit.PX);
             scrollSizeElement.getStyle().setHeight(px, Unit.PX);
         }
 
         @Override
         protected String internalGetScrollbarThickness() {
-            return root.getStyle().getHeight();
+            return scrollSizeElement.getStyle().getHeight();
         }
 
         @Override
index 450655c9d335b9872ba00d80b748dec47bb1b18b..ca54b97ca5bc9da83ad03f9bf39c57d5d6916ea3 100644 (file)
@@ -4367,15 +4367,39 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker
             }
         };
 
+        int scrollbarThickness = WidgetUtil.getNativeScrollbarSize();
+        if (BrowserInfo.get().isIE()) {
+            /*
+             * IE refuses to scroll properly if the DIV isn't at least one pixel
+             * larger than the scrollbar controls themselves. But, probably
+             * because of subpixel rendering, in Grid, one pixel isn't enough,
+             * so we'll add two instead.
+             */
+            if (BrowserInfo.get().isIE9()) {
+                scrollbarThickness += 2;
+            } else {
+                scrollbarThickness += 1;
+            }
+        }
+
         root.appendChild(verticalScrollbar.getElement());
         verticalScrollbar.addScrollHandler(scrollHandler);
-        verticalScrollbar.setScrollbarThickness(WidgetUtil
-                .getNativeScrollbarSize());
+        verticalScrollbar.setScrollbarThickness(scrollbarThickness);
+
+        if (BrowserInfo.get().isIE8()) {
+            /*
+             * IE8 will have to compensate for a misalignment where it pops the
+             * scrollbar outside of its box. See Bug 3 in
+             * http://edskes.net/ie/ie8overflowandexpandingboxbugs.htm
+             */
+            Style vScrollStyle = verticalScrollbar.getElement().getStyle();
+            vScrollStyle.setRight(
+                    verticalScrollbar.getScrollbarThickness() - 1, Unit.PX);
+        }
 
         root.appendChild(horizontalScrollbar.getElement());
         horizontalScrollbar.addScrollHandler(scrollHandler);
-        horizontalScrollbar.setScrollbarThickness(WidgetUtil
-                .getNativeScrollbarSize());
+        horizontalScrollbar.setScrollbarThickness(scrollbarThickness);
         horizontalScrollbar
                 .addVisibilityHandler(new ScrollbarBundle.VisibilityHandler() {
                     @Override
@@ -4401,18 +4425,21 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker
         table.appendChild(footElem);
 
         Style hCornerStyle = headerDeco.getStyle();
-        hCornerStyle.setWidth(WidgetUtil.getNativeScrollbarSize(), Unit.PX);
+        hCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(),
+                Unit.PX);
         hCornerStyle.setDisplay(Display.NONE);
         root.appendChild(headerDeco);
 
         Style fCornerStyle = footerDeco.getStyle();
-        fCornerStyle.setWidth(WidgetUtil.getNativeScrollbarSize(), Unit.PX);
+        fCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(),
+                Unit.PX);
         fCornerStyle.setDisplay(Display.NONE);
         root.appendChild(footerDeco);
 
         Style hWrapperStyle = horizontalScrollbarDeco.getStyle();
         hWrapperStyle.setDisplay(Display.NONE);
-        hWrapperStyle.setHeight(WidgetUtil.getNativeScrollbarSize(), Unit.PX);
+        hWrapperStyle.setHeight(horizontalScrollbar.getScrollbarThickness(),
+                Unit.PX);
         root.appendChild(horizontalScrollbarDeco);
 
         setStylePrimaryName("v-escalator");