Bug 1384232: Don't post restyles when loading XBL stylesheets. r?TYLin draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 31 Aug 2017 22:59:11 +0200
changeset 657382 136e83e9d5db3cea63a853890ec32580b704a0f5
parent 657381 6b6aaae101bf1408aee78d517b20fee9d84a03d8
child 657383 a010a8d35905661eaa236131073eac3cb67b3b23
push id77506
push userbmo:emilio@crisal.io
push dateFri, 01 Sep 2017 10:57:54 +0000
reviewersTYLin
bugs1384232
milestone57.0a1
Bug 1384232: Don't post restyles when loading XBL stylesheets. r?TYLin MozReview-Commit-ID: 3MCz4vuJb9q
layout/style/ServoStyleSet.cpp
--- 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());