Bug 1452080: Rename ComputedStyle::PresContext to PresContextForFrame. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 06 Apr 2018 14:53:06 +0200
changeset 412359 433416ba2a3a058eb99036f12783dd8f3e2519f2
parent 412358 9e1a485cfb22d94fbe487efe2e2f3e2fda29dc87
child 412360 cfe13e874f02c53a3d993075cc1b046b874cde4c
push id62353
push userecoal95@gmail.com
push dateMon, 09 Apr 2018 09:20:09 +0000
treeherderautoland@433416ba2a3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1452080
milestone61.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 1452080: Rename ComputedStyle::PresContext to PresContextForFrame. r=xidorn And make nsIFrame its only caller, modulo a safety assertion. The safety assertion will be removed at the same time as the pres context member, since the only purpose of it is to ensure we don't keep a pres context reference for too long. MozReview-Commit-ID: CD5zOHVO9ub
layout/generic/nsIFrame.h
layout/style/ComputedStyle.cpp
layout/style/ComputedStyle.h
layout/style/ComputedStyleInlines.h
layout/style/ServoStyleSet.cpp
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -630,17 +630,17 @@ public:
     , mMayHaveTransformAnimation(false)
     , mMayHaveOpacityAnimation(false)
     , mAllDescendantsAreInvisible(false)
   {
     mozilla::PodZero(&mOverflow);
   }
 
   nsPresContext* PresContext() const {
-    return Style()->PresContext();
+    return Style()->PresContextForFrame();
   }
 
   nsIPresShell* PresShell() const {
     return PresContext()->PresShell();
   }
 
   /**
    * Called to initialize the frame. This is called immediately after creating
--- a/layout/style/ComputedStyle.cpp
+++ b/layout/style/ComputedStyle.cpp
@@ -313,17 +313,17 @@ void ComputedStyle::List(FILE* out, int3
   fprintf_stderr(out, "%s{ServoComputedData}\n", str.get());
 }
 #endif
 
 
 nsIPresShell*
 ComputedStyle::Arena()
 {
-  return PresContext()->PresShell();
+  return mPresContext->PresShell();
 }
 
 template<typename Func>
 static nscolor
 GetVisitedDependentColorInternal(ComputedStyle* aSc, Func aColorFunc)
 {
   nscolor colors[2];
   colors[0] = aColorFunc(aSc);
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -110,17 +110,19 @@ class ComputedStyle;
 class ComputedStyle
 {
 public:
   ComputedStyle(nsPresContext* aPresContext,
                 nsAtom* aPseudoTag,
                 CSSPseudoElementType aPseudoType,
                 ServoComputedDataForgotten aComputedValues);
 
-  nsPresContext* PresContext() const { return mPresContext; }
+  // FIXME(emilio, bug 548397): This will need to go away. Don't add new callers
+  // of this methed.
+  nsPresContext* PresContextForFrame() const { return mPresContext; }
   const ServoComputedData* ComputedData() const { return &mSource; }
 
   // These two methods are for use by ArenaRefPtr.
   //
   // FIXME(emilio): Think this can go away.
   static mozilla::ArenaObjectID ArenaObjectID()
   {
     return mozilla::eArenaObjectID_GeckoComputedStyle;
--- a/layout/style/ComputedStyleInlines.h
+++ b/layout/style/ComputedStyleInlines.h
@@ -49,34 +49,34 @@ const nsStyle##name_ * ComputedStyle::Do
   }                                                                         \
                                                                             \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
                                                                             \
   /* perform any remaining main thread work on the struct */                \
   if (needToCompute) {                                                      \
     MOZ_ASSERT(NS_IsMainThread());                                          \
     MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal());              \
-    const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext(), nullptr); \
+    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
     /* the ComputedStyle owns the struct */                                 \
     AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                               \
   }                                                                         \
   return data;                                                              \
 }
 
 #define STYLE_STRUCT_RESET(name_)                                           \
 template<bool aComputeData>                                                 \
 const nsStyle##name_ * ComputedStyle::DoGetStyle##name_() {                 \
   const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_));        \
   if (!aComputeData && needToCompute) {                                     \
     return nullptr;                                                         \
   }                                                                         \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
   /* perform any remaining main thread work on the struct */                \
   if (needToCompute) {                                                      \
-    const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext(), nullptr); \
+    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
     /* the ComputedStyle owns the struct */                                 \
     AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                               \
   }                                                                         \
   return data;                                                              \
 }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT_RESET
 #undef STYLE_STRUCT_INHERITED
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -1416,17 +1416,17 @@ ServoStyleSet::ResolveStyleLazilyInterna
     computedValues =
       Servo_ResolveStyleLazily(elementForStyleResolution,
                                pseudoTypeForStyleResolution,
                                aRuleInclusion,
                                &Snapshots(),
                                mRawSet.get()).Consume();
   }
 
-  MOZ_DIAGNOSTIC_ASSERT(computedValues->PresContext() == GetPresContext() ||
+  MOZ_DIAGNOSTIC_ASSERT(computedValues->PresContextForFrame() == GetPresContext() ||
                         aElement->OwnerDoc()->GetBFCacheEntry());
 
   return computedValues.forget();
 }
 
 bool
 ServoStyleSet::AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
 {