Bug 1380133 - Part 3: Remove nsPresContext argument to ServoStyleContext::ResolveSameStructsAs. r=emilio draft
authorCameron McCormack <cam@mcc.id.au>
Fri, 21 Jul 2017 11:42:43 +0800
changeset 612842 63e1e4fba69c587f7eb403efd7d8dd98214c86ac
parent 612841 c4df8f13546511b504aefb0fa481d5f4171955ee
child 612843 b77d33b5823eca4a57e568881c00959ddecf9089
push id69614
push userbmo:cam@mcc.id.au
push dateFri, 21 Jul 2017 03:44:21 +0000
reviewersemilio
bugs1380133
milestone56.0a1
Bug 1380133 - Part 3: Remove nsPresContext argument to ServoStyleContext::ResolveSameStructsAs. r=emilio We have it in mPresContext already. MozReview-Commit-ID: G1kKHGFOXTp --- layout/base/ServoRestyleManager.cpp | 2 +- layout/generic/ViewportFrame.cpp | 2 +- layout/style/ServoStyleContext.h | 3 +-- layout/style/ServoStyleContextInlines.h | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-)
layout/base/ServoRestyleManager.cpp
layout/generic/ViewportFrame.cpp
layout/style/ServoStyleContext.h
layout/style/ServoStyleContextInlines.h
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -553,17 +553,17 @@ ServoRestyleManager::ProcessPostTraversa
     MOZ_ASSERT(styleFrame || displayContentsNode);
     RefPtr<ServoStyleContext> currentContext =
       aRestyleState.StyleSet().ResolveServoStyle(aElement, aRestyleBehavior);
     MOZ_ASSERT(oldStyleContext->ComputedValues() != currentContext->ComputedValues());
 
     newContext = currentContext;
     newContext->UpdateWithElementState(aElement);
 
-    newContext->ResolveSameStructsAs(PresContext(), oldStyleContext);
+    newContext->ResolveSameStructsAs(oldStyleContext);
 
     // We want to walk all the continuations here, even the ones with different
     // styles.  In practice, the only reason we get continuations with different
     // styles here is ::first-line (::first-letter never affects element
     // styles).  But in that case, newContext is the right context for the
     // _later_ continuations anyway (the ones not affected by ::first-line), not
     // the earlier ones, so there is no point stopping right at the point when
     // we'd actually be setting the right style context.
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -423,17 +423,17 @@ ViewportFrame::UpdateStyle(ServoRestyleS
   nsIAtom* pseudo = oldContext->GetPseudo();
   RefPtr<ServoStyleContext> newContext =
     aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(pseudo, nullptr);
 
   // We're special because we have a null GetContent(), so don't call things
   // like UpdateStyleOfOwnedChildFrame that try to append changes for the
   // content to the change list.  Nor do we computed a changehint, since we have
   // no way to apply it anyway.
-  newContext->ResolveSameStructsAs(PresContext(), oldContext);
+  newContext->ResolveSameStructsAs(oldContext);
 
   MOZ_ASSERT(!GetNextContinuation(), "Viewport has continuations?");
   SetStyleContext(newContext);
 
   UpdateStyleOfOwnedAnonBoxes(aRestyleState);
 }
 
 void
--- a/layout/style/ServoStyleContext.h
+++ b/layout/style/ServoStyleContext.h
@@ -38,18 +38,17 @@ public:
   // Update visited state for a given element, and set the prescontext's
   // body text color if applicable.
   void UpdateWithElementState(dom::Element* aElement);
 
   /**
    * Makes this context match |aOther| in terms of which style structs have
    * been resolved.
    */
-  inline void ResolveSameStructsAs(nsPresContext* aPresContext,
-                                   const ServoStyleContext* aOther);
+  inline void ResolveSameStructsAs(const ServoStyleContext* aOther);
 
 private:
   nsPresContext* mPresContext;
   ServoComputedValues mSource;
 };
 
 } // namespace mozilla
 
--- a/layout/style/ServoStyleContextInlines.h
+++ b/layout/style/ServoStyleContextInlines.h
@@ -10,29 +10,29 @@
 
 #include "nsStyleStruct.h"
 #include "ServoBindings.h"
 #include "mozilla/ServoStyleContext.h"
 
 namespace mozilla {
 
 void
-ServoStyleContext::ResolveSameStructsAs(nsPresContext* aPresContext, const ServoStyleContext* aOther)
+ServoStyleContext::ResolveSameStructsAs(const ServoStyleContext* aOther)
 {
   // Only resolve structs that are not already resolved in this struct.
   uint64_t ourBits = mBits & NS_STYLE_INHERIT_MASK;
   uint64_t otherBits = aOther->mBits & NS_STYLE_INHERIT_MASK;
   uint64_t newBits = otherBits & ~ourBits & NS_STYLE_INHERIT_MASK;
 
 #define STYLE_STRUCT(name_, checkdata_cb)                                           \
   if (nsStyle##name_::kHasFinishStyle && newBits & NS_STYLE_INHERIT_BIT(name_)) {   \
     const nsStyle##name_* data = ComputedValues()->GetStyle##name_();               \
-    const_cast<nsStyle##name_*>(data)->FinishStyle(aPresContext);                   \
+    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext);                   \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
   mBits |= newBits;
 }
 
 } // namespace mozilla
 
-#endif // mozilla_ContextInlines_h
\ No newline at end of file
+#endif // mozilla_ContextInlines_h