Bug 1408293 - Eagerly style new children inserted in XUL listbox. r=bz

MozReview-Commit-ID: HLATTkLd1X8

--HG--
extra : rebase_source : 4d90878c5a357a033620cfca2d4c69f56f8cfc32
This commit is contained in:
Xidorn Quan 2017-10-25 18:00:54 +11:00
parent 362316451f
commit 5beed314a8
3 changed files with 16 additions and 7 deletions

View File

@ -8038,6 +8038,16 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
}
#endif
auto styleNewChildRangeEagerly =
[this, aInsertionKind, aContainer, aStartChild, aEndChild]() {
// When aInsertionKind == InsertionKind::Sync, we know that the
// styles are up-to-date already.
if (aInsertionKind == InsertionKind::Async &&
aContainer->IsStyledByServo()) {
StyleNewChildRange(aStartChild, aEndChild);
}
};
bool isSingleInsert = (aStartChild->GetNextSibling() == aEndChild);
NS_ASSERTION(isSingleInsert ||
aInsertionKind == InsertionKind::Sync,
@ -8047,6 +8057,8 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
#ifdef MOZ_XUL
if (aContainer && IsXULListBox(aContainer)) {
// For XUL list box, we need to style the new children eagerly.
styleNewChildRangeEagerly();
if (isSingleInsert) {
if (NotifyListBoxBody(mPresShell->GetPresContext(), aContainer,
// The insert case in NotifyListBoxBody
@ -8143,11 +8155,8 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
}
// We couldn't construct lazily. Make Servo eagerly traverse the new content
// if needed (when aInsertionKind == InsertionKind::Sync, we know that the
// styles are up-to-date already).
if (aInsertionKind == InsertionKind::Async && aContainer->IsStyledByServo()) {
StyleNewChildRange(aStartChild, aEndChild);
}
// if needed.
styleNewChildRangeEagerly();
InsertionPoint insertion;
if (isSingleInsert) {

View File

@ -1342,7 +1342,7 @@ fuzzy-if(skiaContent,1,5) == 482659-1d.html 482659-1-ref.html
== 486052-2f.html 486052-2-ref.html
== 486052-2g.html 486052-2-ref.html
== 486065-1.html 486065-1-ref.html
skip-if(stylo||styloVsGecko) == 486848-1.xul 486848-1-ref.xul # bug 1408293
== 486848-1.xul 486848-1-ref.xul
== 487539-1.html about:blank
== 488390-1.html 488390-1-ref.html
== 488649-1.html 488649-1-ref.html

View File

@ -70,7 +70,7 @@ load 430356-1.xhtml
load 431738.xhtml
load 432058-1.xul
load 432068-1.xul
skip-if(stylo) load 432068-2.xul # bug 1407865
load 432068-2.xul
load 433296-1.xul
load 433429.xul
load 434458-1.xul