Bug 1353317 - stylo: For newly added content, note dirty descendants in the lazy frame construction case through the flattened tree parent. r=bholley

MozReview-Commit-ID: L6MhRK3zmSc

--HG--
extra : rebase_source : 575b146d66898d907b669cbe4295ca25f67a3031
This commit is contained in:
Cameron McCormack 2017-04-04 18:28:05 +08:00
Родитель 30211367ad
Коммит 67201815a8
4 изменённых файлов: 41 добавлений и 16 удалений

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

@ -7400,6 +7400,20 @@ nsCSSFrameConstructor::MaybeRecreateForFrameset(nsIFrame* aParentFrame,
return false;
}
void
nsCSSFrameConstructor::LazilyStyleNewChildRange(nsIContent* aStartChild,
nsIContent* aEndChild)
{
for (nsIContent* child = aStartChild; child != aEndChild;
child = child->GetNextSibling()) {
nsINode* parent = child->GetFlattenedTreeParent();
if (parent->IsElement()) {
MOZ_ASSERT(parent);
parent->AsElement()->NoteDirtyDescendantsForServo();
}
}
}
void
nsCSSFrameConstructor::StyleNewChildRange(nsIContent* aStartChild,
nsIContent* aEndChild)
@ -7516,7 +7530,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
// The Servo-backed style system handles this case like the lazy frame
// construction case.
if (isNewlyAddedContentForServo) {
aContainer->AsElement()->NoteDirtyDescendantsForServo();
LazilyStyleNewChildRange(aFirstNewContent, nullptr);
}
return;
}
@ -7524,7 +7538,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
if (aAllowLazyConstruction &&
MaybeConstructLazily(CONTENTAPPEND, aContainer, aFirstNewContent)) {
if (isNewlyAddedContentForServo) {
aContainer->AsElement()->NoteDirtyDescendantsForServo();
LazilyStyleNewChildRange(aFirstNewContent, nullptr);
}
return;
}
@ -7997,7 +8011,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
// The Servo-backed style system handles this case like the lazy frame
// construction case.
if (isNewlyAddedContentForServo) {
aContainer->AsElement()->NoteDirtyDescendantsForServo();
LazilyStyleNewChildRange(aStartChild, aEndChild);
}
return;
}
@ -8009,7 +8023,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
if (aAllowLazyConstruction &&
MaybeConstructLazily(CONTENTINSERT, aContainer, aStartChild)) {
if (isNewlyAddedContentForServo) {
aContainer->AsElement()->NoteDirtyDescendantsForServo();
LazilyStyleNewChildRange(aStartChild, aEndChild);
}
return;
}

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

@ -158,12 +158,23 @@ private:
nsIContent* aStartChild,
nsIContent* aEndChild);
/**
* For each child in the aStartChild/aEndChild range, calls
* NoteDirtyDescendantsForServo on their flattened tree parents. This is
* used when content is inserted into the document and we decide that
* we can do lazy frame construction. It handles children being rebound to
* different insertion points by calling NoteDirtyDescendantsForServo on each
* child's flattened tree parent. Only used when we are styled by Servo.
*/
void LazilyStyleNewChildRange(nsIContent* aStartChild, nsIContent* aEndChild);
/**
* For each child in the aStartChild/aEndChild range, calls StyleNewChildren
* on their flattened tree parents. This is used when content is inserted
* into the document. It handles children being rebound to different
* insertion points by calling StyleNewChildren on each child's flattened
* tree parent. Only used when we are styled by Servo.
* into the document and we decide that we cannot do lazy frame construction.
* It handles children being rebound to different insertion points by calling
* StyleNewChildren on each child's flattened tree parent. Only used when we
* are styled by Servo.
*/
void StyleNewChildRange(nsIContent* aStartChild, nsIContent* aEndChild);

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

@ -441,8 +441,8 @@ fails == 331809-1.html 331809-1.html
fails == 332557-1.html 332557-1.html
== 332975-1.html 332975-1.html
== 333970-1.html 333970-1.html
fails == 334829-1a.xhtml 334829-1a.xhtml
fails == 334829-1b.xhtml 334829-1b.xhtml
== 334829-1a.xhtml 334829-1a.xhtml
== 334829-1b.xhtml 334829-1b.xhtml
fails == 335628-1.html 335628-1.html
== 335628-2.xul 335628-2.xul
== 336096-1.xul 336096-1.xul
@ -888,7 +888,7 @@ fails == 403519-1.html 403519-1.html
== 403656-5.html 403656-5.html
== 403657-1.html 403657-1.html
== 403733-1.html 403733-1.html
fails == 403962-1.xhtml 403962-1.xhtml # Bug 1290276
== 403962-1.xhtml 403962-1.xhtml
== 404030-1.html 404030-1.html
== 404030-1-notref.html 404030-1-notref.html
== 404030-1-notref2.html 404030-1-notref2.html

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

@ -34,15 +34,15 @@
# testing bindings that have multiple insertion points
== multipleinsertionpoints-ref2.xhtml multipleinsertionpoints-ref2.xhtml
# append a single element
fails == multipleinsertionpoints-appendsingle-1.xhtml multipleinsertionpoints-appendsingle-1.xhtml
fails == multipleinsertionpoints-appendsingle-2.xhtml multipleinsertionpoints-appendsingle-2.xhtml
== multipleinsertionpoints-appendsingle-1.xhtml multipleinsertionpoints-appendsingle-1.xhtml
== multipleinsertionpoints-appendsingle-2.xhtml multipleinsertionpoints-appendsingle-2.xhtml
# append several elements
fails == multipleinsertionpoints-appendmultiple.xhtml multipleinsertionpoints-appendmultiple.xhtml
== multipleinsertionpoints-appendmultiple.xhtml multipleinsertionpoints-appendmultiple.xhtml
# insert a single element
fails == multipleinsertionpoints-insertsingle-1.xhtml multipleinsertionpoints-insertsingle-1.xhtml
fails == multipleinsertionpoints-insertsingle-2.xhtml multipleinsertionpoints-insertsingle-2.xhtml
== multipleinsertionpoints-insertsingle-1.xhtml multipleinsertionpoints-insertsingle-1.xhtml
== multipleinsertionpoints-insertsingle-2.xhtml multipleinsertionpoints-insertsingle-2.xhtml
# insert several elements
fails == multipleinsertionpoints-insertmultiple.xhtml multipleinsertionpoints-insertmultiple.xhtml
== multipleinsertionpoints-insertmultiple.xhtml multipleinsertionpoints-insertmultiple.xhtml
# test appending some nodes whose frame construction should be done lazily
# followed by appending a node that might not be done lazily