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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-03-17 10:42:18 +00:00
Родитель 4a9719b73e
Коммит 01ce19d355
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -57,6 +57,9 @@ function convertTestData(testData) {
return result; 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) { function getLastNonemptyBucket(buckets) {
for (var i = buckets.length - 1; i >= 0; --i) { for (var i = buckets.length - 1; i >= 0; --i) {
if (buckets[i].scrollFrames.length > 0) { if (buckets[i].scrollFrames.length > 0) {
@ -126,8 +129,9 @@ function findRcdNode(apzcTree) {
// element, and not in the content descriptions of other elements. // element, and not in the content descriptions of other elements.
function isLayerized(elementId) { function isLayerized(elementId) {
var contentTestData = SpecialPowers.getDOMWindowUtils(window).getContentAPZTestData(); var contentTestData = SpecialPowers.getDOMWindowUtils(window).getContentAPZTestData();
ok(contentTestData.paints.length > 0, "expected at least one paint"); var nonEmptyBucket = getLastNonemptyBucket(contentTestData.paints);
var seqno = contentTestData.paints[contentTestData.paints.length - 1].sequenceNumber; ok(nonEmptyBucket != null, "expected at least one nonempty paint");
var seqno = nonEmptyBucket.sequenceNumber;
contentTestData = convertTestData(contentTestData); contentTestData = convertTestData(contentTestData);
var paint = contentTestData.paints[seqno]; var paint = contentTestData.paints[seqno];
for (var scrollId in paint) { for (var scrollId in paint) {