private HandlerRegistration scrollSizeTemporaryScrollHandler;
private HandlerRegistration offsetSizeTemporaryScrollHandler;
+ private HandlerRegistration scrollInProgress;
private ScrollbarBundle() {
root.appendChild(scrollSizeElement);
scrollPos = Math.max(0, Math.min(maxScrollPos, truncate(px)));
if (!WidgetUtil.pixelValuesEqual(oldScrollPos, scrollPos)) {
+ if (scrollInProgress == null) {
+ // Only used for tracking that there is "workPending"
+ scrollInProgress = addScrollHandler(new ScrollHandler() {
+ @Override
+ public void onScroll(ScrollEvent event) {
+ scrollInProgress.removeHandler();
+ scrollInProgress = null;
+ }
+ });
+ }
if (isInvisibleScrollbar) {
invisibleScrollbarTemporaryResizer.show();
}
// requestAnimationFrame - which is not automatically checked
return scrollSizeTemporaryScrollHandler != null
|| offsetSizeTemporaryScrollHandler != null
- || scrollEventFirer.isBeingFired;
+ || scrollInProgress != null || scrollEventFirer.isBeingFired;
}
}
"0. Requested items 247 - 346", getLogRow(0));
assertEquals("There should be only one log row", " ", getLogRow(1));
}
+
+ @Test
+ public void workPendingWhileScrolling() {
+ openTestURL("theme=valo");
+ String script = "var c = window.vaadin.clients.runcomvaadintestscomponentsgridbasicfeaturesGridBasicFeatures;\n"
+ // Scroll down and cause lazy loading
+ + "c.getElementByPath(\"//Grid[0]#cell[21]\"); \n"
+ + "return c.isActive();";
+
+ Boolean active = (Boolean) executeScript(script);
+ assertTrue("Grid should be marked to have workPending while scrolling",
+ active);
+ }
+
}