Bug 1290276 Part 3 - Move nsStyleSet's call to SetBindingManager to PresShell::Init(). r=heycam
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 05 Jun 2017 14:33:30 +0800
changeset 411107 a462579a738ffae396bf19865361a27cd9896850
parent 411106 b47e827616c4ae4549f865729bf421d63d7f3e01
child 411108 9ca52a56010a0f54f0021dadbec4a00c07a82654
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1290276
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1290276 Part 3 - Move nsStyleSet's call to SetBindingManager to PresShell::Init(). r=heycam Delete the NS_WARNING because it's not needed once this bug is fixed. MozReview-Commit-ID: Ht3ayjSvYW8
layout/base/PresShell.cpp
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -966,16 +966,23 @@ PresShell::Init(nsIDocument* aDocument,
   mPresContext->AttachShell(this, aStyleSet->BackendType());
 
   // Now we can initialize the style set. Make sure to set the member before
   // calling Init, since various subroutines need to find the style set off
   // the PresContext during initialization.
   mStyleSet = aStyleSet;
   mStyleSet->Init(aPresContext);
 
+  // Set up our style rule observer. We don't need to inform a ServoStyleSet
+  // of the binding manager because it gets XBL style sheets from bindings
+  // in a different way.
+  if (mStyleSet->IsGecko()) {
+    mStyleSet->AsGecko()->SetBindingManager(mDocument->BindingManager());
+  }
+
   // Notify our prescontext that it now has a compatibility mode.  Note that
   // this MUST happen after we set up our style set but before we create any
   // frames.
   mPresContext->CompatibilityModeChanged();
 
   // Add the preference style sheet.
   UpdatePreferenceStyles();
 
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2741,26 +2741,16 @@ nsCSSFrameConstructor::ConstructDocEleme
 
 nsIFrame*
 nsCSSFrameConstructor::ConstructRootFrame()
 {
   AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
 
   StyleSetHandle styleSet = mPresShell->StyleSet();
 
-  // Set up our style rule observer.
-  // XXXbz wouldn't this make more sense as part of presshell init?
-  if (styleSet->IsGecko()) {
-    // XXXheycam We don't support XBL bindings providing style to
-    // ServoStyleSets yet.
-    styleSet->AsGecko()->SetBindingManager(mDocument->BindingManager());
-  } else {
-    NS_WARNING("stylo: cannot get ServoStyleSheets from XBL bindings yet. See bug 1290276.");
-  }
-
   // --------- BUILD VIEWPORT -----------
   RefPtr<nsStyleContext> viewportPseudoStyle =
     styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport,
                                                  nullptr);
   ViewportFrame* viewportFrame =
     NS_NewViewportFrame(mPresShell, viewportPseudoStyle);
 
   // XXXbz do we _have_ to pass a null content pointer to that frame?