final Element root = DOM.createDiv();
setElement(root);
+ setupScrollbars(root);
+
+ tableWrapper = DivElement.as(DOM.createDiv());
+
+ root.appendChild(tableWrapper);
+
+ final Element table = DOM.createTable();
+ tableWrapper.appendChild(table);
+
+ table.appendChild(headElem);
+ table.appendChild(bodyElem);
+ table.appendChild(footElem);
+
+ Style hCornerStyle = headerDeco.getStyle();
+ hCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(),
+ Unit.PX);
+ hCornerStyle.setDisplay(Display.NONE);
+ root.appendChild(headerDeco);
+
+ Style fCornerStyle = footerDeco.getStyle();
+ fCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(),
+ Unit.PX);
+ fCornerStyle.setDisplay(Display.NONE);
+ root.appendChild(footerDeco);
+
+ Style hWrapperStyle = horizontalScrollbarDeco.getStyle();
+ hWrapperStyle.setDisplay(Display.NONE);
+ hWrapperStyle.setHeight(horizontalScrollbar.getScrollbarThickness(),
+ Unit.PX);
+ root.appendChild(horizontalScrollbarDeco);
+
+ setStylePrimaryName("v-escalator");
+
+ // init default dimensions
+ setHeight(null);
+ setWidth(null);
+ }
+
+ private void setupScrollbars(final Element root) {
+
ScrollHandler scrollHandler = new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
}
});
- tableWrapper = DivElement.as(DOM.createDiv());
-
- root.appendChild(tableWrapper);
-
- final Element table = DOM.createTable();
- tableWrapper.appendChild(table);
-
- table.appendChild(headElem);
- table.appendChild(bodyElem);
- table.appendChild(footElem);
-
- Style hCornerStyle = headerDeco.getStyle();
- hCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(),
- Unit.PX);
- hCornerStyle.setDisplay(Display.NONE);
- root.appendChild(headerDeco);
-
- Style fCornerStyle = footerDeco.getStyle();
- fCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(),
- Unit.PX);
- fCornerStyle.setDisplay(Display.NONE);
- root.appendChild(footerDeco);
-
- Style hWrapperStyle = horizontalScrollbarDeco.getStyle();
- hWrapperStyle.setDisplay(Display.NONE);
- hWrapperStyle.setHeight(horizontalScrollbar.getScrollbarThickness(),
- Unit.PX);
- root.appendChild(horizontalScrollbarDeco);
-
- setStylePrimaryName("v-escalator");
-
- // init default dimensions
- setHeight(null);
- setWidth(null);
+ /*
+ * Because of all the IE hacks we've done above, we now have scrollbars
+ * hiding underneath a lot of DOM elements.
+ *
+ * This leads to problems with OSX (and many touch-only devices) when
+ * scrollbars are only shown when scrolling, as the scrollbar elements
+ * are hidden underneath everything. We trust that the scrollbars behave
+ * properly in these situations and simply pop them out with a bit of
+ * z-indexing.
+ */
+ if (WidgetUtil.getNativeScrollbarSize() == 0) {
+ verticalScrollbar.getElement().getStyle().setZIndex(90);
+ horizontalScrollbar.getElement().getStyle().setZIndex(90);
+ }
}
@Override