Bug 1551053 - Check both list end and non-container items separately during display item merging r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D30941

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miko Mynttinen 2019-05-13 21:13:01 +00:00
Родитель f0a398cc59
Коммит 4a60cbef9c
4 изменённых файлов: 48 добавлений и 13 удалений

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

@ -7359,16 +7359,6 @@ class FlattenedDisplayListIterator {
}
}
/**
* Returns the the display item above |aCurrent| casted to nsDisplayWrapList,
* if possible.
*/
nsDisplayWrapList* GetNextAsWrapList(nsDisplayItem* aCurrent) const {
MOZ_ASSERT(aCurrent);
nsDisplayItem* next = aCurrent->GetAbove();
return next ? next->AsDisplayWrapList() : nullptr;
}
/**
* Tries to merge display items starting from |aCurrent|.
* Updates the internal pointer to the next display item.
@ -7392,14 +7382,15 @@ class FlattenedDisplayListIterator {
do {
willMerge.AppendElement(next);
} while ((next = GetNextAsWrapList(next)) && current->CanMerge(next));
mNext = next->GetAbove();
next = mNext ? mNext->AsDisplayWrapList() : nullptr;
} while (next && current->CanMerge(next));
current = mBuilder->MergeItems(willMerge);
}
// |mNext| will be either the first item that could not be merged with
// Here |mNext| will be either the first item that could not be merged with
// |current|, or nullptr.
mNext = next;
return current;
}

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

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
.will-merge {
opacity: 0.5;
}
</style>
</head>
<body>
<span class="will-merge">bar<br>baz</span>
<span>qux</span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
.will-merge {
opacity: 0.5;
}
</style>
</head>
<body>
<span id="foo">foo</span>
<span class="will-merge">bar<br>baz</span>
<span>qux</span>
<script type="text/javascript">
function doTest() {
var e = document.getElementById("foo");
e.parentNode.removeChild(e);
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
setTimeout(doTest, 5000);
</script>
</body>
</html>

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

@ -41,3 +41,4 @@ fuzzy(0-2,0-40000) skip-if(!asyncPan) == 1464288-1.html 1464288-ref.html
== 1504233-1.html 1504233-1-ref.html
== 1533317-1.html 1533317-1-ref.html
== 1544948-1.html 1544948-1-ref.html
skip-if(retainedDisplayList) == 1551053-1.html 1551053-1-ref.html