Bug 1524328 - Pass a document instead of a pres context to FinishStyle. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 02 Feb 2019 19:42:25 +0100
changeset 456577 96fd408e650f21a4d63ea3ff09f9a3bc25676360
parent 456576 43a3aa2199c12427c9784a9cdbb89f76cf1296a5
child 456578 5f006a3c652c3a5def8800b9b0e65c4213b86785
push id35490
push useraiakab@mozilla.com
push dateSun, 03 Feb 2019 09:50:26 +0000
treeherdermozilla-central@12b2328eedd1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1524328
milestone67.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 1524328 - Pass a document instead of a pres context to FinishStyle. r=xidorn Differential Revision: https://phabricator.services.mozilla.com/D18491
layout/style/ComputedStyleInlines.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/svg/SVGObserverUtils.cpp
--- a/layout/style/ComputedStyleInlines.h
+++ b/layout/style/ComputedStyleInlines.h
@@ -12,16 +12,17 @@
  */
 
 #ifndef ComputedStyleInlines_h
 #define ComputedStyleInlines_h
 
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/ServoComputedDataInlines.h"
 #include "mozilla/ServoUtils.h"
+#include "nsPresContext.h"
 
 namespace mozilla {
 
 #define STYLE_STRUCT(name_)                                       \
   const nsStyle##name_* ComputedStyle::Style##name_() {           \
     return DoGetStyle##name_<true>();                             \
   }                                                               \
   const nsStyle##name_* ComputedStyle::ThreadsafeStyle##name_() { \
@@ -32,34 +33,35 @@ namespace mozilla {
   }                                                               \
   const nsStyle##name_* ComputedStyle::PeekStyle##name_() {       \
     return DoGetStyle##name_<false>();                            \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 // Helper functions for GetStyle* and PeekStyle*
-#define STYLE_STRUCT(name_)                                                  \
-  template <bool aComputeData>                                               \
-  const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {                 \
-    const auto kStructID = StyleStructID::name_;                             \
-    const bool needToCompute = !HasRequestedStruct(kStructID);               \
-    if (!aComputeData && needToCompute) {                                    \
-      return nullptr;                                                        \
-    }                                                                        \
-    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::IsInServoTraversal());                            \
-      const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr); \
-      /* the ComputedStyle owns the struct */                                \
-      SetRequestedStruct(kStructID);                                         \
-    }                                                                        \
-    return data;                                                             \
+#define STYLE_STRUCT(name_)                                         \
+  template <bool aComputeData>                                      \
+  const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {        \
+    const auto kStructID = StyleStructID::name_;                    \
+    const bool needToCompute = !HasRequestedStruct(kStructID);      \
+    if (!aComputeData && needToCompute) {                           \
+      return nullptr;                                               \
+    }                                                               \
+    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::IsInServoTraversal());                   \
+      const_cast<nsStyle##name_*>(data)->FinishStyle(               \
+          *mPresContext->Document(), nullptr);                      \
+      /* the ComputedStyle owns the struct */                       \
+      SetRequestedStruct(kStructID);                                \
+    }                                                               \
+    return data;                                                    \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 void ComputedStyle::StartBackgroundImageLoads() {
   // Just get our background struct; that should do the trick
   StyleBackground();
 }
@@ -68,17 +70,18 @@ void ComputedStyle::ResolveSameStructsAs
   // Only resolve structs that are not already resolved in this struct.
   auto newBits = aOther->mRequestedStructs & ~mRequestedStructs;
 
 #define STYLE_STRUCT(name_)                                                    \
   if (nsStyle##name_::kHasFinishStyle &&                                       \
       (newBits & StyleStructConstants::BitFor(StyleStructID::name_))) {        \
     const nsStyle##name_* data = ComputedData()->GetStyle##name_();            \
     const nsStyle##name_* oldData = aOther->ComputedData()->GetStyle##name_(); \
-    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, oldData);     \
+    const_cast<nsStyle##name_*>(data)->FinishStyle(*mPresContext->Document(),  \
+                                                   oldData);                   \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
   mRequestedStructs |= newBits;
 }
 
 }  // namespace mozilla
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -284,22 +284,22 @@ nsStyleBorder::nsStyleBorder(const nsSty
       mBorder(aSrc.mBorder),
       mTwipsPerPixel(aSrc.mTwipsPerPixel) {
   MOZ_COUNT_CTOR(nsStyleBorder);
   NS_FOR_CSS_SIDES(side) { mBorderStyle[side] = aSrc.mBorderStyle[side]; }
 }
 
 nsStyleBorder::~nsStyleBorder() { MOZ_COUNT_DTOR(nsStyleBorder); }
 
-void nsStyleBorder::FinishStyle(nsPresContext* aPresContext,
+void nsStyleBorder::FinishStyle(Document& aDocument,
                                 const nsStyleBorder* aOldStyle) {
   MOZ_ASSERT(NS_IsMainThread());
 
   mBorderImageSource.ResolveImage(
-      aPresContext, aOldStyle ? &aOldStyle->mBorderImageSource : nullptr);
+      aDocument, aOldStyle ? &aOldStyle->mBorderImageSource : nullptr);
 }
 
 nsMargin nsStyleBorder::GetImageOutset() const {
   // We don't check whether there is a border-image (which is OK since
   // the initial values yields 0 outset) so that we don't have to
   // reflow to update overflow areas when an image loads.
   nsMargin outset;
   NS_FOR_CSS_SIDES(s) {
@@ -469,23 +469,23 @@ nsStyleList::nsStyleList(const nsStyleLi
     : mListStylePosition(aSource.mListStylePosition),
       mListStyleImage(aSource.mListStyleImage),
       mCounterStyle(aSource.mCounterStyle),
       mQuotes(aSource.mQuotes),
       mImageRegion(aSource.mImageRegion) {
   MOZ_COUNT_CTOR(nsStyleList);
 }
 
-void nsStyleList::FinishStyle(nsPresContext* aPresContext,
+void nsStyleList::FinishStyle(Document& aDocument,
                               const nsStyleList* aOldStyle) {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mListStyleImage && !mListStyleImage->IsResolved()) {
     mListStyleImage->Resolve(
-        aPresContext, aOldStyle ? aOldStyle->mListStyleImage.get() : nullptr);
+        aDocument, aOldStyle ? aOldStyle->mListStyleImage.get() : nullptr);
   }
 }
 
 nsChangeHint nsStyleList::CalcDifference(
     const nsStyleList& aNewData, const nsStyleDisplay* aOldDisplay) const {
   // If the quotes implementation is ever going to change we might not need
   // a framechange here and a reflow should be sufficient.  See bug 35768.
   if (mQuotes != aNewData.mQuotes &&
@@ -883,27 +883,27 @@ void StyleShapeSource::SetBasicShape(Uni
 
 void StyleShapeSource::SetPath(UniquePtr<StyleSVGPath> aPath) {
   MOZ_ASSERT(aPath);
   DoDestroy();
   new (&mSVGPath) UniquePtr<StyleSVGPath>(std::move(aPath));
   mType = StyleShapeSourceType::Path;
 }
 
-void StyleShapeSource::FinishStyle(nsPresContext* aPresContext,
+void StyleShapeSource::FinishStyle(Document& aDocument,
                                    const StyleShapeSource* aOldShapeSource) {
   if (GetType() != StyleShapeSourceType::Image) {
     return;
   }
 
   auto* oldShapeImage = (aOldShapeSource && aOldShapeSource->GetType() ==
                                                 StyleShapeSourceType::Image)
                             ? &aOldShapeSource->ShapeImage()
                             : nullptr;
-  mShapeImage->ResolveImage(aPresContext, oldShapeImage);
+  mShapeImage->ResolveImage(aDocument, oldShapeImage);
 }
 
 void StyleShapeSource::SetReferenceBox(StyleGeometryBox aReferenceBox) {
   DoDestroy();
   mReferenceBox = aReferenceBox;
   mType = StyleShapeSourceType::Box;
 }
 
@@ -1078,17 +1078,17 @@ nsStyleSVGReset::nsStyleSVGReset(const n
       mStopOpacity(aSource.mStopOpacity),
       mFloodOpacity(aSource.mFloodOpacity),
       mDominantBaseline(aSource.mDominantBaseline),
       mVectorEffect(aSource.mVectorEffect),
       mMaskType(aSource.mMaskType) {
   MOZ_COUNT_CTOR(nsStyleSVGReset);
 }
 
-void nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext,
+void nsStyleSVGReset::FinishStyle(Document& aDocument,
                                   const nsStyleSVGReset* aOldStyle) {
   MOZ_ASSERT(NS_IsMainThread());
 
   NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mMask) {
     nsStyleImage& image = mMask.mLayers[i].mImage;
     if (image.GetType() == eStyleImageType_Image) {
       const auto* url = image.GetURLValue();
       // If the url is a local ref, it must be a <mask-resource>, so we don't
@@ -1108,17 +1108,17 @@ void nsStyleSVGReset::FinishStyle(nsPres
 
       // Otherwise, we may need the image even if it has a reference, in case
       // the referenced element isn't a valid SVG <mask> element.
       const nsStyleImage* oldImage =
           (aOldStyle && aOldStyle->mMask.mLayers.Length() > i)
               ? &aOldStyle->mMask.mLayers[i].mImage
               : nullptr;
 
-      image.ResolveImage(aPresContext, oldImage);
+      image.ResolveImage(aDocument, oldImage);
     }
   }
 }
 
 nsChangeHint nsStyleSVGReset::CalcDifference(
     const nsStyleSVGReset& aNewData) const {
   nsChangeHint hint = nsChangeHint(0);
 
@@ -1846,26 +1846,24 @@ nsStyleImageRequest::~nsStyleImageReques
       }
     }
   }
 
   MOZ_ASSERT(!mRequestProxy);
   MOZ_ASSERT(!mImageTracker);
 }
 
-bool nsStyleImageRequest::Resolve(nsPresContext* aPresContext,
+bool nsStyleImageRequest::Resolve(Document& aDocument,
                                   const nsStyleImageRequest* aOldImageRequest) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!IsResolved(), "already resolved");
-  MOZ_ASSERT(aPresContext);
 
   mResolved = true;
 
-  Document* doc = aPresContext->Document();
-  nsIURI* docURI = doc->GetDocumentURI();
+  nsIURI* docURI = aDocument.GetDocumentURI();
   if (GetImageValue()->HasRef()) {
     bool isEqualExceptRef = false;
     RefPtr<nsIURI> imageURI = GetImageURI();
     if (!imageURI) {
       return false;
     }
 
     if (NS_SUCCEEDED(imageURI->EqualsExceptRef(docURI, &isEqualExceptRef)) &&
@@ -1876,41 +1874,42 @@ bool nsStyleImageRequest::Resolve(nsPres
   }
 
   // TODO(emilio, bug 1440442): This is a hackaround to avoid flickering due the
   // lack of non-http image caching in imagelib (bug 1406134), which causes
   // stuff like bug 1439285. Cleanest fix if that doesn't get fixed is bug
   // 1440305, but that seems too risky, and a lot of work to do before 60.
   //
   // Once that's fixed, the "old style" argument to FinishStyle can go away.
-  if (aPresContext->IsChrome() && aOldImageRequest &&
+  if (nsContentUtils::IsChromeDoc(&aDocument) && aOldImageRequest &&
       aOldImageRequest->IsResolved() && DefinitelyEquals(*aOldImageRequest)) {
-    MOZ_ASSERT(aOldImageRequest->mDocGroup == doc->GetDocGroup());
+    MOZ_ASSERT(aOldImageRequest->mDocGroup == aDocument.GetDocGroup());
     MOZ_ASSERT(mModeFlags == aOldImageRequest->mModeFlags);
 
     mDocGroup = aOldImageRequest->mDocGroup;
     mImageValue = aOldImageRequest->mImageValue;
     mRequestProxy = aOldImageRequest->mRequestProxy;
   } else {
-    mDocGroup = doc->GetDocGroup();
-    imgRequestProxy* request = mImageValue->LoadImage(doc);
-    if (aPresContext->IsDynamic()) {
+    mDocGroup = aDocument.GetDocGroup();
+    imgRequestProxy* request = mImageValue->LoadImage(&aDocument);
+    bool isPrint = !!aDocument.GetOriginalDocument();
+    if (!isPrint) {
       mRequestProxy = request;
     } else if (request) {
-      request->GetStaticRequest(doc, getter_AddRefs(mRequestProxy));
+      request->GetStaticRequest(&aDocument, getter_AddRefs(mRequestProxy));
     }
   }
 
   if (!mRequestProxy) {
     // The URL resolution or image load failed.
     return false;
   }
 
   if (mModeFlags & Mode::Track) {
-    mImageTracker = doc->ImageTracker();
+    mImageTracker = aDocument.ImageTracker();
   }
 
   MaybeTrackAndLock();
   return true;
 }
 
 void nsStyleImageRequest::MaybeTrackAndLock() {
   MOZ_ASSERT(NS_IsMainThread());
@@ -2853,21 +2852,20 @@ nsStyleBackground::nsStyleBackground(con
 
 nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
     : mImage(aSource.mImage), mBackgroundColor(aSource.mBackgroundColor) {
   MOZ_COUNT_CTOR(nsStyleBackground);
 }
 
 nsStyleBackground::~nsStyleBackground() { MOZ_COUNT_DTOR(nsStyleBackground); }
 
-void nsStyleBackground::FinishStyle(nsPresContext* aPresContext,
+void nsStyleBackground::FinishStyle(Document& aDocument,
                                     const nsStyleBackground* aOldStyle) {
   MOZ_ASSERT(NS_IsMainThread());
-
-  mImage.ResolveImages(aPresContext, aOldStyle ? &aOldStyle->mImage : nullptr);
+  mImage.ResolveImages(aDocument, aOldStyle ? &aOldStyle->mImage : nullptr);
 }
 
 nsChangeHint nsStyleBackground::CalcDifference(
     const nsStyleBackground& aNewData) const {
   nsChangeHint hint = nsChangeHint(0);
   if (mBackgroundColor != aNewData.mBackgroundColor) {
     hint |= nsChangeHint_RepaintFrame;
   }
@@ -3129,21 +3127,21 @@ nsStyleDisplay::~nsStyleDisplay() {
                                 mSpecifiedTranslate);
   ReleaseSharedListOnMainThread("nsStyleDisplay::mSpecifiedScale",
                                 mSpecifiedScale);
   ReleaseSharedListOnMainThread("nsStyleDisplay::mIndividualTransform",
                                 mIndividualTransform);
   MOZ_COUNT_DTOR(nsStyleDisplay);
 }
 
-void nsStyleDisplay::FinishStyle(nsPresContext* aPresContext,
+void nsStyleDisplay::FinishStyle(Document& aDocument,
                                  const nsStyleDisplay* aOldStyle) {
   MOZ_ASSERT(NS_IsMainThread());
 
-  mShapeOutside.FinishStyle(aPresContext,
+  mShapeOutside.FinishStyle(aDocument,
                             aOldStyle ? &aOldStyle->mShapeOutside : nullptr);
   GenerateCombinedIndividualTransform();
 }
 
 static inline bool TransformListChanged(
     const RefPtr<nsCSSValueSharedList>& aList,
     const RefPtr<nsCSSValueSharedList>& aNewList) {
   return !aList != !aNewList || (aList && *aList != *aNewList);
@@ -3629,48 +3627,48 @@ bool nsStyleContentData::operator==(cons
   }
   if (mType == StyleContentType::String) {
     return NS_strcmp(mContent.mString, aOther.mContent.mString) == 0;
   }
   MOZ_ASSERT(!mContent.mString && !aOther.mContent.mString);
   return true;
 }
 
-void nsStyleContentData::Resolve(nsPresContext* aPresContext,
+void nsStyleContentData::Resolve(Document& aDocument,
                                  const nsStyleContentData* aOldStyle) {
   if (mType != StyleContentType::Image) {
     return;
   }
   if (!mContent.mImage->IsResolved()) {
     const nsStyleImageRequest* oldRequest =
         (aOldStyle && aOldStyle->mType == StyleContentType::Image)
             ? aOldStyle->mContent.mImage
             : nullptr;
-    mContent.mImage->Resolve(aPresContext, oldRequest);
+    mContent.mImage->Resolve(aDocument, oldRequest);
   }
 }
 
 //-----------------------
 // nsStyleContent
 //
 
 nsStyleContent::nsStyleContent(const Document& aDocument) {
   MOZ_COUNT_CTOR(nsStyleContent);
 }
 
 nsStyleContent::~nsStyleContent() { MOZ_COUNT_DTOR(nsStyleContent); }
 
-void nsStyleContent::FinishStyle(nsPresContext* aPresContext,
+void nsStyleContent::FinishStyle(Document& aDocument,
                                  const nsStyleContent* aOldStyle) {
   for (size_t i = 0; i < mContents.Length(); ++i) {
     const nsStyleContentData* oldData =
         (aOldStyle && aOldStyle->mContents.Length() > i)
             ? &aOldStyle->mContents[i]
             : nullptr;
-    mContents[i].Resolve(aPresContext, oldData);
+    mContents[i].Resolve(aDocument, oldData);
   }
 }
 
 nsStyleContent::nsStyleContent(const nsStyleContent& aSource)
     : mContents(aSource.mContents),
       mIncrements(aSource.mIncrements),
       mResets(aSource.mResets) {
   MOZ_COUNT_CTOR(nsStyleContent);
@@ -3987,29 +3985,28 @@ nsStyleUI::nsStyleUI(const nsStyleUI& aS
       mCaretColor(aSource.mCaretColor),
       mScrollbarFaceColor(aSource.mScrollbarFaceColor),
       mScrollbarTrackColor(aSource.mScrollbarTrackColor) {
   MOZ_COUNT_CTOR(nsStyleUI);
 }
 
 nsStyleUI::~nsStyleUI() { MOZ_COUNT_DTOR(nsStyleUI); }
 
-void nsStyleUI::FinishStyle(nsPresContext* aPresContext,
-                            const nsStyleUI* aOldStyle) {
+void nsStyleUI::FinishStyle(Document& aDocument, const nsStyleUI* aOldStyle) {
   MOZ_ASSERT(NS_IsMainThread());
 
   for (size_t i = 0; i < mCursorImages.Length(); ++i) {
     nsCursorImage& cursor = mCursorImages[i];
 
     if (cursor.mImage && !cursor.mImage->IsResolved()) {
       const nsCursorImage* oldCursor =
           (aOldStyle && aOldStyle->mCursorImages.Length() > i)
               ? &aOldStyle->mCursorImages[i]
               : nullptr;
-      cursor.mImage->Resolve(aPresContext,
+      cursor.mImage->Resolve(aDocument,
                              oldCursor ? oldCursor->mImage.get() : nullptr);
     }
   }
 }
 
 nsChangeHint nsStyleUI::CalcDifference(const nsStyleUI& aNewData) const {
   nsChangeHint hint = nsChangeHint(0);
   if (mCursor != aNewData.mCursor) {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -83,17 +83,17 @@ struct Position {
 };
 
 }  // namespace mozilla
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
   nsStyleFont(const nsStyleFont& aStyleFont);
   explicit nsStyleFont(const mozilla::dom::Document&);
   ~nsStyleFont() { MOZ_COUNT_DTOR(nsStyleFont); }
-  void FinishStyle(nsPresContext*, const nsStyleFont*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleFont*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleFont& aNewData) const;
 
   /**
    * Return aSize multiplied by the current text zoom factor (in aPresContext).
    * aSize is allowed to be negative, but the caller is expected to deal with
    * negative results.  The result is clamped to nscoord_MIN .. nscoord_MAX.
@@ -237,17 +237,18 @@ class nsStyleImageRequest {
     // This is currently used only for cursor images.
     Discard = 0x2,
   };
 
   // Can be called from any thread, but Resolve() must be called later
   // on the main thread before get() can be used.
   nsStyleImageRequest(Mode aModeFlags, mozilla::css::URLValue* aImageValue);
 
-  bool Resolve(nsPresContext*, const nsStyleImageRequest* aOldImageRequest);
+  bool Resolve(mozilla::dom::Document&,
+               const nsStyleImageRequest* aOldImageRequest);
   bool IsResolved() const { return mResolved; }
 
   imgRequestProxy* get() {
     MOZ_ASSERT(IsResolved(), "Resolve() must be called first");
     MOZ_ASSERT(NS_IsMainThread());
     return mRequestProxy.get();
   }
   const imgRequestProxy* get() const {
@@ -329,24 +330,25 @@ struct nsStyleImage {
 
   void SetNull();
   void SetImageRequest(already_AddRefed<nsStyleImageRequest> aImage);
   void SetGradientData(nsStyleGradient* aGradient);
   void SetElementId(already_AddRefed<nsAtom> aElementId);
   void SetCropRect(mozilla::UniquePtr<nsStyleSides> aCropRect);
   void SetURLValue(already_AddRefed<const URLValue> aURLValue);
 
-  void ResolveImage(nsPresContext* aContext, const nsStyleImage* aOldImage) {
+  void ResolveImage(mozilla::dom::Document& aDocument,
+                    const nsStyleImage* aOldImage) {
     MOZ_ASSERT(mType != eStyleImageType_Image || mImage);
     if (mType == eStyleImageType_Image && !mImage->IsResolved()) {
       const nsStyleImageRequest* oldRequest =
           (aOldImage && aOldImage->GetType() == eStyleImageType_Image)
               ? aOldImage->ImageRequest()
               : nullptr;
-      mImage->Resolve(aContext, oldRequest);
+      mImage->Resolve(aDocument, oldRequest);
     }
   }
 
   nsStyleImageType GetType() const { return mType; }
   nsStyleImageRequest* ImageRequest() const {
     MOZ_ASSERT(mType == eStyleImageType_Image, "Data is not an image!");
     MOZ_ASSERT(mImage);
     return mImage;
@@ -464,17 +466,17 @@ struct nsStyleImage {
   // This is _currently_ used only in conjunction with eStyleImageType_Image.
   mozilla::UniquePtr<nsStyleSides> mCropRect;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor {
   explicit nsStyleColor(const mozilla::dom::Document&);
   nsStyleColor(const nsStyleColor& aOther);
   ~nsStyleColor() { MOZ_COUNT_DTOR(nsStyleColor); }
-  void FinishStyle(nsPresContext*, const nsStyleColor*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleColor*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleColor& aNewData) const;
 
   // Don't add ANY members to this struct!  We can achieve caching in the rule
   // tree (rather than the style tree) by letting color stay by itself! -dwh
   nscolor mColor;
 };
@@ -630,18 +632,19 @@ struct nsStyleImageLayers {
     // This constructor does not initialize mRepeat or mOrigin and Initialize()
     // must be called to do that.
     Layer();
     ~Layer();
 
     // Initialize mRepeat and mOrigin by specified layer type
     void Initialize(LayerType aType);
 
-    void ResolveImage(nsPresContext* aContext, const Layer* aOldLayer) {
-      mImage.ResolveImage(aContext, aOldLayer ? &aOldLayer->mImage : nullptr);
+    void ResolveImage(mozilla::dom::Document& aDocument,
+                      const Layer* aOldLayer) {
+      mImage.ResolveImage(aDocument, aOldLayer ? &aOldLayer->mImage : nullptr);
     }
 
     // True if the rendering of this layer might change when the size
     // of the background positioning area changes.  This is true for any
     // non-solid-color background whose position or size depends on
     // the size of the positioning area.  It's also true for SVG images
     // whose root <svg> node has a viewBox.
     bool RenderingMightDependOnPositioningAreaSizeChange() const;
@@ -678,23 +681,23 @@ struct nsStyleImageLayers {
   // background-clip applies to the background-color) may not be last
   // layer.  In layers below the bottom layer, properties will be
   // uninitialized unless their count, above, indicates that they are
   // present.
   nsStyleAutoArray<Layer> mLayers;
 
   const Layer& BottomLayer() const { return mLayers[mImageCount - 1]; }
 
-  void ResolveImages(nsPresContext* aContext,
+  void ResolveImages(mozilla::dom::Document& aDocument,
                      const nsStyleImageLayers* aOldLayers) {
     for (uint32_t i = 0; i < mImageCount; ++i) {
       const Layer* oldLayer = (aOldLayers && aOldLayers->mLayers.Length() > i)
                                   ? &aOldLayers->mLayers[i]
                                   : nullptr;
-      mLayers[i].ResolveImage(aContext, oldLayer);
+      mLayers[i].ResolveImage(aDocument, oldLayer);
     }
   }
 
   // Fill unspecified layers by cycling through their values
   // till they all are of length aMaxItemCount
   void FillAllLayers(uint32_t aMaxItemCount);
 
   nsChangeHint CalcDifference(const nsStyleImageLayers& aNewLayers,
@@ -723,17 +726,17 @@ struct nsStyleImageLayers {
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
   explicit nsStyleBackground(const mozilla::dom::Document&);
   nsStyleBackground(const nsStyleBackground& aOther);
   ~nsStyleBackground();
 
   // Resolves and tracks the images in mImage.  Only called with a Servo-backed
   // style system, where those images must be resolved later than the OMT
   // nsStyleBackground constructor call.
-  void FinishStyle(nsPresContext*, const nsStyleBackground*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleBackground*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleBackground& aNewData) const;
 
   // Return the background color as nscolor.
   nscolor BackgroundColor(const nsIFrame* aFrame) const;
   nscolor BackgroundColor(mozilla::ComputedStyle* aStyle) const;
 
@@ -758,17 +761,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   nsStyleImageLayers mImage;
   mozilla::StyleComplexColor mBackgroundColor;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin {
   explicit nsStyleMargin(const mozilla::dom::Document&);
   nsStyleMargin(const nsStyleMargin& aMargin);
   ~nsStyleMargin() { MOZ_COUNT_DTOR(nsStyleMargin); }
-  void FinishStyle(nsPresContext*, const nsStyleMargin*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleMargin*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleMargin& aNewData) const;
 
   bool GetMargin(nsMargin& aMargin) const {
     if (!mMargin.ConvertsToLength()) {
       return false;
     }
@@ -784,17 +787,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   nsStyleSides mMargin;  // coord, percent, calc, auto
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding {
   explicit nsStylePadding(const mozilla::dom::Document&);
   nsStylePadding(const nsStylePadding& aPadding);
   ~nsStylePadding() { MOZ_COUNT_DTOR(nsStylePadding); }
-  void FinishStyle(nsPresContext*, const nsStylePadding*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStylePadding*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStylePadding& aNewData) const;
 
   nsStyleSides mPadding;  // coord, percent, calc
 
   bool IsWidthDependent() const { return !mPadding.ConvertsToLength(); }
 
@@ -929,17 +932,17 @@ static bool IsVisibleBorderStyle(mozilla
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder {
   explicit nsStyleBorder(const mozilla::dom::Document&);
   nsStyleBorder(const nsStyleBorder& aBorder);
   ~nsStyleBorder();
 
   // Resolves and tracks mBorderImageSource.  Only called with a Servo-backed
   // style system, where those images must be resolved later than the OMT
   // nsStyleBorder constructor call.
-  void FinishStyle(nsPresContext*, const nsStyleBorder*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleBorder*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleBorder& aNewData) const;
 
   // Return whether aStyle is a visible style.  Invisible styles cause
   // the relevant computed border width to be 0.
   // Note that this does *not* consider the effects of 'border-image':
   // if border-style is none, but there is a loaded border image,
@@ -1098,17 +1101,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   nsStyleBorder& operator=(const nsStyleBorder& aOther) = delete;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline {
   explicit nsStyleOutline(const mozilla::dom::Document&);
   nsStyleOutline(const nsStyleOutline& aOutline);
   ~nsStyleOutline() { MOZ_COUNT_DTOR(nsStyleOutline); }
-  void FinishStyle(nsPresContext*, const nsStyleOutline*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleOutline*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleOutline& aNewData) const;
 
   nsStyleCorners mOutlineRadius;  // coord, percent, calc
 
   // This is the specified value of outline-width, but with length values
   // computed to absolute.  mActualOutlineWidth stores the outline-width
@@ -1143,17 +1146,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   nscoord mTwipsPerPixel;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList {
   explicit nsStyleList(const mozilla::dom::Document&);
   nsStyleList(const nsStyleList& aStyleList);
   ~nsStyleList();
 
-  void FinishStyle(nsPresContext*, const nsStyleList*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleList*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleList& aNewData,
                               const nsStyleDisplay* aOldDisplay) const;
 
   imgRequestProxy* GetListStyleImage() const {
     return mListStyleImage ? mListStyleImage->get() : nullptr;
   }
@@ -1286,17 +1289,17 @@ struct nsStyleGridTemplate {
     return int32_t(aIndex) == mRepeatAutoIndex;
   }
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition {
   explicit nsStylePosition(const mozilla::dom::Document&);
   nsStylePosition(const nsStylePosition& aOther);
   ~nsStylePosition();
-  void FinishStyle(nsPresContext*, const nsStylePosition*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStylePosition*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(
       const nsStylePosition& aNewData,
       const nsStyleVisibility* aOldStyleVisibility) const;
 
   /**
    * Return the used value for 'align-self' given our parent ComputedStyle
@@ -1461,17 +1464,17 @@ struct nsStyleTextOverflow {
   nsStyleTextOverflowSide mRight;  // end side when mLogicalDirections is true
   bool mLogicalDirections;         // true when only one value was specified
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset {
   explicit nsStyleTextReset(const mozilla::dom::Document&);
   nsStyleTextReset(const nsStyleTextReset& aOther);
   ~nsStyleTextReset();
-  void FinishStyle(nsPresContext*, const nsStyleTextReset*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleTextReset*) {}
   const static bool kHasFinishStyle = false;
 
   // Note the difference between this and
   // ComputedStyle::HasTextDecorationLines.
   bool HasTextDecorationLines() const {
     return mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_NONE &&
            mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
   }
@@ -1487,17 +1490,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   float mInitialLetterSize;      // 0.0f means normal
   mozilla::StyleComplexColor mTextDecorationColor;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText {
   explicit nsStyleText(const mozilla::dom::Document&);
   nsStyleText(const nsStyleText& aOther);
   ~nsStyleText();
-  void FinishStyle(nsPresContext*, const nsStyleText*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleText*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleText& aNewData) const;
 
   uint8_t mTextAlign;      // NS_STYLE_TEXT_ALIGN_*
   uint8_t mTextAlignLast;  // NS_STYLE_TEXT_ALIGN_*
   mozilla::StyleTextJustify mTextJustify;
   uint8_t mTextTransform;  // NS_STYLE_TEXT_TRANSFORM_*
@@ -1585,17 +1588,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   mozilla::LogicalSide TextEmphasisSide(mozilla::WritingMode aWM) const;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
   explicit nsStyleVisibility(const mozilla::dom::Document&);
   nsStyleVisibility(const nsStyleVisibility& aVisibility);
   ~nsStyleVisibility() { MOZ_COUNT_DTOR(nsStyleVisibility); }
-  void FinishStyle(nsPresContext*, const nsStyleVisibility*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleVisibility*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
 
   mozilla::StyleImageOrientation mImageOrientation;
   uint8_t mDirection;        // NS_STYLE_DIRECTION_*
   uint8_t mVisible;          // NS_STYLE_VISIBILITY_VISIBLE_*
   uint8_t mImageRendering;   // NS_STYLE_IMAGE_RENDERING_*
@@ -1821,17 +1824,18 @@ struct StyleShapeSource final {
 
   const StyleSVGPath& Path() const {
     MOZ_ASSERT(mType == StyleShapeSourceType::Path, "Wrong shape source type!");
     MOZ_ASSERT(mSVGPath);
     return *mSVGPath;
   }
   void SetPath(UniquePtr<StyleSVGPath> aPath);
 
-  void FinishStyle(nsPresContext*, const StyleShapeSource* aOldShapeSource);
+  void FinishStyle(mozilla::dom::Document&,
+                   const StyleShapeSource* aOldShapeSource);
 
  private:
   void* operator new(size_t) = delete;
 
   void DoCopy(const StyleShapeSource& aOther);
   void DoDestroy();
 
   union {
@@ -1869,17 +1873,17 @@ struct StyleMotion final {
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
   typedef mozilla::StyleGeometryBox StyleGeometryBox;
 
   explicit nsStyleDisplay(const mozilla::dom::Document&);
   nsStyleDisplay(const nsStyleDisplay& aOther);
   ~nsStyleDisplay();
 
-  void FinishStyle(nsPresContext*, const nsStyleDisplay*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleDisplay*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleDisplay& aNewData) const;
 
   bool TransformChanged(const nsStyleDisplay& aNewData) const;
 
   // We guarantee that if mBinding is non-null, so are mBinding->GetURI() and
   // mBinding->mOriginPrincipal.
@@ -2307,30 +2311,30 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   // for them (since transform must be tested separately for each).
   void GenerateCombinedIndividualTransform();
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable {
   explicit nsStyleTable(const mozilla::dom::Document&);
   nsStyleTable(const nsStyleTable& aOther);
   ~nsStyleTable();
-  void FinishStyle(nsPresContext*, const nsStyleTable*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleTable*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleTable& aNewData) const;
 
   uint8_t mLayoutStrategy;  // NS_STYLE_TABLE_LAYOUT_*
   int32_t mSpan;  // -x-span; the number of columns spanned by a colgroup or col
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder {
   explicit nsStyleTableBorder(const mozilla::dom::Document&);
   nsStyleTableBorder(const nsStyleTableBorder& aOther);
   ~nsStyleTableBorder();
-  void FinishStyle(nsPresContext*, const nsStyleTableBorder*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleTableBorder*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleTableBorder& aNewData) const;
 
   nscoord mBorderSpacingCol;
   nscoord mBorderSpacingRow;
   uint8_t mBorderCollapse;
   uint8_t mCaptionSide;
@@ -2422,17 +2426,17 @@ class nsStyleContentData {
   void SetImageRequest(already_AddRefed<nsStyleImageRequest> aRequest) {
     MOZ_ASSERT(mType == StyleContentType::Uninitialized,
                "should only initialize nsStyleContentData once");
     mType = StyleContentType::Image;
     mContent.mImage = aRequest.take();
     MOZ_ASSERT(mContent.mImage);
   }
 
-  void Resolve(nsPresContext*, const nsStyleContentData*);
+  void Resolve(mozilla::dom::Document&, const nsStyleContentData*);
 
  private:
   StyleContentType mType;
   union {
     char16_t* mString;
     nsStyleContentAttr* mAttr;
     nsStyleImageRequest* mImage;
     CounterFunction* mCounters;
@@ -2451,17 +2455,17 @@ struct nsStyleCounterData {
     return !(*this == aOther);
   }
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent {
   explicit nsStyleContent(const mozilla::dom::Document&);
   nsStyleContent(const nsStyleContent& aContent);
   ~nsStyleContent();
-  void FinishStyle(nsPresContext*, const nsStyleContent*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleContent*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleContent& aNewData) const;
 
   uint32_t ContentCount() const { return mContents.Length(); }
 
   const nsStyleContentData& ContentAt(uint32_t aIndex) const {
     return mContents[aIndex];
@@ -2516,17 +2520,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   nsTArray<nsStyleCounterData> mIncrements;
   nsTArray<nsStyleCounterData> mResets;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset {
   explicit nsStyleUIReset(const mozilla::dom::Document&);
   nsStyleUIReset(const nsStyleUIReset& aOther);
   ~nsStyleUIReset();
-  void FinishStyle(nsPresContext*, const nsStyleUIReset*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleUIReset*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const;
 
   mozilla::StyleUserSelect mUserSelect;  // [reset](selection-style)
   mozilla::StyleScrollbarWidth mScrollbarWidth;
   uint8_t mForceBrokenImageIcon;  // (0 if not forcing, otherwise forcing)
   uint8_t mIMEMode;
@@ -2555,17 +2559,17 @@ struct nsCursorImage {
   imgRequestProxy* GetImage() const { return mImage->get(); }
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUI {
   explicit nsStyleUI(const mozilla::dom::Document&);
   nsStyleUI(const nsStyleUI& aOther);
   ~nsStyleUI();
 
-  void FinishStyle(nsPresContext*, const nsStyleUI*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleUI*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleUI& aNewData) const;
 
   mozilla::StyleUserInput mUserInput;
   mozilla::StyleUserModify mUserModify;  // (modify-content)
   mozilla::StyleUserFocus mUserFocus;    // (auto-select)
   uint8_t mPointerEvents;                // NS_STYLE_POINTER_EVENTS_*
@@ -2583,17 +2587,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     return !mScrollbarFaceColor.IsAuto() || !mScrollbarTrackColor.IsAuto();
   }
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL {
   explicit nsStyleXUL(const mozilla::dom::Document&);
   nsStyleXUL(const nsStyleXUL& aSource);
   ~nsStyleXUL();
-  void FinishStyle(nsPresContext*, const nsStyleXUL*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleXUL*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleXUL& aNewData) const;
 
   float mBoxFlex;
   uint32_t mBoxOrdinal;
   mozilla::StyleBoxAlign mBoxAlign;
   mozilla::StyleBoxDirection mBoxDirection;
@@ -2601,17 +2605,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   mozilla::StyleBoxPack mBoxPack;
   mozilla::StyleStackSizing mStackSizing;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn {
   explicit nsStyleColumn(const mozilla::dom::Document&);
   nsStyleColumn(const nsStyleColumn& aSource);
   ~nsStyleColumn();
-  void FinishStyle(nsPresContext*, const nsStyleColumn*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleColumn*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleColumn& aNewData) const;
 
   // This is the maximum number of columns we can process. It's used in
   // nsColumnSetFrame.
   static const uint32_t kMaxColumnCount = 1000;
 
@@ -2729,17 +2733,17 @@ class nsStyleSVGPaint {
   nsStyleSVGFallbackType mFallbackType;
   mozilla::StyleComplexColor mFallbackColor;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG {
   explicit nsStyleSVG(const mozilla::dom::Document&);
   nsStyleSVG(const nsStyleSVG& aSource);
   ~nsStyleSVG();
-  void FinishStyle(nsPresContext*, const nsStyleSVG*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleSVG*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleSVG& aNewData) const;
 
   nsStyleSVGPaint mFill;
   nsStyleSVGPaint mStroke;
   RefPtr<mozilla::css::URLValue> mMarkerEnd;
   RefPtr<mozilla::css::URLValue> mMarkerMid;
@@ -2828,17 +2832,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   uint8_t mContextFlags;
 };
 
 struct nsStyleFilter {
   nsStyleFilter();
   nsStyleFilter(const nsStyleFilter& aSource);
   ~nsStyleFilter();
-  void FinishStyle(nsPresContext*, const nsStyleFilter*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleFilter*) {}
   const static bool kHasFinishStyle = false;
 
   nsStyleFilter& operator=(const nsStyleFilter& aOther);
 
   bool operator==(const nsStyleFilter& aOther) const;
   bool operator!=(const nsStyleFilter& aOther) const {
     return !(*this == aOther);
   }
@@ -2886,17 +2890,17 @@ struct nsTArray_CopyChooser<nsStyleFilte
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset {
   explicit nsStyleSVGReset(const mozilla::dom::Document&);
   nsStyleSVGReset(const nsStyleSVGReset& aSource);
   ~nsStyleSVGReset();
 
   // Resolves and tracks the images in mMask.  Only called with a Servo-backed
   // style system, where those images must be resolved later than the OMT
   // nsStyleSVGReset constructor call.
-  void FinishStyle(nsPresContext*, const nsStyleSVGReset*);
+  void FinishStyle(mozilla::dom::Document&, const nsStyleSVGReset*);
   const static bool kHasFinishStyle = true;
 
   nsChangeHint CalcDifference(const nsStyleSVGReset& aNewData) const;
 
   bool HasClipPath() const {
     return mClipPath.GetType() != mozilla::StyleShapeSourceType::None;
   }
 
@@ -2919,17 +2923,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   uint8_t mVectorEffect;      // NS_STYLE_VECTOR_EFFECT_*
   uint8_t mMaskType;          // NS_STYLE_MASK_TYPE_*
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects {
   explicit nsStyleEffects(const mozilla::dom::Document&);
   nsStyleEffects(const nsStyleEffects& aSource);
   ~nsStyleEffects();
-  void FinishStyle(nsPresContext*, const nsStyleEffects*) {}
+  void FinishStyle(mozilla::dom::Document&, const nsStyleEffects*) {}
   const static bool kHasFinishStyle = false;
 
   nsChangeHint CalcDifference(const nsStyleEffects& aNewData) const;
 
   bool HasFilters() const { return !mFilters.IsEmpty(); }
 
   nsTArray<nsStyleFilter> mFilters;
   RefPtr<nsCSSShadowArray> mBoxShadow;  // nullptr for 'none'
--- a/layout/svg/SVGObserverUtils.cpp
+++ b/layout/svg/SVGObserverUtils.cpp
@@ -754,17 +754,17 @@ void SVGMaskObserverList::ResolveImage(u
   const nsStyleSVGReset* svgReset = mFrame->StyleSVGReset();
   MOZ_ASSERT(aIndex < svgReset->mMask.mImageCount);
 
   nsStyleImage& image =
       const_cast<nsStyleImage&>(svgReset->mMask.mLayers[aIndex].mImage);
 
   if (!image.IsResolved()) {
     MOZ_ASSERT(image.GetType() == nsStyleImageType::eStyleImageType_Image);
-    image.ResolveImage(mFrame->PresContext(), nullptr);
+    image.ResolveImage(*mFrame->PresContext()->Document(), nullptr);
 
     mozilla::css::ImageLoader* imageLoader =
         mFrame->PresContext()->Document()->StyleImageLoader();
     if (imgRequestProxy* req = image.GetImageData()) {
       imageLoader->AssociateRequestToFrame(req, mFrame, 0);
     }
   }
 }