Bug 1347381: Tell Servo earlier about stylesheet changes. r=heycam

MozReview-Commit-ID: 4FcFzvSTckm

--HG--
extra : rebase_source : 400153f672850975794b01fe7564e01b5ac65241
This commit is contained in:
Emilio Cobos Álvarez 2017-03-15 19:54:11 +01:00
parent c85ce403fd
commit 4b44bcc15e

View File

@ -4580,6 +4580,17 @@ nsIPresShell::RestyleForCSSRuleChanges()
mPresContext->RebuildCounterStyles(); mPresContext->RebuildCounterStyles();
} }
// Tell Servo that the contents of style sheets have changed.
//
// NB: It's important to do so before bailing out.
//
// Even if we have no frames, we can end up styling those when creating
// them, and it's important for Servo to know that it needs to use the
// correct styles.
if (mStyleSet->IsServo()) {
mStyleSet->AsServo()->NoteStyleSheetsChanged();
}
Element* root = mDocument->GetRootElement(); Element* root = mDocument->GetRootElement();
if (!mDidInitialize) { if (!mDidInitialize) {
// Nothing to do here, since we have no frames yet // Nothing to do here, since we have no frames yet
@ -4593,11 +4604,6 @@ nsIPresShell::RestyleForCSSRuleChanges()
RestyleManager* restyleManager = mPresContext->RestyleManager(); RestyleManager* restyleManager = mPresContext->RestyleManager();
if (mStyleSet->IsServo()) {
// Tell Servo that the contents of style sheets have changed.
mStyleSet->AsServo()->NoteStyleSheetsChanged();
}
if (scopeRoots.IsEmpty()) { if (scopeRoots.IsEmpty()) {
// If scopeRoots is empty, we know that mStylesHaveChanged was true at // If scopeRoots is empty, we know that mStylesHaveChanged was true at
// the beginning of this function, and that we need to restyle the whole // the beginning of this function, and that we need to restyle the whole