Bug 1499655 - Move the flushLayout code into forceLayerTreeToCompositor. r=botond, a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 13 Dec 2018 12:24:08 +0000
changeset 506264 e4724d2e607659d3bbc77afd6aa1516628d347d9
parent 506263 8865b5aa95101018bbbff23f9fb2e096e8594517
child 506265 e6014768f6cd449b54372774b68b09fe18af9372
push id10352
push userryanvm@gmail.com
push dateMon, 17 Dec 2018 15:10:06 +0000
treeherdermozilla-beta@d2c26e2f1164 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, test-only
Bug 1499655 - Move the flushLayout code into forceLayerTreeToCompositor. r=botond, a=test-only These two bits of code conceptually belong together, since the flushLayout code is intended to work around a case where forceLayerTreeToCompositor wasn't doing anything. So it makes sense to just put them into the same function. Differential Revision: https://phabricator.services.mozilla.com/D14205
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -376,16 +376,18 @@ async function waitUntilApzStable() {
 // such a paint to happen if none are pending. This is useful to run after
 // the waitUntilApzStable() but before reading the compositor-side APZ test
 // data, because the test data for the content layers id only gets populated
 // on content layer tree updates *after* the root layer tree has a RefLayer
 // pointing to the contnet layer tree. waitUntilApzStable itself guarantees
 // that the root layer tree is pointing to the content layer tree, but does
 // not guarantee the subsequent paint; this function does that job.
 async function forceLayerTreeToCompositor() {
+  // Modify a style property to force a layout flush
+  document.body.style.left = "1px";
   var utils = SpecialPowers.getDOMWindowUtils(window);
   if (!utils.isMozAfterPaintPending) {
     dump("Forcing a paint since none was pending already...\n");
     var testMode = utils.isTestControllingRefreshes;
     if (!testMode) {
--- a/gfx/layers/apz/test/mochitest/helper_bug1151663.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1151663.html
@@ -11,20 +11,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="application/javascript">
     // -------------------------------------------------------------------
     // Infrastructure to get the test assertions to run at the right time.
     // -------------------------------------------------------------------
     var SimpleTest = window.opener.SimpleTest;
     var utils = SpecialPowers.getDOMWindowUtils(window);
-    function flushLayout() {
-      document.body.style.left = "1px";
-    }
     // --------------------------------------------------------------------
     // The actual logic for testing bug 1151663.
     // In this test we have a simple page which is scrollable, with a 
     // scrollable <div> which is also scrollable. We test that the
     // <div> does not get an initial APZC, since primary scrollable
     // frame is the page's root scroll frame.
     // --------------------------------------------------------------------
@@ -53,17 +49,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       // single child APZC which is for the RCD (fennec case).
       var rcd = findRcdNode(apzcTree);
       SimpleTest.ok(rcd != null, "found the RCD node");
       SimpleTest.is(rcd.children.length, 0, "expected no children on the RCD");
-    waitUntilApzStable().then(flushLayout).then(forceLayerTreeToCompositor).then(testBug1151663);
+    waitUntilApzStable().then(forceLayerTreeToCompositor).then(testBug1151663);
 <body style="height: 500px; overflow: scroll">
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151663">Mozilla Bug 1151663</a>
   <div style="height: 50px; width: 50px; overflow: scroll">
     <!-- Put enough content into the subframe to make it have a nonzero scroll range -->
     <div style="height: 100px; width: 50px"></div>