if ("hidden".equals(originalOverflow)) {
return;
}
+
+ // check the scrolltop value before hiding the element
+ final int scrolltop = elem.getScrollTop();
elem.getStyle().setProperty("overflow", "hidden");
DeferredCommand.addCommand(new Command() {
public void execute() {
// Dough, Safari scroll auto means actually just a moped
elem.getStyle().setProperty("overflow", originalOverflow);
- if (elem.getScrollTop() > 0) {
+
+ if (scrolltop > 0 || elem.getScrollTop() > 0) {
+ int scrollvalue = scrolltop;
+ if (scrolltop == 0) {
+ // mysterious are the ways of webkits scrollbar
+ // handling. In some cases webkit reports bad (0)
+ // scrolltop before hiding the elment temporary,
+ // sometimes after.
+ scrollvalue = elem.getScrollTop();
+ }
// fix another bug where scrollbar remains in wrong
// position
- int scrolltop = elem.getScrollTop();
- elem.setScrollTop(scrolltop - 1);
- elem.setScrollTop(scrolltop);
+ elem.setScrollTop(scrollvalue - 1);
+ elem.setScrollTop(scrollvalue);
}
}
});
if (currentlyVisible < pageLength
&& currentlyVisible < totalRows) {
// shake scrollpanel to fill empty space
- bodyContainer.setScrollPosition(bodyContainer
- .getScrollPosition() + 1);
- bodyContainer.setScrollPosition(bodyContainer
- .getScrollPosition() - 1);
+ bodyContainer.setScrollPosition(scrollTop + 1);
+ bodyContainer.setScrollPosition(scrollTop - 1);
}
}
}
}
private int contentAreaBorderHeight = -1;
+ private int scrollLeft;
+ private int scrollTop;
/**
* @return border top + border bottom of the scrollable area of table
* user scrolls
*/
public void onScroll(ScrollEvent event) {
- int scrollLeft = bodyContainer.getElement().getScrollLeft();
- int scrollTop = bodyContainer.getScrollPosition();
+ scrollLeft = bodyContainer.getElement().getScrollLeft();
+ scrollTop = bodyContainer.getScrollPosition();
if (!initializedAndAttached) {
return;
}
rowRequestHandler.cancel();
+ if (BrowserInfo.get().isSafari() && event != null && scrollTop == 0) {
+ // due to the webkitoverflowworkaround, top may sometimes report 0
+ // for webkit, although it really is not. Expecting to have the
+ // correct
+ // value available soon.
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ onScroll(null);
+ }
+ });
+ return;
+ }
+
// fix headers horizontal scrolling
tHead.setHorizontalScrollPosition(scrollLeft);