Bug 1423011 - Part 4: Fix for overflow-x:hidden test failures in the mochitest test_wheel_default_action.html. r?botond draft
authorTanushree Podder <tpodder@mozilla.com>
Tue, 03 Jul 2018 13:12:17 -0400
changeset 815634 66572af458b8f2890c35ce28b1106887aa81be48
parent 815633 7dddb5ab185d3aa3ca1e8201f632d3fb8b5b0a8c
push id115589
push userbmo:tpodder@mozilla.com
push dateMon, 09 Jul 2018 16:10:51 +0000
reviewersbotond
bugs1423011
milestone63.0a1
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
dom/events/test/window_wheel_default_action.html
--- 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) :