Bug 1512838 - Skip over empty transaction buckets in isLayerized. r=botond
☠☠ backed out by 8f2a6dbf221c ☠ ☠
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 15 Mar 2019 20:29:57 +0000
changeset 464443 6bd80d61cee83fb8a24e98317c1b1594b3be5c25
parent 464442 754f833aaa41a015efbe682e17313e38d765ba94
child 464444 589f41b2e2536f28eba24afdab49916635a9bf4e
push id35716
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:42:17 +0000
treeherdermozilla-central@8ee97c045359 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1512838
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1512838 - Skip over empty transaction buckets in isLayerized. r=botond Sometimes we can get empty transactions after a scrollframe is layerized. In such cases the isLayerized check would incorrectly detect the scrollframe as not being layerized because it would only look at the data for the empty transaction. Differential Revision: https://phabricator.services.mozilla.com/D23495
gfx/layers/apz/test/mochitest/apz_test_utils.js
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -52,16 +52,19 @@ function convertBuckets(buckets) {
 
 function convertTestData(testData) {
   var result = {};
   result.paints = convertBuckets(testData.paints);
   result.repaintRequests = convertBuckets(testData.repaintRequests);
   return result;
 }
 
+// Returns the last bucket that has at least one scrollframe. This
+// is useful for skipping over buckets that are from empty transactions,
+// because those don't contain any useful data.
 function getLastNonemptyBucket(buckets) {
   for (var i = buckets.length - 1; i >= 0; --i) {
     if (buckets[i].scrollFrames.length > 0) {
       return buckets[i];
     }
   }
   return null;
 }
@@ -121,18 +124,19 @@ function findRcdNode(apzcTree) {
   return null;
 }
 
 // Return whether an element whose id includes |elementId| has been layerized.
 // Assumes |elementId| will be present in the content description for the
 // element, and not in the content descriptions of other elements.
 function isLayerized(elementId) {
   var contentTestData = SpecialPowers.getDOMWindowUtils(window).getContentAPZTestData();
-  ok(contentTestData.paints.length > 0, "expected at least one paint");
-  var seqno = contentTestData.paints[contentTestData.paints.length - 1].sequenceNumber;
+  var nonEmptyBucket = getLastNonemptyBucket(contentTestData.paints);
+  ok(nonEmptyBucket != null, "expected at least one nonempty paint");
+  var seqno = nonEmptyBucket.sequenceNumber;
   contentTestData = convertTestData(contentTestData);
   var paint = contentTestData.paints[seqno];
   for (var scrollId in paint) {
     if ("contentDescription" in paint[scrollId]) {
       if (paint[scrollId].contentDescription.includes(elementId)) {
         return true;
       }
     }