Bug 1455108: Don't reparent first-line stuff in display: none subtrees. r=heycam

We may no longer know what the right parent style is, and it's not like it
matters anyway, the frame tree under us is dead, including placeholders and such
holding from us.

MozReview-Commit-ID: 1RHTwvKy0zQ

--HG--
extra : rebase_source : 26e9d393d8edc0f068736cfa1cf1cf630e8d55fa
This commit is contained in:
Emilio Cobos Álvarez 2018-04-19 18:18:35 +02:00
Родитель 14578d6f2d
Коммит 3e3d930acb
3 изменённых файлов: 25 добавлений и 1 удалений

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

@ -3522,7 +3522,7 @@ RestyleManager::DoReparentComputedStyleForFirstLine(nsIFrame* aFrame,
ReparentFrameDescendants(aFrame, providerChild, aStyleSet);
// We do not need to do the equivalent of UpdateFramePseudoElementStyles,
// because those are hadled by our descendant walk.
// because those are handled by our descendant walk.
}
void
@ -3530,6 +3530,12 @@ RestyleManager::ReparentFrameDescendants(nsIFrame* aFrame,
nsIFrame* aProviderChild,
ServoStyleSet& aStyleSet)
{
if (aFrame->GetContent()->IsElement() &&
!aFrame->GetContent()->AsElement()->HasServoData()) {
// We're getting into a display: none subtree, avoid reparenting into stuff
// that is going to go away anyway in seconds.
return;
}
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
for (nsIFrame* child : lists.CurrentList()) {

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

@ -0,0 +1,17 @@
<!doctype html>
<style>
div::first-line {
color: yellow:
}
.foo span {
display: none;
}
.foo::first-line {
color: red;
}
</style>
<div><span>Yo, I'm a first-line<span> really</span></span>
<script>
document.body.offsetTop;
document.querySelector('div').classList.add('foo');
</script>

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

@ -273,3 +273,4 @@ pref(dom.webcomponents.shadowdom.enabled,true) load 1445682.html
load 1450691.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1453206.html
load 1454140.html
load 1455108.html