Bug 1343964 part 1 - Move URLExtraData into its own header. r=heycam
authorXidorn Quan <me@upsuper.org>
Tue, 04 Apr 2017 10:04:13 +1000
changeset 558299 79fb83faeb2a41ac3d301b29c5fffb9bead7284c
parent 558298 de49ea68b980a62c8add6f3a036279e516305873
child 558300 7ee162581b5cbbc59aab4282ac0d6fc42a478126
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersheycam
bugs1343964
milestone55.0a1
Bug 1343964 part 1 - Move URLExtraData into its own header. r=heycam This patch does the following in addition to a simple move: * change the type of the pointers from RefPtr to nsCOMPtr * move it from mozilla::css namespace to mozilla MozReview-Commit-ID: 72MYq6kWm4s
dom/animation/KeyframeUtils.cpp
dom/animation/TimingParams.cpp
dom/base/nsAttrValue.cpp
dom/svg/nsSVGElement.cpp
layout/style/ServoBindingTypes.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoDeclarationBlock.cpp
layout/style/ServoDeclarationBlock.h
layout/style/ServoStyleSheet.cpp
layout/style/URLExtraData.cpp
layout/style/URLExtraData.h
layout/style/moz.build
layout/style/nsCSSValue.cpp
layout/style/nsCSSValue.h
layout/style/nsDOMCSSDeclaration.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -1014,20 +1014,19 @@ MakePropertyValuePair(nsCSSPropertyID aP
   result.mProperty = aProperty;
 
   if (aDocument->GetStyleBackendType() == StyleBackendType::Servo) {
     nsCString name = nsCSSProps::GetStringValue(aProperty);
 
     NS_ConvertUTF16toUTF8 value(aStringValue);
 
     // FIXME this is using the wrong base uri (bug 1343919)
-    RefPtr<css::URLExtraData> data =
-      new css::URLExtraData(aDocument->GetDocumentURI(),
-                            aDocument->GetDocumentURI(),
-                            aDocument->NodePrincipal());
+    RefPtr<URLExtraData> data = new URLExtraData(aDocument->GetDocumentURI(),
+                                                 aDocument->GetDocumentURI(),
+                                                 aDocument->NodePrincipal());
 
     RefPtr<RawServoDeclarationBlock> servoDeclarationBlock =
       Servo_ParseProperty(&name, &value, data).Consume();
 
     if (servoDeclarationBlock) {
       result.mServoDeclarationBlock = servoDeclarationBlock.forget();
     }
     return result;
--- a/dom/animation/TimingParams.cpp
+++ b/dom/animation/TimingParams.cpp
@@ -112,20 +112,19 @@ TimingParams::ParseEasing(const nsAStrin
                           nsIDocument* aDocument,
                           ErrorResult& aRv)
 {
   MOZ_ASSERT(aDocument);
 
   if (aDocument->IsStyledByServo()) {
     nsTimingFunction timingFunction;
     // FIXME this is using the wrong base uri (bug 1343919)
-    RefPtr<css::URLExtraData> data =
-      new css::URLExtraData(aDocument->GetDocumentURI(),
-                            aDocument->GetDocumentURI(),
-                            aDocument->NodePrincipal());
+    RefPtr<URLExtraData> data = new URLExtraData(aDocument->GetDocumentURI(),
+                                                 aDocument->GetDocumentURI(),
+                                                 aDocument->NodePrincipal());
     if (!Servo_ParseEasing(&aEasing, data, &timingFunction)) {
       aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
       return Nothing();
     }
 
     if (timingFunction.mType == nsTimingFunction::Type::Linear) {
       return Nothing();
     }
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -1720,18 +1720,18 @@ nsAttrValue::ParseStyleAttribute(const n
       NS_ADDREF(cont);
       SetPtrValueAndType(cont, eOtherBase);
       return true;
     }
   }
 
   RefPtr<DeclarationBlock> decl;
   if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) {
-    RefPtr<css::URLExtraData> data =
-      new css::URLExtraData(baseURI, docURI, aElement->NodePrincipal());
+    RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
+                                                 aElement->NodePrincipal());
     decl = ServoDeclarationBlock::FromCssText(aString, data);
   } else {
     css::Loader* cssLoader = ownerDoc->CSSLoader();
     nsCSSParser cssParser(cssLoader);
     decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
                                          aElement->NodePrincipal());
   }
   if (!decl) {
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -1229,18 +1229,18 @@ MappedAttrParser::ParseMappedAttrValue(n
   if (propertyID != eCSSProperty_UNKNOWN) {
     bool changed = false; // outparam for ParseProperty.
     if (mBackend == StyleBackendType::Gecko) {
       mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
                             mElement->NodePrincipal(), mDecl->AsGecko(), &changed, false, true);
     } else {
       NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
       // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
-      RefPtr<css::URLExtraData> data =
-        new css::URLExtraData(mBaseURI, mDocURI, mElement->NodePrincipal());
+      RefPtr<URLExtraData> data = new URLExtraData(mBaseURI, mDocURI,
+                                                   mElement->NodePrincipal());
       // FIXME (bug 1342559): Set SVG parsing mode for lengths
       changed = Servo_DeclarationBlock_SetPropertyById(mDecl->AsServo()->Raw(), propertyID,
                                                        &value, false, data);
     }
 
     if (changed) {
       // The normal reporting of use counters by the nsCSSParser won't happen
       // since it doesn't have a sheet.
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -15,21 +15,19 @@
 
 struct RawServoStyleSet;
 
 #define SERVO_ARC_TYPE(name_, type_) struct type_;
 #include "mozilla/ServoArcTypeList.h"
 #undef SERVO_ARC_TYPE
 
 namespace mozilla {
-  class ServoElementSnapshot;
-  struct StyleAnimation;
-namespace css {
+class ServoElementSnapshot;
+struct StyleAnimation;
 struct URLExtraData;
-} // namespace css
 namespace dom {
 class Element;
 class StyleChildrenIterator;
 } // namespace dom
 struct AnimationPropertySegment;
 struct ComputedTiming;
 struct Keyframe;
 struct PropertyStyleAnimationValuePair;
@@ -45,17 +43,17 @@ struct nsTimingFunction;
 
 using mozilla::dom::StyleChildrenIterator;
 using mozilla::ServoElementSnapshot;
 
 typedef nsINode RawGeckoNode;
 typedef mozilla::dom::Element RawGeckoElement;
 typedef nsIDocument RawGeckoDocument;
 typedef nsPresContext RawGeckoPresContext;
-typedef mozilla::css::URLExtraData RawGeckoURLExtraData;
+typedef mozilla::URLExtraData RawGeckoURLExtraData;
 typedef nsTArray<mozilla::Keyframe> RawGeckoKeyframeList;
 typedef nsTArray<mozilla::ComputedKeyframeValues> RawGeckoComputedKeyframeValuesList;
 typedef nsTArray<mozilla::PropertyStyleAnimationValuePair> RawGeckoAnimationValueList;
 typedef nsStyleAutoArray<mozilla::StyleAnimation> RawGeckoStyleAnimationList;
 typedef nsTArray<nsFontFaceRuleContainer> RawGeckoFontFaceRuleList;
 typedef mozilla::AnimationPropertySegment RawGeckoAnimationPropertySegment;
 typedef mozilla::ComputedTiming RawGeckoComputedTiming;
 
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1348,17 +1348,17 @@ css::URLValue*
 Gecko_NewURLValue(ServoBundledURI aURI)
 {
   RefPtr<css::URLValue> url = aURI.IntoCssUrl();
   return url.forget().take();
 }
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(css::URLValue, CSSURLValue);
 
-NS_IMPL_THREADSAFE_FFI_REFCOUNTING(css::URLExtraData, URLExtraData);
+NS_IMPL_THREADSAFE_FFI_REFCOUNTING(URLExtraData, URLExtraData);
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
 nsCSSShadowArray*
 Gecko_NewCSSShadowArray(uint32_t aLen)
 {
   RefPtr<nsCSSShadowArray> arr = new(aLen) nsCSSShadowArray(aLen);
   return arr.forget().take();
@@ -1625,19 +1625,19 @@ Gecko_LoadStyleSheet(css::Loader* aLoade
   }
 
   aLoader->LoadChildSheet(aParent, uri, media, nullptr, aChildSheet, nullptr);
 }
 
 RawGeckoURLExtraData*
 Gecko_URLExtraData_CreateDummy()
 {
-  RefPtr<css::URLExtraData> data =
-    new css::URLExtraData(NullPrincipalURI::Create(), nullptr,
-                          NullPrincipal::Create());
+  RefPtr<URLExtraData> data = new URLExtraData(NullPrincipalURI::Create(),
+                                               nullptr,
+                                               NullPrincipal::Create());
   return data.forget().take();
 }
 
 const nsMediaFeature*
 Gecko_GetMediaFeatures()
 {
   return nsMediaFeatures::features;
 }
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -84,17 +84,17 @@ DEFINE_ARRAY_TYPE_FOR(uintptr_t);
 extern "C" {
 
 class ServoBundledURI
 {
 public:
   already_AddRefed<mozilla::css::URLValue> IntoCssUrl();
   const uint8_t* mURLString;
   uint32_t mURLStringLength;
-  mozilla::css::URLExtraData* mExtraData;
+  mozilla::URLExtraData* mExtraData;
 };
 
 // DOM Traversal.
 uint32_t Gecko_ChildrenCount(RawGeckoNodeBorrowed node);
 bool Gecko_NodeIsElement(RawGeckoNodeBorrowed node);
 bool Gecko_IsInDocument(RawGeckoNodeBorrowed node);
 bool Gecko_FlattenedTreeParentIsParent(RawGeckoNodeBorrowed node);
 bool Gecko_IsSignificantChild(RawGeckoNodeBorrowed node,
--- a/layout/style/ServoDeclarationBlock.cpp
+++ b/layout/style/ServoDeclarationBlock.cpp
@@ -8,17 +8,17 @@
 #include "mozilla/ServoBindings.h"
 
 #include "nsCSSProps.h"
 
 namespace mozilla {
 
 /* static */ already_AddRefed<ServoDeclarationBlock>
 ServoDeclarationBlock::FromCssText(const nsAString& aCssText,
-                                   css::URLExtraData* aExtraData)
+                                   URLExtraData* aExtraData)
 {
   NS_ConvertUTF16toUTF8 value(aCssText);
   // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
   RefPtr<RawServoDeclarationBlock>
     raw = Servo_ParseStyleAttribute(&value, aExtraData).Consume();
   RefPtr<ServoDeclarationBlock> decl = new ServoDeclarationBlock(raw.forget());
   return decl.forget();
 }
--- a/layout/style/ServoDeclarationBlock.h
+++ b/layout/style/ServoDeclarationBlock.h
@@ -23,17 +23,17 @@ public:
 
   ServoDeclarationBlock(const ServoDeclarationBlock& aCopy)
     : DeclarationBlock(aCopy)
     , mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume()) {}
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServoDeclarationBlock)
 
   static already_AddRefed<ServoDeclarationBlock>
-  FromCssText(const nsAString& aCssText, css::URLExtraData* aExtraData);
+  FromCssText(const nsAString& aCssText, URLExtraData* aExtraData);
 
   RawServoDeclarationBlock* Raw() const { return mRaw; }
   RawServoDeclarationBlock* const* RefRaw() const {
     static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
                   sizeof(RawServoDeclarationBlock*),
                   "RefPtr should just be a pointer");
     return reinterpret_cast<RawServoDeclarationBlock* const*>(&mRaw);
   }
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -82,18 +82,18 @@ ServoStyleSheet::HasRules() const
 nsresult
 ServoStyleSheet::ParseSheet(css::Loader* aLoader,
                             const nsAString& aInput,
                             nsIURI* aSheetURI,
                             nsIURI* aBaseURI,
                             nsIPrincipal* aSheetPrincipal,
                             uint32_t aLineNumber)
 {
-  RefPtr<css::URLExtraData> extraData =
-    new css::URLExtraData(aBaseURI, aSheetURI, aSheetPrincipal);
+  RefPtr<URLExtraData> extraData =
+    new URLExtraData(aBaseURI, aSheetURI, aSheetPrincipal);
 
   NS_ConvertUTF16toUTF8 input(aInput);
   if (!Inner()->mSheet) {
     Inner()->mSheet =
       Servo_StyleSheet_FromUTF8Bytes(aLoader, this, &input,
                                      mParsingMode, extraData).Consume();
   } else {
     Servo_StyleSheet_ClearAndUpdate(Inner()->mSheet, aLoader,
new file mode 100644
--- /dev/null
+++ b/layout/style/URLExtraData.cpp
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* thread-safe container of information for resolving url values */
+
+#include "mozilla/URLExtraData.h"
+
+#include "nsProxyRelease.h"
+
+namespace mozilla {
+
+URLExtraData::~URLExtraData()
+{
+  if (!NS_IsMainThread()) {
+    NS_ReleaseOnMainThread(mBaseURI.forget());
+    NS_ReleaseOnMainThread(mReferrer.forget());
+    NS_ReleaseOnMainThread(mPrincipal.forget());
+  }
+}
+
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/layout/style/URLExtraData.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* thread-safe container of information for resolving url values */
+
+#ifndef mozilla_URLExtraData_h
+#define mozilla_URLExtraData_h
+
+#include "mozilla/Move.h"
+
+#include "nsCOMPtr.h"
+#include "nsIPrincipal.h"
+#include "nsIURI.h"
+
+namespace mozilla {
+
+struct URLExtraData
+{
+  URLExtraData(already_AddRefed<nsIURI> aBaseURI,
+               already_AddRefed<nsIURI> aReferrer,
+               already_AddRefed<nsIPrincipal> aPrincipal)
+    : mBaseURI(Move(aBaseURI))
+    , mReferrer(Move(aReferrer))
+    , mPrincipal(Move(aPrincipal))
+  {
+    MOZ_ASSERT(mBaseURI);
+  }
+
+  URLExtraData(nsIURI* aBaseURI, nsIURI* aReferrer, nsIPrincipal* aPrincipal)
+    : URLExtraData(do_AddRef(aBaseURI),
+                   do_AddRef(aReferrer),
+                   do_AddRef(aPrincipal)) {}
+
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLExtraData)
+
+  nsIURI* BaseURI() const { return mBaseURI; }
+  nsIURI* GetReferrer() const { return mReferrer; }
+  nsIPrincipal* GetPrincipal() const { return mPrincipal; }
+
+private:
+  ~URLExtraData();
+
+  nsCOMPtr<nsIURI> mBaseURI;
+  nsCOMPtr<nsIURI> mReferrer;
+  nsCOMPtr<nsIPrincipal> mPrincipal;
+};
+
+} // namespace mozilla
+
+#endif // mozilla_URLExtraData_h
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -118,16 +118,17 @@ EXPORTS.mozilla += [
     'StyleBackendType.h',
     'StyleComplexColor.h',
     'StyleContextSource.h',
     'StyleSetHandle.h',
     'StyleSetHandleInlines.h',
     'StyleSheet.h',
     'StyleSheetInfo.h',
     'StyleSheetInlines.h',
+    'URLExtraData.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'CSS.h',
     'CSSLexer.h',
     'CSSMediaRule.h',
     'CSSNamespaceRule.h',
     'CSSRuleList.h',
@@ -224,16 +225,17 @@ UNIFIED_SOURCES += [
     'ServoNamespaceRule.cpp',
     'ServoSpecifiedValues.cpp',
     'ServoStyleRule.cpp',
     'ServoStyleSet.cpp',
     'ServoStyleSheet.cpp',
     'StyleAnimationValue.cpp',
     'StyleRule.cpp',
     'StyleSheet.cpp',
+    'URLExtraData.cpp',
 ]
 
 # - nsLayoutStylesheetCache.cpp needs to be built separately because it uses
 # nsExceptionHandler.h, which includes windows.h.
 SOURCES += [
     'nsLayoutStylesheetCache.cpp',
 ]
 
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -7,24 +7,22 @@
 /* representation of simple property values within CSS declarations */
 
 #include "nsCSSValue.h"
 
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/Move.h"
 #include "mozilla/css/ImageLoader.h"
 #include "CSSCalc.h"
 #include "gfxFontConstants.h"
 #include "imgIRequest.h"
 #include "imgRequestProxy.h"
 #include "nsIDocument.h"
-#include "nsIPrincipal.h"
 #include "nsCSSProps.h"
 #include "nsNetUtil.h"
 #include "nsPresContext.h"
 #include "nsStyleUtil.h"
 #include "nsDeviceContext.h"
 #include "nsStyleSet.h"
 #include "nsContentUtils.h"
 
@@ -2778,25 +2776,16 @@ nsCSSValue::Array::SizeOfIncludingThis(m
 {
   size_t n = aMallocSizeOf(this);
   for (size_t i = 0; i < mCount; i++) {
     n += mArray[i].SizeOfExcludingThis(aMallocSizeOf);
   }
   return n;
 }
 
-css::URLExtraData::~URLExtraData()
-{
-  if (!NS_IsMainThread()) {
-    NS_ReleaseOnMainThread(mBaseURI.forget());
-    NS_ReleaseOnMainThread(mReferrer.forget());
-    NS_ReleaseOnMainThread(mPrincipal.forget());
-  }
-}
-
 css::URLValueData::URLValueData(already_AddRefed<PtrHolder<nsIURI>> aURI,
                                 nsStringBuffer* aString,
                                 already_AddRefed<URLExtraData> aExtraData)
   : mURI(Move(aURI))
   , mString(aString)
   , mExtraData(Move(aExtraData))
   , mURIResolved(true)
   , mIsLocalRef(IsLocalRefURL(aString))
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -7,21 +7,19 @@
 
 #ifndef nsCSSValue_h___
 #define nsCSSValue_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/SheetType.h"
 #include "mozilla/StyleComplexColor.h"
+#include "mozilla/URLExtraData.h"
 #include "mozilla/UniquePtr.h"
 
-#include "nsIPrincipal.h"
-#include "nsIURI.h"
-#include "nsCOMPtr.h"
 #include "nsCSSKeywords.h"
 #include "nsCSSPropertyID.h"
 #include "nsCSSProps.h"
 #include "nsColor.h"
 #include "nsCoord.h"
 #include "nsProxyRelease.h"
 #include "nsRefPtrHashtable.h"
 #include "nsString.h"
@@ -88,47 +86,16 @@ class CSSStyleSheet;
       dest->member_ = clm_clone;                                               \
       dest = clm_clone;                                                        \
     }                                                                          \
   }
 
 namespace mozilla {
 namespace css {
 
-struct URLExtraData
-{
-  URLExtraData(already_AddRefed<nsIURI> aBaseURI,
-               already_AddRefed<nsIURI> aReferrer,
-               already_AddRefed<nsIPrincipal> aPrincipal)
-    : mBaseURI(Move(aBaseURI))
-    , mReferrer(Move(aReferrer))
-    , mPrincipal(Move(aPrincipal))
-  {
-    MOZ_ASSERT(mBaseURI);
-  }
-
-  URLExtraData(nsIURI* aBaseURI, nsIURI* aReferrer, nsIPrincipal* aPrincipal)
-    : URLExtraData(do_AddRef(aBaseURI),
-                   do_AddRef(aReferrer),
-                   do_AddRef(aPrincipal)) {}
-
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLExtraData)
-
-  nsIURI* BaseURI() const { return mBaseURI; }
-  nsIURI* GetReferrer() const { return mReferrer; }
-  nsIPrincipal* GetPrincipal() const { return mPrincipal; }
-
-private:
-  ~URLExtraData();
-
-  RefPtr<nsIURI> mBaseURI;
-  RefPtr<nsIURI> mReferrer;
-  RefPtr<nsIPrincipal> mPrincipal;
-};
-
 struct URLValueData
 {
 protected:
   // Methods are not inline because using an nsIPrincipal means requiring
   // caps, which leads to REQUIRES hell, since this header is included all
   // over.
 
   // For both constructors aString must not be null.
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -126,18 +126,18 @@ nsDOMCSSDeclaration::SetCssText(const ns
   // Attribute setting code, which leads in turn to BeginUpdate.  We
   // need to start the update now so that the old rule doesn't get used
   // between when we mutate the declaration and when we set the new
   // rule (see stack in bug 209575).
   mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
 
   RefPtr<DeclarationBlock> newdecl;
   if (olddecl->IsServo()) {
-    RefPtr<css::URLExtraData> data =
-      new css::URLExtraData(env.mBaseURI, env.mSheetURI, env.mPrincipal);
+    RefPtr<URLExtraData> data =
+      new URLExtraData(env.mBaseURI, env.mSheetURI, env.mPrincipal);
     newdecl = ServoDeclarationBlock::FromCssText(aCssText, data);
   } else {
     RefPtr<css::Declaration> decl(new css::Declaration());
     decl->InitializeEmpty();
     nsCSSParser cssParser(env.mCSSLoader);
     bool changed;
     nsresult result = cssParser.ParseDeclarations(aCssText, env.mSheetURI,
                                                   env.mBaseURI, env.mPrincipal,
@@ -304,18 +304,18 @@ nsDOMCSSDeclaration::ParsePropertyValue(
   if (decl->IsGecko()) {
     nsCSSParser cssParser(env.mCSSLoader);
     cssParser.ParseProperty(aPropID, aPropValue,
                             env.mSheetURI, env.mBaseURI, env.mPrincipal,
                             decl->AsGecko(), &changed, aIsImportant);
   } else {
     NS_ConvertUTF16toUTF8 value(aPropValue);
     // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
-    RefPtr<css::URLExtraData> data =
-      new css::URLExtraData(env.mBaseURI, env.mSheetURI, env.mPrincipal);
+    RefPtr<URLExtraData> data =
+      new URLExtraData(env.mBaseURI, env.mSheetURI, env.mPrincipal);
     changed = Servo_DeclarationBlock_SetPropertyById(
       decl->AsServo()->Raw(), aPropID, &value, aIsImportant, data);
   }
   if (!changed) {
     // Parsing failed -- but we don't throw an exception for that.
     return NS_OK;
   }
 
@@ -353,18 +353,18 @@ nsDOMCSSDeclaration::ParseCustomProperty
     nsCSSParser cssParser(env.mCSSLoader);
     auto propName = Substring(aPropertyName, CSS_CUSTOM_NAME_PREFIX_LENGTH);
     cssParser.ParseVariable(propName, aPropValue, env.mSheetURI,
                             env.mBaseURI, env.mPrincipal, decl->AsGecko(),
                             &changed, aIsImportant);
   } else {
     NS_ConvertUTF16toUTF8 property(aPropertyName);
     NS_ConvertUTF16toUTF8 value(aPropValue);
-    RefPtr<css::URLExtraData> data =
-      new css::URLExtraData(env.mBaseURI, env.mSheetURI, env.mPrincipal);
+    RefPtr<URLExtraData> data =
+      new URLExtraData(env.mBaseURI, env.mSheetURI, env.mPrincipal);
     changed = Servo_DeclarationBlock_SetProperty(
       decl->AsServo()->Raw(), &property, &value, aIsImportant, data);
   }
   if (!changed) {
     // Parsing failed -- but we don't throw an exception for that.
     return NS_OK;
   }
 
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1994,17 +1994,17 @@ nsStyleImageRequest::nsStyleImageRequest
   if (mRequestProxy) {
     MaybeTrackAndLock();
   }
 }
 
 nsStyleImageRequest::nsStyleImageRequest(
     Mode aModeFlags,
     nsStringBuffer* aURLBuffer,
-    already_AddRefed<css::URLExtraData> aExtraData)
+    already_AddRefed<URLExtraData> aExtraData)
   : mImageValue(new css::ImageValue(aURLBuffer, Move(aExtraData)))
   , mModeFlags(aModeFlags)
   , mResolved(false)
 {
 }
 
 nsStyleImageRequest::~nsStyleImageRequest()
 {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -334,17 +334,17 @@ public:
                       mozilla::css::ImageValue* aImageValue,
                       mozilla::dom::ImageTracker* aImageTracker);
 
   // Can be called from any thread, but Resolve() must be called later
   // on the main thread before get() can be used.
   nsStyleImageRequest(
       Mode aModeFlags,
       nsStringBuffer* aURLBuffer,
-      already_AddRefed<mozilla::css::URLExtraData> aExtraData);
+      already_AddRefed<mozilla::URLExtraData> aExtraData);
 
   bool Resolve(nsPresContext* aPresContext);
   bool IsResolved() const { return mResolved; }
 
   imgRequestProxy* get() {
     MOZ_ASSERT(IsResolved(), "Resolve() must be called first");
     MOZ_ASSERT(NS_IsMainThread());
     return mRequestProxy.get();