Bug 1290276 Part 3 - Move nsStyleSet's call to SetBindingManager to PresShell::Init(). draft
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 05 Jun 2017 14:33:30 +0800
changeset 590807 d8db84c5e5db239d10d869e591c3e9e20fe4c74e
parent 590806 2e2aeba528f2c262dfa0ee42f39124db6be1da20
child 590808 9aeb2cb70e0bd5b2565721b45440e59cda65af7f
push id62831
push userbmo:tlin@mozilla.com
push dateThu, 08 Jun 2017 03:44:02 +0000
bugs1290276
milestone55.0a1
Bug 1290276 Part 3 - Move nsStyleSet's call to SetBindingManager to PresShell::Init(). 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?