Bug 1423011 - Part 4: Fix for overflow-x:hidden test failures in the mochitest test_wheel_default_action.html. r?botond
Scrolling is not permitted along the axis whose overflow style is hidden. In
the mochitest test_wheel_default_action, tests which checked if overflow hidden
pages were scrollable failed after the changes in the Part 1 patch were
submitted to try. The tests failed as overflow hidden pages were scrollable.
After investigating the sequence of events, we realized that the
overflow-x:hidden property was taking effect on the compositor thread after the
scroll-wheel event was received on the compositor thread. Therefore, scrolling
took place even before the scrollable rect was sized appropriately and
scrolling beyond the layout viewport size was possible. To solve this, we wait
for all repaints to occur before the test sends a scroll-wheel event. Waiting
for all repaints guarantees that the overflow-x:hidden property will be set
before a scroll-wheel event is received.
MozReview-Commit-ID: 2hc3MTyKhnS
--- a/dom/events/test/window_wheel_default_action.html
+++ b/dom/events/test/window_wheel_default_action.html
@@ -903,22 +903,30 @@ function doTestScroll(aSettings, aCallba
}
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
var currentTest = kTests[currentTestIndex];
description = "doTestScroll(aSettings=" + aSettings.description + "), " + currentTest.description + ": ";
if (currentTest.prepare) {
- currentTest.prepare(doTestCurrentScroll);
+ // prepare() can make changes to a page such as
+ // changing the 'overflow' property which requires
+ // a repaint to take effect before sending
+ // scroll-wheel events.
+ currentTest.prepare(doWaitForPaintsAndScroll);
} else {
doTestCurrentScroll();
}
}
+ function doWaitForPaintsAndScroll() {
+ waitForAllPaintsFlushed(doTestCurrentScroll);
+ }
+
function doTestCurrentScroll() {
var currentTest = kTests[currentTestIndex];
sendWheelAndWait(10, 10, currentTest.event, function () {
if (currentTest.expected == kNoScroll) {
is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
} else {
var scrollUp = !isYReverted ? (currentTest.expected & kScrollUp) :