Bug 1384232: Don't post restyles when loading XBL stylesheets. r?TYLin
MozReview-Commit-ID: 3MCz4vuJb9q
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -1387,17 +1387,23 @@ ServoStyleSet::ResolveForDeclarations(
aParentOrNull,
aDeclarations).Consume();
}
void
ServoStyleSet::UpdateStylist()
{
MOZ_ASSERT(StylistNeedsUpdate());
- Element* root = mPresContext->Document()->GetDocumentElement();
+
+ // There's no need to compute invalidations and such for an XBL styleset,
+ // since they are loaded and unloaded synchronously, and they don't have to
+ // deal with dynamic content changes.
+ Element* root =
+ IsMaster() ? mPresContext->Document()->GetDocumentElement() : nullptr;
+
Servo_StyleSet_FlushStyleSheets(mRawSet.get(), root);
mStylistState = StylistState::NotDirty;
}
void
ServoStyleSet::MaybeGCRuleTree()
{
MOZ_ASSERT(NS_IsMainThread());