Bug 1457920: Merge ServoStyleSheet and StyleSheet. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 30 Apr 2018 17:50:03 +0200
changeset 416536 e7b20e0b67273e3dda4db315271530a3b043e2b2
parent 416535 ff765f9cd347ba2eabde3a54d74d35ffec495fc6
child 416537 eebbf9fbebc75dbe5f2d2a8aadc46950f86b7078
push id33931
push usercsabou@mozilla.com
push dateWed, 02 May 2018 15:00:50 +0000
treeherdermozilla-central@f877359308b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1457920
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 1457920: Merge ServoStyleSheet and StyleSheet. r=xidorn These are the most minimal changes I could make. More cleanups incoming. MozReview-Commit-ID: AdMOA1acQIH
layout/base/PresShell.h
layout/base/nsIPresShell.h
layout/inspector/ServoStyleRuleMap.h
layout/style/ServoBindingList.h
layout/style/ServoBindings.h
layout/style/ServoBindings.toml
layout/style/ServoCSSRuleList.h
layout/style/ServoImportRule.h
layout/style/ServoStyleSet.h
layout/style/ServoStyleSheet.cpp
layout/style/ServoStyleSheet.h
layout/style/StyleSheet.cpp
layout/style/StyleSheet.h
layout/style/StyleSheetInfo.h
layout/style/StyleSheetInlines.h
servo/components/style/gecko/data.rs
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -40,17 +40,16 @@ struct nsCallbackEventRequest;
 class ReflowCountMgr;
 #endif
 
 class nsPresShellEventCB;
 class nsAutoCauseReflowNotifier;
 class AutoPointerEventTargetUpdater;
 
 namespace mozilla {
-class ServoStyleSheet;
 
 namespace dom {
 class Element;
 class Selection;
 }  // namespace dom
 
 class EventDispatchingCallback;
 
@@ -154,19 +153,19 @@ public:
   void SetIgnoreFrameDestruction(bool aIgnore) override;
   void NotifyDestroyingFrame(nsIFrame* aFrame) override;
 
   nsresult CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState) override;
 
   void UnsuppressPainting() override;
 
   nsresult GetAgentStyleSheets(
-      nsTArray<RefPtr<ServoStyleSheet>>& aSheets) override;
+      nsTArray<RefPtr<StyleSheet>>& aSheets) override;
   nsresult SetAgentStyleSheets(
-      const nsTArray<RefPtr<ServoStyleSheet>>& aSheets) override;
+      const nsTArray<RefPtr<StyleSheet>>& aSheets) override;
 
   nsresult AddOverrideStyleSheet(StyleSheet* aSheet) override;
   nsresult RemoveOverrideStyleSheet(StyleSheet* aSheet) override;
 
   nsresult HandleEventWithTarget(WidgetEvent* aEvent,
                                  nsIFrame* aFrame,
                                  nsIContent* aContent,
                                  nsEventStatus* aStatus,
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -52,17 +52,17 @@ class nsPresContext;
 class nsWindowSizes;
 class nsViewManager;
 class nsView;
 class nsIPageSequenceFrame;
 class nsCanvasFrame;
 class nsCaret;
 namespace mozilla {
 class AccessibleCaretEventHub;
-class ServoStyleSheet;
+class StyleSheet;
 } // namespace mozilla
 class nsFrameSelection;
 class nsFrameManager;
 class nsILayoutHistoryState;
 class nsIReflowCallback;
 class nsIDOMNode;
 class nsCSSFrameConstructor;
 class nsISelection;
@@ -1002,23 +1002,23 @@ public:
    * Unsuppress painting.
    */
   virtual void UnsuppressPainting() = 0;
 
   /**
    * Get the set of agent style sheets for this presentation
    */
   virtual nsresult GetAgentStyleSheets(
-      nsTArray<RefPtr<mozilla::ServoStyleSheet>>& aSheets) = 0;
+      nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) = 0;
 
   /**
    * Replace the set of agent style sheets
    */
   virtual nsresult SetAgentStyleSheets(
-      const nsTArray<RefPtr<mozilla::ServoStyleSheet>>& aSheets) = 0;
+      const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) = 0;
 
   /**
    * Add an override style sheet for this presentation
    */
   virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) = 0;
 
   /**
    * Remove an override style sheet
--- a/layout/inspector/ServoStyleRuleMap.h
+++ b/layout/inspector/ServoStyleRuleMap.h
@@ -3,16 +3,17 @@
 /* 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/. */
 
 #ifndef mozilla_ServoStyleRuleMap_h
 #define mozilla_ServoStyleRuleMap_h
 
 #include "mozilla/ServoStyleRule.h"
+#include "mozilla/ServoStyleSheet.h"
 
 #include "nsDataHashtable.h"
 
 struct RawServoStyleRule;
 class nsXBLPrototypeResources;
 
 namespace mozilla {
 class ServoCSSRuleList;
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -49,17 +49,17 @@ SERVO_BINDING_FUNC(Servo_InvalidateStyle
                    RawServoStyleSetBorrowed doc_styles,
                    const nsTArray<RawServoAuthorStylesBorrowed>* non_document_styles,
                    uint64_t aStatesChanged)
 
 // Styleset and Stylesheet management
 SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes,
                    RawServoStyleSheetContentsStrong,
                    mozilla::css::Loader* loader,
-                   mozilla::ServoStyleSheet* gecko_stylesheet,
+                   mozilla::StyleSheet* gecko_stylesheet,
                    mozilla::css::SheetLoadData* load_data,
                    const nsACString* bytes,
                    mozilla::css::SheetParsingMode parsing_mode,
                    RawGeckoURLExtraData* extra_data,
                    uint32_t line_number_offset,
                    nsCompatibility quirks_mode,
                    mozilla::css::LoaderReusableStyleSheets* reusable_sheets)
 SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8BytesAsync,
@@ -73,17 +73,17 @@ SERVO_BINDING_FUNC(Servo_StyleSheet_From
 SERVO_BINDING_FUNC(Servo_StyleSheet_Empty, RawServoStyleSheetContentsStrong,
                    mozilla::css::SheetParsingMode parsing_mode)
 SERVO_BINDING_FUNC(Servo_StyleSheet_HasRules, bool,
                    RawServoStyleSheetContentsBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_StyleSheet_GetRules, ServoCssRulesStrong,
                    RawServoStyleSheetContentsBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_StyleSheet_Clone, RawServoStyleSheetContentsStrong,
                    RawServoStyleSheetContentsBorrowed sheet,
-                   const mozilla::ServoStyleSheet* reference_sheet);
+                   const mozilla::StyleSheet* reference_sheet);
 SERVO_BINDING_FUNC(Servo_StyleSheet_SizeOfIncludingThis, size_t,
                    mozilla::MallocSizeOf malloc_size_of,
                    mozilla::MallocSizeOf malloc_enclosing_size_of,
                    RawServoStyleSheetContentsBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_StyleSheet_GetSourceMapURL, void,
                    RawServoStyleSheetContentsBorrowed sheet, nsAString* result)
 SERVO_BINDING_FUNC(Servo_StyleSheet_GetSourceURL, void,
                    RawServoStyleSheetContentsBorrowed sheet, nsAString* result)
@@ -107,27 +107,27 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Medium
 // We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
 // work as return values with the Linux 32-bit ABI at the moment because
 // they wrap the value in a struct.
 SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
 SERVO_BINDING_FUNC(Servo_StyleSet_CompatModeChanged, void,
                    RawServoStyleSetBorrowed raw_data)
 SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
                    RawServoStyleSetBorrowed set,
-                   const mozilla::ServoStyleSheet* gecko_sheet)
+                   const mozilla::StyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
                    RawServoStyleSetBorrowed set,
-                   const mozilla::ServoStyleSheet* gecko_sheet)
+                   const mozilla::StyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
                    RawServoStyleSetBorrowed set,
-                   const mozilla::ServoStyleSheet* gecko_sheet)
+                   const mozilla::StyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
                    RawServoStyleSetBorrowed set,
-                   const mozilla::ServoStyleSheet* gecko_sheet,
-                   const mozilla::ServoStyleSheet* before)
+                   const mozilla::StyleSheet* gecko_sheet,
+                   const mozilla::StyleSheet* before)
 SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void,
                    RawServoStyleSetBorrowed set,
                    RawGeckoElementBorrowedOrNull doc_elem,
                    const mozilla::ServoElementSnapshotTable* snapshots)
 SERVO_BINDING_FUNC(Servo_StyleSet_SetAuthorStyleDisabled, void,
                    RawServoStyleSetBorrowed set,
                    bool author_style_disabled)
 SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
@@ -192,24 +192,24 @@ SERVO_BINDING_FUNC(Servo_UACache_AddSize
 // AuthorStyles
 SERVO_BINDING_FUNC(Servo_AuthorStyles_Create, RawServoAuthorStyles*)
 SERVO_BINDING_FUNC(Servo_AuthorStyles_Drop, void,
                    RawServoAuthorStylesOwned self)
 // TODO(emilio): These will need to take a master style set to implement
 // invalidation for Shadow DOM.
 SERVO_BINDING_FUNC(Servo_AuthorStyles_AppendStyleSheet, void,
                    RawServoAuthorStylesBorrowedMut self,
-                   const mozilla::ServoStyleSheet* gecko_sheet)
+                   const mozilla::StyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_AuthorStyles_RemoveStyleSheet, void,
                    RawServoAuthorStylesBorrowedMut self,
-                   const mozilla::ServoStyleSheet* gecko_sheet)
+                   const mozilla::StyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_AuthorStyles_InsertStyleSheetBefore, void,
                    RawServoAuthorStylesBorrowedMut self,
-                   const mozilla::ServoStyleSheet* gecko_sheet,
-                   const mozilla::ServoStyleSheet* before)
+                   const mozilla::StyleSheet* gecko_sheet,
+                   const mozilla::StyleSheet* before)
 SERVO_BINDING_FUNC(Servo_AuthorStyles_ForceDirty, void,
                    RawServoAuthorStylesBorrowedMut self)
 // TODO(emilio): This will need to take an element and a master style set to
 // implement invalidation for Shadow DOM.
 SERVO_BINDING_FUNC(Servo_AuthorStyles_Flush, void,
                    RawServoAuthorStylesBorrowedMut self,
                    RawServoStyleSetBorrowed document_styles)
 SERVO_BINDING_FUNC(Servo_AuthorStyles_SizeOfIncludingThis, size_t,
@@ -238,17 +238,17 @@ SERVO_BINDING_FUNC(Servo_CssRules_ListTy
                    nsTArrayBorrowed_uintptr_t result)
 SERVO_BINDING_FUNC(Servo_CssRules_InsertRule, nsresult,
                    ServoCssRulesBorrowed rules,
                    RawServoStyleSheetContentsBorrowed sheet,
                    const nsACString* rule,
                    uint32_t index,
                    bool nested,
                    mozilla::css::Loader* loader,
-                   mozilla::ServoStyleSheet* gecko_stylesheet,
+                   mozilla::StyleSheet* gecko_stylesheet,
                    uint16_t* rule_type)
 SERVO_BINDING_FUNC(Servo_CssRules_DeleteRule, nsresult,
                    ServoCssRulesBorrowed rules, uint32_t index)
 
 // CSS Rules
 #define BASIC_RULE_FUNCS_WITHOUT_GETTER(type_) \
   SERVO_BINDING_FUNC(Servo_##type_##_Debug, void, \
                      RawServo##type_##Borrowed rule, nsACString* result) \
@@ -298,22 +298,22 @@ SERVO_BINDING_FUNC(Servo_StyleRule_Selec
                    RawServoStyleRuleBorrowed, RawGeckoElementBorrowed,
                    uint32_t index, mozilla::CSSPseudoElementType pseudo_type)
 SERVO_BINDING_FUNC(Servo_StyleRule_SetSelectorText, bool,
                    RawServoStyleSheetContentsBorrowed sheet,
                    RawServoStyleRuleBorrowed rule, const nsAString* text)
 SERVO_BINDING_FUNC(Servo_ImportRule_GetHref, void,
                    RawServoImportRuleBorrowed rule, nsAString* result)
 SERVO_BINDING_FUNC(Servo_ImportRule_GetSheet,
-                   const mozilla::ServoStyleSheet*,
+                   const mozilla::StyleSheet*,
                    RawServoImportRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_ImportRule_SetSheet,
                    void,
                    RawServoImportRuleBorrowed rule,
-                   mozilla::ServoStyleSheet* sheet);
+                   mozilla::StyleSheet* sheet);
 SERVO_BINDING_FUNC(Servo_Keyframe_GetKeyText, void,
                    RawServoKeyframeBorrowed keyframe, nsAString* result)
 // Returns whether it successfully changes the key text.
 SERVO_BINDING_FUNC(Servo_Keyframe_SetKeyText, bool,
                    RawServoKeyframeBorrowed keyframe, const nsACString* text)
 SERVO_BINDING_FUNC(Servo_Keyframe_GetStyle, RawServoDeclarationBlockStrong,
                    RawServoKeyframeBorrowed keyframe)
 SERVO_BINDING_FUNC(Servo_Keyframe_SetStyle, void,
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -49,17 +49,17 @@ namespace mozilla {
   };
   namespace dom {
     enum class IterationCompositeOperation : uint8_t;
   };
   enum class UpdateAnimationsTasks : uint8_t;
   struct LangGroupFontPrefs;
   class SeenPtrs;
   class ComputedStyle;
-  class ServoStyleSheet;
+  class StyleSheet;
   class ServoElementSnapshotTable;
 }
 using mozilla::FontFamilyList;
 using mozilla::FontFamilyName;
 using mozilla::FontFamilyType;
 using mozilla::ServoElementSnapshot;
 using mozilla::SharedFontList;
 struct nsMediaFeature;
@@ -172,19 +172,19 @@ void Gecko_ConstructStyleChildrenIterato
 void Gecko_DestroyStyleChildrenIterator(RawGeckoStyleChildrenIteratorBorrowedMut aIterator);
 RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(RawGeckoStyleChildrenIteratorBorrowedMut it);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::SheetLoadDataHolder, SheetLoadDataHolder);
 
 void Gecko_StyleSheet_FinishAsyncParse(mozilla::css::SheetLoadDataHolder* data,
                                        RawServoStyleSheetContentsStrong sheet_contents);
 
-mozilla::ServoStyleSheet*
+mozilla::StyleSheet*
 Gecko_LoadStyleSheet(mozilla::css::Loader* loader,
-                     mozilla::ServoStyleSheet* parent,
+                     mozilla::StyleSheet* parent,
                      mozilla::css::SheetLoadData* parent_load_data,
                      mozilla::css::LoaderReusableStyleSheets* reusable_sheets,
                      ServoBundledURI url,
                      RawServoMediaListStrong media_list);
 
 void
 Gecko_LoadStyleSheetAsync(mozilla::css::SheetLoadDataHolder* parent_data,
                           ServoBundledURI url,
@@ -639,21 +639,21 @@ GeckoFontMetrics Gecko_GetFontMetrics(Ra
                                       const nsStyleFont* font,
                                       nscoord font_size,
                                       bool use_user_font_set);
 int32_t Gecko_GetAppUnitsPerPhysicalInch(RawGeckoPresContextBorrowed pres_context);
 void InitializeServo();
 void ShutdownServo();
 void AssertIsMainThreadOrServoLangFontPrefsCacheLocked();
 
-mozilla::ServoStyleSheet* Gecko_StyleSheet_Clone(
-    const mozilla::ServoStyleSheet* aSheet,
-    const mozilla::ServoStyleSheet* aNewParentSheet);
-void Gecko_StyleSheet_AddRef(const mozilla::ServoStyleSheet* aSheet);
-void Gecko_StyleSheet_Release(const mozilla::ServoStyleSheet* aSheet);
+mozilla::StyleSheet* Gecko_StyleSheet_Clone(
+    const mozilla::StyleSheet* aSheet,
+    const mozilla::StyleSheet* aNewParentSheet);
+void Gecko_StyleSheet_AddRef(const mozilla::StyleSheet* aSheet);
+void Gecko_StyleSheet_Release(const mozilla::StyleSheet* aSheet);
 
 nsCSSKeyword Gecko_LookupCSSKeyword(const uint8_t* string, uint32_t len);
 const char* Gecko_CSSKeywordString(nsCSSKeyword keyword, uint32_t* len);
 
 bool Gecko_IsDocumentBody(RawGeckoElementBorrowed element);
 
 // We use an int32_t here instead of a LookAndFeel::ColorID
 // because forward-declaring a nested enum/struct is impossible
@@ -691,17 +691,17 @@ void Gecko_AnnotateCrashReport(const cha
   const uint32_t SERVO_CSS_PSEUDO_ELEMENT_FLAGS_##name_ = flags_;
 #include "nsCSSPseudoElementList.h"
 #undef CSS_PSEUDO_ELEMENT
 
 #define SERVO_BINDING_FUNC(name_, return_, ...) return_ name_(__VA_ARGS__);
 #include "mozilla/ServoBindingList.h"
 #undef SERVO_BINDING_FUNC
 
-mozilla::css::ErrorReporter* Gecko_CreateCSSErrorReporter(mozilla::ServoStyleSheet* sheet,
+mozilla::css::ErrorReporter* Gecko_CreateCSSErrorReporter(mozilla::StyleSheet* sheet,
                                                           mozilla::css::Loader* loader,
                                                           nsIURI* uri);
 void Gecko_DestroyCSSErrorReporter(mozilla::css::ErrorReporter* reporter);
 void Gecko_ReportUnexpectedCSSError(mozilla::css::ErrorReporter* reporter,
                                     const char* message,
                                     const char* param,
                                     uint32_t paramLen,
                                     const char* prefix,
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -583,17 +583,17 @@ structs-types = [
     "nsTimingFunction",
     "nscolor",
     "nscoord",
     "nsresult",
     "Loader",
     "LoaderReusableStyleSheets",
     "SheetLoadData",
     "SheetLoadDataHolder",
-    "ServoStyleSheet",
+    "StyleSheet",
     "ServoComputedData",
     "ComputedStyleStrong",
     "EffectCompositor_CascadeLevel",
     "UpdateAnimationsTasks",
     "ParsingMode",
     "InheritTarget",
     "URLMatchingFunction",
     "StyleAnimation",
--- a/layout/style/ServoCSSRuleList.h
+++ b/layout/style/ServoCSSRuleList.h
@@ -11,17 +11,17 @@
 
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/dom/CSSRuleList.h"
 #include "nsDataHashtable.h"
 
 namespace mozilla {
 
 class ServoStyleRule;
-class ServoStyleSheet;
+class StyleSheet;
 namespace css {
 class GroupRule;
 class Rule;
 } // namespace css
 
 class ServoCSSRuleList final : public dom::CSSRuleList
 {
 public:
--- a/layout/style/ServoImportRule.h
+++ b/layout/style/ServoImportRule.h
@@ -9,18 +9,18 @@
 #ifndef mozilla_ServoImportRule_h
 #define mozilla_ServoImportRule_h
 
 #include "mozilla/dom/CSSImportRule.h"
 #include "mozilla/ServoBindingTypes.h"
 
 namespace mozilla {
 
-class ServoStyleSheet;
 class ServoMediaList;
+class StyleSheet;
 
 class ServoImportRule final : public dom::CSSImportRule
 {
 public:
   ServoImportRule(RefPtr<RawServoImportRule> aRawRule,
                   uint32_t aLine, uint32_t aColumn);
 
   NS_DECL_ISUPPORTS_INHERITED
@@ -36,14 +36,14 @@ public:
   void GetHref(nsAString& aHref) const final;
   dom::MediaList* GetMedia() const final;
   StyleSheet* GetStyleSheet() const final;
 
 private:
   ~ServoImportRule();
 
   RefPtr<RawServoImportRule> mRawRule;
-  RefPtr<ServoStyleSheet> mChildSheet;
+  RefPtr<StyleSheet> mChildSheet;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoImportRule_h
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -28,17 +28,17 @@
 namespace mozilla {
 namespace css {
 class Rule;
 } // namespace css
 namespace dom {
 class Element;
 class ShadowRoot;
 } // namespace dom
-class ServoStyleSheet;
+class StyleSheet;
 struct Keyframe;
 class ServoElementSnapshotTable;
 class ComputedStyle;
 class ServoStyleRuleMap;
 class StyleSheet;
 } // namespace mozilla
 class gfxFontFeatureValueSet;
 class nsIContent;
@@ -73,17 +73,17 @@ enum class OriginFlags : uint8_t {
   Author    = 0x04,
   All       = 0x07,
 };
 
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(OriginFlags)
 
 /**
  * The set of style sheets that apply to a document, backed by a Servo
- * Stylist.  A ServoStyleSet contains ServoStyleSheets.
+ * Stylist.  A ServoStyleSet contains StyleSheets.
  */
 class ServoStyleSet
 {
   friend class RestyleManager;
   typedef ServoElementSnapshotTable SnapshotTable;
 
 public:
   static bool IsInServoTraversal() { return mozilla::IsInServoTraversal(); }
@@ -104,19 +104,19 @@ public:
   ~ServoStyleSet();
 
   void Init(nsPresContext* aPresContext);
   void BeginShutdown() {}
   void Shutdown();
 
   // Called when a rules in a stylesheet in this set, or a child sheet of that,
   // are mutated from CSSOM.
-  void RuleAdded(ServoStyleSheet&, css::Rule&);
-  void RuleRemoved(ServoStyleSheet&, css::Rule&);
-  void RuleChanged(ServoStyleSheet& aSheet, css::Rule* aRule);
+  void RuleAdded(StyleSheet&, css::Rule&);
+  void RuleRemoved(StyleSheet&, css::Rule&);
+  void RuleChanged(StyleSheet& aSheet, css::Rule* aRule);
 
   // Runs style invalidation due to document state changes.
   void InvalidateStyleForDocumentStateChanges(EventStates aStatesChanged);
 
   void RecordShadowStyleChange(dom::ShadowRoot&);
 
   bool StyleSheetsHaveChanged() const
   {
@@ -227,39 +227,39 @@ public:
   already_AddRefed<ComputedStyle>
   ResolveXULTreePseudoStyle(dom::Element* aParentElement,
                             nsICSSAnonBoxPseudo* aPseudoTag,
                             ComputedStyle* aParentContext,
                             const AtomArray& aInputWord);
 #endif
 
   // manage the set of style sheets in the style set
-  nsresult AppendStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
-  nsresult PrependStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
-  nsresult RemoveStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
+  nsresult AppendStyleSheet(SheetType aType, StyleSheet* aSheet);
+  nsresult PrependStyleSheet(SheetType aType, StyleSheet* aSheet);
+  nsresult RemoveStyleSheet(SheetType aType, StyleSheet* aSheet);
   nsresult ReplaceSheets(SheetType aType,
-                         const nsTArray<RefPtr<ServoStyleSheet>>& aNewSheets);
+                         const nsTArray<RefPtr<StyleSheet>>& aNewSheets);
   nsresult InsertStyleSheetBefore(SheetType aType,
-                                  ServoStyleSheet* aNewSheet,
-                                  ServoStyleSheet* aReferenceSheet);
+                                  StyleSheet* aNewSheet,
+                                  StyleSheet* aReferenceSheet);
 
   int32_t SheetCount(SheetType aType) const;
-  ServoStyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const;
+  StyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const;
 
   void AppendAllNonDocumentAuthorSheets(nsTArray<StyleSheet*>& aArray) const;
 
   template<typename Func>
   void EnumerateStyleSheetArrays(Func aCallback) const {
     for (const auto& sheetArray : mSheets) {
       aCallback(sheetArray);
     }
   }
 
-  nsresult RemoveDocStyleSheet(ServoStyleSheet* aSheet);
-  nsresult AddDocStyleSheet(ServoStyleSheet* aSheet, nsIDocument* aDocument);
+  nsresult RemoveDocStyleSheet(StyleSheet* aSheet);
+  nsresult AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument);
 
   // check whether there is ::before/::after style for an element
   already_AddRefed<ComputedStyle>
   ProbePseudoElementStyle(dom::Element* aOriginatingElement,
                           CSSPseudoElementType aType,
                           ComputedStyle* aParentContext);
 
   /**
@@ -537,27 +537,27 @@ private:
     ResolveStyleLazilyInternal(dom::Element* aElement,
                                CSSPseudoElementType aPseudoType,
                                StyleRuleInclusion aRules =
                                  StyleRuleInclusion::All);
 
   void RunPostTraversalTasks();
 
   void PrependSheetOfType(SheetType aType,
-                          ServoStyleSheet* aSheet);
+                          StyleSheet* aSheet);
 
   void AppendSheetOfType(SheetType aType,
-                         ServoStyleSheet* aSheet);
+                         StyleSheet* aSheet);
 
   void InsertSheetOfType(SheetType aType,
-                         ServoStyleSheet* aSheet,
-                         ServoStyleSheet* aBeforeSheet);
+                         StyleSheet* aSheet,
+                         StyleSheet* aBeforeSheet);
 
   void RemoveSheetOfType(SheetType aType,
-                         ServoStyleSheet* aSheet);
+                         StyleSheet* aSheet);
 
   // The owner document of this style set. Null if this is an XBL style set.
   //
   // TODO(emilio): This should become a DocumentOrShadowRoot, and be owned by it
   // directly instead of the shell, eventually.
   nsIDocument* mDocument;
 
   const nsPresContext* GetPresContext() const {
@@ -567,17 +567,17 @@ private:
   /**
    * Return the associated pres context if we're the master style set and we
    * have an associated pres shell.
    */
   nsPresContext* GetPresContext();
 
   UniquePtr<RawServoStyleSet> mRawSet;
   EnumeratedArray<SheetType, SheetType::Count,
-                  nsTArray<RefPtr<ServoStyleSheet>>> mSheets;
+                  nsTArray<RefPtr<StyleSheet>>> mSheets;
   bool mAuthorStyleDisabled;
   StylistState mStylistState;
   uint64_t mUserFontSetUpdateGeneration;
 
   bool mNeedsRestyleAfterEnsureUniqueInner;
 
   // Stores pointers to our cached ComputedStyles for non-inheriting anonymous
   // boxes.
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -24,41 +24,16 @@
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 // -------------------------------
 // CSS Style Sheet Inner Data Container
 //
 
-ServoStyleSheetInner::ServoStyleSheetInner(CORSMode aCORSMode,
-                                           ReferrerPolicy aReferrerPolicy,
-                                           const SRIMetadata& aIntegrity,
-                                           css::SheetParsingMode aParsingMode)
-  : StyleSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity)
-{
-  mContents = Servo_StyleSheet_Empty(aParsingMode).Consume();
-  mURLData = URLExtraData::Dummy();
-  MOZ_COUNT_CTOR(ServoStyleSheetInner);
-}
-
-ServoStyleSheetInner::ServoStyleSheetInner(ServoStyleSheetInner& aCopy,
-                                           ServoStyleSheet* aPrimarySheet)
-  : StyleSheetInfo(aCopy, aPrimarySheet)
-  , mURLData(aCopy.mURLData)
-{
-  MOZ_COUNT_CTOR(ServoStyleSheetInner);
-
-  // Actually clone aCopy's mContents and use that as ours.
-  mContents = Servo_StyleSheet_Clone(
-    aCopy.mContents.get(), aPrimarySheet).Consume();
-
-  // Our child list is fixed up by our parent.
-}
-
 void
 ServoStyleSheet::BuildChildListAfterInnerClone()
 {
   MOZ_ASSERT(Inner()->mSheets.Length() == 1, "Should've just cloned");
   MOZ_ASSERT(Inner()->mSheets[0] == this);
   MOZ_ASSERT(!Inner()->mFirstChild);
 
   auto* contents = Inner()->mContents.get();
@@ -94,111 +69,19 @@ ServoStyleSheet::CreateEmptyChildSheet(
         CORSMode::CORS_NONE,
         GetReferrerPolicy(),
         SRIMetadata());
 
   child->mMedia = aMediaList;
   return child.forget();
 }
 
-
-ServoStyleSheetInner::~ServoStyleSheetInner()
-{
-  MOZ_COUNT_DTOR(ServoStyleSheetInner);
-}
-
-StyleSheetInfo*
-ServoStyleSheetInner::CloneFor(StyleSheet* aPrimarySheet)
-{
-  return new ServoStyleSheetInner(*this,
-                                  static_cast<ServoStyleSheet*>(aPrimarySheet));
-}
-
 MOZ_DEFINE_MALLOC_SIZE_OF(ServoStyleSheetMallocSizeOf)
 MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoStyleSheetMallocEnclosingSizeOf)
 
-size_t
-ServoStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
-{
-  size_t n = aMallocSizeOf(this);
-  n += Servo_StyleSheet_SizeOfIncludingThis(
-      ServoStyleSheetMallocSizeOf,
-      ServoStyleSheetMallocEnclosingSizeOf,
-      mContents);
-  return n;
-}
-
-ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode,
-                                 CORSMode aCORSMode,
-                                 net::ReferrerPolicy aReferrerPolicy,
-                                 const dom::SRIMetadata& aIntegrity)
-  : StyleSheet(aParsingMode)
-{
-  mInner = new ServoStyleSheetInner(
-    aCORSMode, aReferrerPolicy, aIntegrity, aParsingMode);
-  mInner->AddSheet(this);
-}
-
-ServoStyleSheet::ServoStyleSheet(const ServoStyleSheet& aCopy,
-                                 ServoStyleSheet* aParentToUse,
-                                 dom::CSSImportRule* aOwnerRuleToUse,
-                                 nsIDocument* aDocumentToUse,
-                                 nsINode* aOwningNodeToUse)
-  : StyleSheet(aCopy,
-               aParentToUse,
-               aOwnerRuleToUse,
-               aDocumentToUse,
-               aOwningNodeToUse)
-{
-  if (HasForcedUniqueInner()) { // CSSOM's been there, force full copy now
-    NS_ASSERTION(mInner->mComplete,
-                 "Why have rules been accessed on an incomplete sheet?");
-    // FIXME: handle failure?
-    //
-    // NOTE: It's important to call this from the subclass, since this could
-    // access uninitialized members otherwise.
-    EnsureUniqueInner();
-  }
-}
-
-ServoStyleSheet::~ServoStyleSheet()
-{
-}
-
-void
-ServoStyleSheet::LastRelease()
-{
-  DropRuleList();
-}
-
-// QueryInterface implementation for ServoStyleSheet
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoStyleSheet)
-  if (aIID.Equals(NS_GET_IID(ServoStyleSheet)))
-    foundInterface = reinterpret_cast<nsISupports*>(this);
-  else
-NS_INTERFACE_MAP_END_INHERITING(StyleSheet)
-
-NS_IMPL_ADDREF_INHERITED(ServoStyleSheet, StyleSheet)
-NS_IMPL_RELEASE_INHERITED(ServoStyleSheet, StyleSheet)
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(ServoStyleSheet)
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ServoStyleSheet)
-  tmp->DropRuleList();
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(StyleSheet)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoStyleSheet, StyleSheet)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRuleList)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-bool
-ServoStyleSheet::HasRules() const
-{
-  return Servo_StyleSheet_HasRules(Inner()->mContents);
-}
-
 // We disable parallel stylesheet parsing if any of the following three
 // conditions hold:
 //
 // (1) The pref is off.
 // (2) The browser is recording CSS errors (which parallel parsing can't handle).
 // (3) The stylesheet is a chrome stylesheet, since those can use -moz-bool-pref,
 //     which needs to access the pref service, which is not threadsafe.
 static bool
@@ -525,37 +408,16 @@ ServoStyleSheet::InsertRuleIntoGroupInte
                                              css::GroupRule* aGroup,
                                              uint32_t aIndex)
 {
   auto rules = static_cast<ServoCSSRuleList*>(aGroup->CssRules());
   MOZ_ASSERT(rules->GetParentRule() == aGroup);
   return rules->InsertRule(aRule, aIndex);
 }
 
-size_t
-ServoStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
-{
-  size_t n = StyleSheet::SizeOfIncludingThis(aMallocSizeOf);
-  const ServoStyleSheet* s = this;
-  while (s) {
-    // See the comment in CSSStyleSheet::SizeOfIncludingThis() for an
-    // explanation of this.
-    if (s->Inner()->mSheets.LastElement() == s) {
-      n += s->Inner()->SizeOfIncludingThis(aMallocSizeOf);
-    }
-
-    // Measurement of the following members may be added later if DMD finds it
-    // is worthwhile:
-    // - s->mRuleList
-
-    s = s->mNext ? s->mNext->AsServo() : nullptr;
-  }
-  return n;
-}
-
 OriginFlags
 ServoStyleSheet::GetOrigin()
 {
   return static_cast<OriginFlags>(
     Servo_StyleSheet_GetOrigin(Inner()->mContents));
 }
 
 } // namespace mozilla
--- a/layout/style/ServoStyleSheet.h
+++ b/layout/style/ServoStyleSheet.h
@@ -2,191 +2,18 @@
 /* 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/. */
 
 #ifndef mozilla_ServoStyleSheet_h
 #define mozilla_ServoStyleSheet_h
 
-#include "mozilla/dom/SRIMetadata.h"
-#include "mozilla/MozPromise.h"
-#include "mozilla/RefPtr.h"
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/StyleSheet.h"
-#include "mozilla/StyleSheetInfo.h"
-#include "mozilla/URLExtraData.h"
-#include "nsCompatibility.h"
-#include "nsStringFwd.h"
 
 namespace mozilla {
 
-class ServoCSSRuleList;
-typedef MozPromise</* Dummy */ bool,
-                   /* Dummy */ bool,
-                   /* IsExclusive = */ true> StyleSheetParsePromise;
-
-namespace css {
-class Loader;
-class LoaderReusableStyleSheets;
-class SheetLoadData;
-}
-
-// -------------------------------
-// Servo Style Sheet Inner Data Container
-//
-
-struct ServoStyleSheetInner final : public StyleSheetInfo
-{
-  ServoStyleSheetInner(CORSMode aCORSMode,
-                       ReferrerPolicy aReferrerPolicy,
-                       const dom::SRIMetadata& aIntegrity,
-                       css::SheetParsingMode aParsingMode);
-  ServoStyleSheetInner(ServoStyleSheetInner& aCopy,
-                       ServoStyleSheet* aPrimarySheet);
-  ~ServoStyleSheetInner();
-
-  StyleSheetInfo* CloneFor(StyleSheet* aPrimarySheet) override;
-
-  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
-
-  RefPtr<const RawServoStyleSheetContents> mContents;
-
-  // XXX StyleSheetInfo already has mSheetURI, mBaseURI, and mPrincipal.
-  // Can we somehow replace them with URLExtraData directly? The issue
-  // is currently URLExtraData is immutable, but URIs in StyleSheetInfo
-  // seems to be mutable, so we probably cannot set them altogether.
-  // Also, this is mostly a duplicate reference of the same url data
-  // inside RawServoStyleSheet. We may want to just use that instead.
-  RefPtr<URLExtraData> mURLData;
-};
-
-
-/**
- * CSS style sheet object that is a wrapper for a Servo Stylesheet.
- */
-
-// CID for the ServoStyleSheet class
-// a6f31472-ab69-4beb-860f-c221431ead77
-#define NS_SERVO_STYLE_SHEET_IMPL_CID     \
-{ 0xa6f31472, 0xab69, 0x4beb, \
-  { 0x86, 0x0f, 0xc2, 0x21, 0x43, 0x1e, 0xad, 0x77 } }
-
-
-class ServoStyleSheet : public StyleSheet
-{
-public:
-  ServoStyleSheet(css::SheetParsingMode aParsingMode,
-                  CORSMode aCORSMode,
-                  net::ReferrerPolicy aReferrerPolicy,
-                  const dom::SRIMetadata& aIntegrity);
-
-  already_AddRefed<ServoStyleSheet> CreateEmptyChildSheet(
-      already_AddRefed<dom::MediaList> aMediaList) const;
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoStyleSheet, StyleSheet)
-
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_SERVO_STYLE_SHEET_IMPL_CID)
-
-  bool HasRules() const;
-
-  // Parses a stylesheet. The aLoadData argument corresponds to the
-  // SheetLoadData for this stylesheet. It may be null in some cases.
-  RefPtr<StyleSheetParsePromise>
-  ParseSheet(css::Loader* aLoader,
-             const nsACString& aBytes,
-             css::SheetLoadData* aLoadData);
-
-  // Common code that needs to be called after servo finishes parsing. This is
-  // shared between the parallel and sequential paths.
-  void FinishAsyncParse(already_AddRefed<RawServoStyleSheetContents> aSheetContents);
-
-  // Similar to the above, but guarantees that parsing will be performed
-  // synchronously.
-  void
-  ParseSheetSync(css::Loader* aLoader,
-                 const nsACString& aBytes,
-                 css::SheetLoadData* aLoadData,
-                 uint32_t aLineNumber,
-                 css::LoaderReusableStyleSheets* aReusableSheets = nullptr);
-
-  nsresult ReparseSheet(const nsAString& aInput);
-
-  const RawServoStyleSheetContents* RawContents() const {
-    return Inner()->mContents;
-  }
-
-  void SetContentsForImport(const RawServoStyleSheetContents* aContents) {
-    MOZ_ASSERT(!Inner()->mContents);
-    Inner()->mContents = aContents;
-  }
-
-  URLExtraData* URLData() const { return Inner()->mURLData; }
-
-  void DidDirty() override {}
-
-  already_AddRefed<StyleSheet> Clone(StyleSheet* aCloneParent,
-    dom::CSSImportRule* aCloneOwnerRule,
-    nsIDocument* aCloneDocument,
-    nsINode* aCloneOwningNode) const final;
-
-  // nsICSSLoaderObserver interface
-  NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate,
-                              nsresult aStatus) final;
-
-  // Internal GetCssRules methods which do not have security check and
-  // completeness check.
-  ServoCSSRuleList* GetCssRulesInternal();
-
-  // Returns the stylesheet's Servo origin as an OriginFlags value.
-  OriginFlags GetOrigin();
-
-protected:
-  virtual ~ServoStyleSheet();
-
-  void LastRelease();
-
-  ServoStyleSheetInner* Inner() const
-  {
-    return static_cast<ServoStyleSheetInner*>(mInner);
-  }
-
-  // Internal methods which do not have security check and completeness check.
-  uint32_t InsertRuleInternal(const nsAString& aRule,
-                              uint32_t aIndex, ErrorResult& aRv);
-  void DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv);
-  nsresult InsertRuleIntoGroupInternal(const nsAString& aRule,
-                                       css::GroupRule* aGroup,
-                                       uint32_t aIndex);
-
-  void EnabledStateChangedInternal() {}
-
-  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
-
-private:
-  ServoStyleSheet(const ServoStyleSheet& aCopy,
-                  ServoStyleSheet* aParentToUse,
-                  dom::CSSImportRule* aOwnerRuleToUse,
-                  nsIDocument* aDocumentToUse,
-                  nsINode* aOwningNodeToUse);
-
-  // Common tail routine for the synchronous and asynchronous parsing paths.
-  void FinishParse();
-
-  void DropRuleList();
-
-  // Take the recently cloned sheets from the `@import` rules, and reparent them
-  // correctly to `aPrimarySheet`.
-  void BuildChildListAfterInnerClone();
-
-  RefPtr<ServoCSSRuleList> mRuleList;
-
-  MozPromiseHolder<StyleSheetParsePromise> mParsePromise;
-
-  friend class StyleSheet;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(ServoStyleSheet, NS_SERVO_STYLE_SHEET_IMPL_CID)
+typedef StyleSheet ServoStyleSheet;
 
 } // namespace mozilla
 
 #endif // mozilla_ServoStyleSheet_h
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -19,27 +19,31 @@
 #include "mozilla/ServoStyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 
 #include "mozAutoDocUpdate.h"
 #include "NullPrincipal.h"
 
 namespace mozilla {
 
-StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode)
+StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode,
+                       CORSMode aCORSMode,
+                       net::ReferrerPolicy aReferrerPolicy,
+                       const dom::SRIMetadata& aIntegrity)
   : mParent(nullptr)
   , mDocument(nullptr)
   , mOwningNode(nullptr)
   , mOwnerRule(nullptr)
   , mParsingMode(aParsingMode)
   , mDisabled(false)
   , mDirtyFlags(0)
   , mDocumentAssociationMode(NotOwnedByDocument)
-  , mInner(nullptr)
+  , mInner(new StyleSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity, aParsingMode))
 {
+  mInner->AddSheet(this);
 }
 
 StyleSheet::StyleSheet(const StyleSheet& aCopy,
                        StyleSheet* aParentToUse,
                        dom::CSSImportRule* aOwnerRuleToUse,
                        nsIDocument* aDocumentToUse,
                        nsINode* aOwningNodeToUse)
   : mParent(aParentToUse)
@@ -53,41 +57,54 @@ StyleSheet::StyleSheet(const StyleSheet&
   // We only use this constructor during cloning.  It's the cloner's
   // responsibility to notify us if we end up being owned by a document.
   , mDocumentAssociationMode(NotOwnedByDocument)
   , mInner(aCopy.mInner) // Shallow copy, but concrete subclasses will fix up.
 {
   MOZ_ASSERT(mInner, "Should only copy StyleSheets with an mInner.");
   mInner->AddSheet(this);
 
+  if (HasForcedUniqueInner()) { // CSSOM's been there, force full copy now
+    NS_ASSERTION(mInner->mComplete,
+                 "Why have rules been accessed on an incomplete sheet?");
+    // FIXME: handle failure?
+    EnsureUniqueInner();
+  }
+
   if (aCopy.mMedia) {
     // XXX This is wrong; we should be keeping @import rules and
     // sheets in sync!
     mMedia = aCopy.mMedia->Clone();
   }
 }
 
 StyleSheet::~StyleSheet()
 {
   MOZ_ASSERT(!mInner, "Inner should have been dropped in LastRelease");
 }
 
+bool
+StyleSheet::HasRules() const
+{
+  return Servo_StyleSheet_HasRules(Inner()->mContents);
+}
+
 void
 StyleSheet::LastRelease()
 {
   MOZ_ASSERT(mInner, "Should have an mInner at time of destruction.");
   MOZ_ASSERT(mInner->mSheets.Contains(this), "Our mInner should include us.");
 
   UnparentChildren();
-  AsServo()->LastRelease();
 
   mInner->RemoveSheet(this);
   mInner = nullptr;
 
   DropMedia();
+  DropRuleList();
 }
 
 void
 StyleSheet::UnlinkInner()
 {
   // We can only have a cycle through our inner if we have a unique inner,
   // because otherwise there are no JS wrappers for anything in the inner.
   if (mInner->mSheets.Length() != 1) {
@@ -153,22 +170,24 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(StyleShe
 // it with us, even though there is only one such sheet and we're about to go
 // away.  This situation arises easily with sheet preloading.
 NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(StyleSheet, LastRelease())
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(StyleSheet)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(StyleSheet)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMedia)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRuleList)
   tmp->TraverseInner(cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(StyleSheet)
   tmp->DropMedia();
   tmp->UnlinkInner();
+  tmp->DropRuleList();
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(StyleSheet)
 
 mozilla::dom::CSSStyleSheetParsingMode
 StyleSheet::ParsingModeDOM()
 {
@@ -227,55 +246,81 @@ StyleSheet::SetEnabled(bool aEnabled)
   if (IsComplete() && oldDisabled != mDisabled) {
     EnabledStateChanged();
     ApplicableStateChanged(!mDisabled);
   }
 }
 
 StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
                                ReferrerPolicy aReferrerPolicy,
-                               const dom::SRIMetadata& aIntegrity)
+                               const SRIMetadata& aIntegrity,
+                               css::SheetParsingMode aParsingMode)
   : mPrincipal(NullPrincipal::CreateWithoutOriginAttributes())
   , mCORSMode(aCORSMode)
   , mReferrerPolicy(aReferrerPolicy)
   , mIntegrity(aIntegrity)
   , mComplete(false)
+  , mContents(Servo_StyleSheet_Empty(aParsingMode).Consume())
+  , mURLData(URLExtraData::Dummy())
 #ifdef DEBUG
   , mPrincipalSet(false)
 #endif
 {
   if (!mPrincipal) {
     MOZ_CRASH("NullPrincipal::Init failed");
   }
+  MOZ_COUNT_CTOR(StyleSheetInfo);
 }
 
-StyleSheetInfo::StyleSheetInfo(StyleSheetInfo& aCopy,
-                               StyleSheet* aPrimarySheet)
+StyleSheetInfo::StyleSheetInfo(StyleSheetInfo& aCopy, StyleSheet* aPrimarySheet)
   : mSheetURI(aCopy.mSheetURI)
   , mOriginalSheetURI(aCopy.mOriginalSheetURI)
   , mBaseURI(aCopy.mBaseURI)
   , mPrincipal(aCopy.mPrincipal)
   , mCORSMode(aCopy.mCORSMode)
   , mReferrerPolicy(aCopy.mReferrerPolicy)
   , mIntegrity(aCopy.mIntegrity)
   , mComplete(aCopy.mComplete)
   , mFirstChild()  // We don't rebuild the child because we're making a copy
                    // without children.
   , mSourceMapURL(aCopy.mSourceMapURL)
   , mSourceMapURLFromComment(aCopy.mSourceMapURLFromComment)
   , mSourceURL(aCopy.mSourceURL)
+  , mContents(Servo_StyleSheet_Clone(aCopy.mContents.get(), aPrimarySheet).Consume())
+  , mURLData(aCopy.mURLData)
 #ifdef DEBUG
   , mPrincipalSet(aCopy.mPrincipalSet)
 #endif
 {
   AddSheet(aPrimarySheet);
+
+  // Our child list is fixed up by our parent.
+  MOZ_COUNT_CTOR(StyleSheetInfo);
 }
 
 StyleSheetInfo::~StyleSheetInfo()
 {
+  MOZ_COUNT_DTOR(StyleSheetInfo);
+}
+
+StyleSheetInfo*
+StyleSheetInfo::CloneFor(StyleSheet* aPrimarySheet)
+{
+  return new StyleSheetInfo(*this, aPrimarySheet);
+}
+
+size_t
+StyleSheetInfo::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
+{
+  size_t n = aMallocSizeOf(this);
+  n += Servo_StyleSheet_SizeOfIncludingThis(
+      ServoStyleSheetMallocSizeOf,
+      ServoStyleSheetMallocEnclosingSizeOf,
+      mContents);
+  return n;
 }
 
 void
 StyleSheetInfo::AddSheet(StyleSheet* aSheet)
 {
   mSheets.AppendElement(aSheet);
 }
 
@@ -388,17 +433,17 @@ StyleSheet::EnsureUniqueInner()
   StyleSheetInfo* clone = mInner->CloneFor(this);
   MOZ_ASSERT(clone);
   mInner->RemoveSheet(this);
   mInner = clone;
 
   // Fixup the child lists and parent links in the Servo sheet. This is done
   // here instead of in StyleSheetInner::CloneFor, because it's just more
   // convenient to do so instead.
-  AsServo()->BuildChildListAfterInnerClone();
+  BuildChildListAfterInnerClone();
 
   // let our containing style sets know that if we call
   // nsPresContext::EnsureSafeToHandOutCSSRules we will need to restyle the
   // document
   for (ServoStyleSet* setHandle : mStyleSets) {
     setHandle->SetNeedsRestyleAfterEnsureUniqueInner();
   }
 }
@@ -620,22 +665,16 @@ StyleSheet::FindOwningWindowInnerID() co
 
   if (windowID == 0 && mParent) {
     windowID = mParent->FindOwningWindowInnerID();
   }
 
   return windowID;
 }
 
-void
-StyleSheet::EnabledStateChanged()
-{
-  FORWARD_INTERNAL(EnabledStateChangedInternal, ())
-}
-
 #undef FORWARD_INTERNAL
 
 void
 StyleSheet::UnparentChildren()
 {
   // XXXbz this is a little bogus; see the XXX comment where we
   // declare mFirstChild in StyleSheetInfo.
   for (StyleSheet* child = GetFirstChild();
@@ -768,21 +807,30 @@ StyleSheet::PrependStyleSheetSilently(St
 size_t
 StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = 0;
   const StyleSheet* s = this;
   while (s) {
     n += aMallocSizeOf(s);
 
+    // See the comment in CSSStyleSheet::SizeOfIncludingThis() for an
+    // explanation of this.
+    //
+    // FIXME(emilio): This comment is gone, someone should go find it.
+    if (s->Inner()->mSheets.LastElement() == s) {
+      n += s->Inner()->SizeOfIncludingThis(aMallocSizeOf);
+    }
+
     // Measurement of the following members may be added later if DMD finds it
     // is worthwhile:
     // - s->mTitle
     // - s->mMedia
     // - s->mStyleSets
+    // - s->mRuleList
 
     s = s->mNext;
   }
   return n;
 }
 
 #ifdef DEBUG
 void
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -4,68 +4,133 @@
  * 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/. */
 
 #ifndef mozilla_StyleSheet_h
 #define mozilla_StyleSheet_h
 
 #include "mozilla/css/SheetParsingMode.h"
 #include "mozilla/dom/CSSStyleSheetBinding.h"
+#include "mozilla/dom/SRIMetadata.h"
 #include "mozilla/net/ReferrerPolicy.h"
 #include "mozilla/CORSMode.h"
+#include "mozilla/MozPromise.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "mozilla/ServoUtils.h"
+#include "mozilla/StyleSheetInfo.h"
+#include "mozilla/URLExtraData.h"
 #include "nsICSSLoaderObserver.h"
 #include "nsWrapperCache.h"
-#include "StyleSheetInfo.h"
+#include "nsCompatibility.h"
+#include "nsStringFwd.h"
 
 class nsIDocument;
 class nsINode;
 class nsIPrincipal;
-class nsCSSRuleProcessor;
 
 namespace mozilla {
 
-class CSSStyleSheet;
+class ServoCSSRuleList;
 class ServoStyleSet;
-class ServoStyleSheet;
-struct StyleSheetInfo;
-struct CSSStyleSheetInner;
+
+typedef MozPromise</* Dummy */ bool,
+                   /* Dummy */ bool,
+                   /* IsExclusive = */ true> StyleSheetParsePromise;
+
+namespace css {
+class GroupRule;
+class Loader;
+class LoaderReusableStyleSheets;
+class Rule;
+class SheetLoadData;
+}
 
 namespace dom {
 class CSSImportRule;
 class CSSRuleList;
 class MediaList;
 class ShadowRoot;
 class SRIMetadata;
 } // namespace dom
 
-namespace css {
-class GroupRule;
-class Rule;
-}
-
-/**
- * Superclass for data common to CSSStyleSheet and ServoStyleSheet.
- */
-class StyleSheet : public nsICSSLoaderObserver
-                 , public nsWrapperCache
+class StyleSheet final : public nsICSSLoaderObserver
+                       , public nsWrapperCache
 {
-protected:
-  explicit StyleSheet(css::SheetParsingMode aParsingMode);
   StyleSheet(const StyleSheet& aCopy,
              StyleSheet* aParentToUse,
              dom::CSSImportRule* aOwnerRuleToUse,
              nsIDocument* aDocumentToUse,
              nsINode* aOwningNodeToUse);
+
   virtual ~StyleSheet();
 
 public:
+  StyleSheet(css::SheetParsingMode aParsingMode,
+             CORSMode aCORSMode,
+             net::ReferrerPolicy aReferrerPolicy,
+             const dom::SRIMetadata& aIntegrity);
+
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StyleSheet)
 
+  already_AddRefed<StyleSheet> CreateEmptyChildSheet(
+      already_AddRefed<dom::MediaList> aMediaList) const;
+
+  bool HasRules() const;
+
+  // Parses a stylesheet. The aLoadData argument corresponds to the
+  // SheetLoadData for this stylesheet. It may be null in some cases.
+  RefPtr<StyleSheetParsePromise>
+  ParseSheet(css::Loader* aLoader,
+             const nsACString& aBytes,
+             css::SheetLoadData* aLoadData);
+
+  // Common code that needs to be called after servo finishes parsing. This is
+  // shared between the parallel and sequential paths.
+  void FinishAsyncParse(already_AddRefed<RawServoStyleSheetContents> aSheetContents);
+
+  // Similar to the above, but guarantees that parsing will be performed
+  // synchronously.
+  void
+  ParseSheetSync(css::Loader* aLoader,
+                 const nsACString& aBytes,
+                 css::SheetLoadData* aLoadData,
+                 uint32_t aLineNumber,
+                 css::LoaderReusableStyleSheets* aReusableSheets = nullptr);
+
+  nsresult ReparseSheet(const nsAString& aInput);
+
+  const RawServoStyleSheetContents* RawContents() const {
+    return Inner()->mContents;
+  }
+
+  void SetContentsForImport(const RawServoStyleSheetContents* aContents) {
+    MOZ_ASSERT(!Inner()->mContents);
+    Inner()->mContents = aContents;
+  }
+
+  URLExtraData* URLData() const { return Inner()->mURLData; }
+
+  // FIXME(emilio): Remove.
+  StyleSheet* AsServo() { return this; }
+  const StyleSheet* AsServo() const { return this; }
+  void DidDirty() {}
+
+  // nsICSSLoaderObserver interface
+  NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate,
+                              nsresult aStatus) final;
+
+  // Internal GetCssRules methods which do not have security check and
+  // completeness check.
+  ServoCSSRuleList* GetCssRulesInternal();
+
+  // Returns the stylesheet's Servo origin as an OriginFlags value.
+  OriginFlags GetOrigin();
+
   /**
    * The different changes that a stylesheet may go through.
    *
    * Used by the StyleSets in order to handle more efficiently some kinds of
    * changes.
    */
   enum class ChangeType {
     Added,
@@ -96,18 +161,16 @@ public:
    * its new applicable state if the state changes but WILL NOT call
    * BeginUpdate() or EndUpdate() on the document -- calling those is
    * the caller's responsibility.  This allows use of SetEnabled when
    * batched updates are desired.  If you want updates handled for
    * you, see SetDisabled().
    */
   void SetEnabled(bool aEnabled);
 
-  MOZ_DECL_STYLO_METHODS(CSSStyleSheet, ServoStyleSheet)
-
   // Whether the sheet is for an inline <style> element.
   inline bool IsInline() const;
 
   inline nsIURI* GetSheetURI() const;
   /* Get the URI this sheet was originally loaded from, if any.  Can
      return null */
   inline nsIURI* GetOriginalURI() const;
   inline nsIURI* GetBaseURI() const;
@@ -121,22 +184,21 @@ public:
 
   /**
    * Whether the sheet is applicable.  A sheet that is not applicable
    * should never be inserted into a style set.  A sheet may not be
    * applicable for a variety of reasons including being disabled and
    * being incomplete.
    */
   inline bool IsApplicable() const;
-  inline bool HasRules() const;
 
-  virtual already_AddRefed<StyleSheet> Clone(StyleSheet* aCloneParent,
-                                             dom::CSSImportRule* aCloneOwnerRule,
-                                             nsIDocument* aCloneDocument,
-                                             nsINode* aCloneOwningNode) const = 0;
+  already_AddRefed<StyleSheet> Clone(StyleSheet* aCloneParent,
+                                     dom::CSSImportRule* aCloneOwnerRule,
+                                     nsIDocument* aCloneDocument,
+                                     nsINode* aCloneOwningNode) const;
 
   bool HasForcedUniqueInner() const
   {
     return mDirtyFlags & FORCED_UNIQUE_INNER;
   }
 
   bool HasModifiedRules() const
   {
@@ -206,19 +268,19 @@ public:
 
   // Get this style sheet's CORS mode
   inline CORSMode GetCORSMode() const;
   // Get this style sheet's Referrer Policy
   inline net::ReferrerPolicy GetReferrerPolicy() const;
   // Get this style sheet's integrity metadata
   inline void GetIntegrity(dom::SRIMetadata& aResult) const;
 
-  virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
+  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
 #ifdef DEBUG
-  virtual void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
+  void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
 #endif
 
   // WebIDL StyleSheet API
   void GetType(nsAString& aType);
   void GetHref(nsAString& aHref, ErrorResult& aRv);
   // GetOwnerNode is defined above.
   inline StyleSheet* GetParentStyleSheet() const;
   void GetTitle(nsAString& aTitle);
@@ -231,35 +293,32 @@ public:
   void GetSourceURL(nsAString& aSourceURL);
   void SetSourceURL(const nsAString& aSourceURL);
 
   // WebIDL CSSStyleSheet API
   // Can't be inline because we can't include ImportRule here.  And can't be
   // called GetOwnerRule because that would be ambiguous with the ImportRule
   // version.
   css::Rule* GetDOMOwnerRule() const;
-  dom::CSSRuleList* GetCssRules(nsIPrincipal& aSubjectPrincipal,
-                                ErrorResult& aRv);
+  dom::CSSRuleList* GetCssRules(nsIPrincipal& aSubjectPrincipal, ErrorResult&);
   uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,
                       nsIPrincipal& aSubjectPrincipal,
                       ErrorResult& aRv);
   void DeleteRule(uint32_t aIndex,
                   nsIPrincipal& aSubjectPrincipal,
                   ErrorResult& aRv);
 
   // WebIDL miscellaneous bits
   inline dom::ParentObject GetParentObject() const;
-  JSObject* WrapObject(JSContext* aCx,
-                       JS::Handle<JSObject*> aGivenProto) final;
+  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
   // Changes to sheets should be inside of a WillDirty-DidDirty pair.
   // However, the calls do not need to be matched; it's ok to call
   // WillDirty and then make no change and skip the DidDirty call.
   void WillDirty();
-  virtual void DidDirty() {}
 
   // Called when a rule changes from CSSOM.
   //
   // FIXME(emilio): This shouldn't allow null, but MediaList doesn't know about
   // it's owning media rule, plus it's used for the stylesheet media itself.
   void RuleChanged(css::Rule*);
 
   void AddStyleSet(ServoStyleSet* aStyleSet);
@@ -277,39 +336,61 @@ public:
     for (StyleSheet* child = GetFirstChild(); child; child = child->mNext) {
       aCallback(child);
     }
   }
 
 private:
   dom::ShadowRoot* GetContainingShadow() const;
 
+  StyleSheetInfo* Inner() { return mInner; }
+  const StyleSheetInfo* Inner() const { return mInner; }
+
   // Get a handle to the various stylesheet bits which live on the 'inner' for
   // gecko stylesheets and live on the StyleSheet for Servo stylesheets.
   inline StyleSheetInfo& SheetInfo();
   inline const StyleSheetInfo& SheetInfo() const;
 
   // Check if the rules are available for read and write.
   // It does the security check as well as whether the rules have been
   // completely loaded. aRv will have an exception set if this function
   // returns false.
-  bool AreRulesAvailable(nsIPrincipal& aSubjectPrincipal,
-                         ErrorResult& aRv);
+  bool AreRulesAvailable(nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv);
 
 protected:
+  // Internal methods which do not have security check and completeness check.
+  uint32_t InsertRuleInternal(const nsAString& aRule,
+                              uint32_t aIndex,
+                              ErrorResult&);
+  void DeleteRuleInternal(uint32_t aIndex, ErrorResult&);
+  nsresult InsertRuleIntoGroupInternal(const nsAString& aRule,
+                                       css::GroupRule* aGroup,
+                                       uint32_t aIndex);
+
+  // Common tail routine for the synchronous and asynchronous parsing paths.
+  void FinishParse();
+
+  // Take the recently cloned sheets from the `@import` rules, and reparent them
+  // correctly to `aPrimarySheet`.
+  void BuildChildListAfterInnerClone();
+
+  void DropRuleList();
+
   // Called when a rule is removed from the sheet from CSSOM.
   void RuleAdded(css::Rule&);
 
   // Called when a rule is added to the sheet from CSSOM.
   void RuleRemoved(css::Rule&);
 
   void ApplicableStateChanged(bool aApplicable);
 
   // Called from SetEnabled when the enabled state changed.
-  void EnabledStateChanged();
+  //
+  // FIXME(emilio): Remove.
+  void EnabledStateChanged() { };
 
   struct ChildSheetListBuilder {
     RefPtr<StyleSheet>* sheetSlot;
     StyleSheet* parent;
 
     void SetParentLinks(StyleSheet* aSheet);
 
     static void ReparentChildList(StyleSheet* aPrimarySheet,
@@ -325,68 +406,65 @@ protected:
   // UniversalXPConnect or if access is allowed by CORS.  In the latter case,
   // it will set the principal of the inner to the subject principal.
   void SubjectSubsumesInnerPrincipal(nsIPrincipal& aSubjectPrincipal,
                                      ErrorResult& aRv);
 
   // Drop our reference to mMedia
   void DropMedia();
 
-  // Unlink our inner, if needed, for cycle collection
-  virtual void UnlinkInner();
+  // Unlink our inner, if needed, for cycle collection.
+  void UnlinkInner();
   // Traverse our inner, if needed, for cycle collection
-  virtual void TraverseInner(nsCycleCollectionTraversalCallback &);
+  void TraverseInner(nsCycleCollectionTraversalCallback &);
 
   // Return whether the given @import rule has pending child sheet.
   static bool RuleHasPendingChildSheet(css::Rule* aRule);
 
-  StyleSheet*           mParent;    // weak ref
+  StyleSheet* mParent;    // weak ref
 
-  nsString              mTitle;
-  nsIDocument*          mDocument; // weak ref; parents maintain this for their children
-  nsINode*              mOwningNode; // weak ref
-  dom::CSSImportRule*   mOwnerRule; // weak ref
+  nsString mTitle;
+  nsIDocument* mDocument; // weak ref; parents maintain this for their children
+  nsINode* mOwningNode; // weak ref
+  dom::CSSImportRule* mOwnerRule; // weak ref
 
   RefPtr<dom::MediaList> mMedia;
 
   RefPtr<StyleSheet> mNext;
 
   // mParsingMode controls access to nonstandard style constructs that
   // are not safe for use on the public Web but necessary in UA sheets
   // and/or useful in user sheets.
   css::SheetParsingMode mParsingMode;
 
-  bool                  mDisabled;
+  bool mDisabled;
 
   enum dirtyFlagAttributes {
     FORCED_UNIQUE_INNER = 0x1,
     MODIFIED_RULES = 0x2,
   };
   uint8_t mDirtyFlags; // has been modified
 
   // mDocumentAssociationMode determines whether mDocument directly owns us (in
   // the sense that if it's known-live then we're known-live).  Always
   // NotOwnedByDocument when mDocument is null.
   DocumentAssociationMode mDocumentAssociationMode;
 
   // Core information we get from parsed sheets, which are shared amongst
   // StyleSheet clones.
+  //
+  // FIXME(emilio): Should be NonNull.
   StyleSheetInfo* mInner;
 
   nsTArray<ServoStyleSet*> mStyleSets;
 
-  friend class ::nsCSSRuleProcessor;
+  RefPtr<ServoCSSRuleList> mRuleList;
 
-  // Make CSSStyleSheet and ServoStyleSheet friends so they can access
-  // protected members of other StyleSheet objects (useful for iterating
-  // through children).
-  friend class mozilla::CSSStyleSheet;
-  friend class mozilla::ServoStyleSheet;
+  MozPromiseHolder<StyleSheetParsePromise> mParsePromise;
 
   // Make StyleSheetInfo and subclasses into friends so they can use
   // ChildSheetListBuilder.
   friend struct mozilla::StyleSheetInfo;
-  friend struct mozilla::CSSStyleSheetInner;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_StyleSheet_h
--- a/layout/style/StyleSheetInfo.h
+++ b/layout/style/StyleSheetInfo.h
@@ -2,51 +2,56 @@
 /* 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/. */
 
 #ifndef mozilla_StyleSheetInfo_h
 #define mozilla_StyleSheetInfo_h
 
+#include "mozilla/css/SheetParsingMode.h"
 #include "mozilla/dom/SRIMetadata.h"
 #include "mozilla/net/ReferrerPolicy.h"
 #include "mozilla/CORSMode.h"
 
 #include "nsIURI.h"
 
-namespace mozilla {
-class StyleSheet;
-} // namespace mozilla
 class nsCSSRuleProcessor;
 class nsIPrincipal;
 
 namespace mozilla {
+class StyleSheet;
 
 /**
  * Struct for data common to CSSStyleSheetInner and ServoStyleSheet.
  */
-struct StyleSheetInfo
+struct StyleSheetInfo final
 {
   typedef net::ReferrerPolicy ReferrerPolicy;
 
   StyleSheetInfo(CORSMode aCORSMode,
                  ReferrerPolicy aReferrerPolicy,
-                 const dom::SRIMetadata& aIntegrity);
+                 const dom::SRIMetadata& aIntegrity,
+                 css::SheetParsingMode aParsingMode);
 
-  StyleSheetInfo(StyleSheetInfo& aCopy,
-                 StyleSheet* aPrimarySheet);
+  // FIXME(emilio): aCopy should be const.
+  StyleSheetInfo(StyleSheetInfo& aCopy, StyleSheet* aPrimarySheet);
+
+
+  ~StyleSheetInfo();
 
-  virtual ~StyleSheetInfo();
+  StyleSheetInfo* CloneFor(StyleSheet* aPrimarySheet);
 
-  virtual StyleSheetInfo* CloneFor(StyleSheet* aPrimarySheet) = 0;
+  void AddSheet(StyleSheet* aSheet);
+  void RemoveSheet(StyleSheet* aSheet);
 
-  virtual void AddSheet(StyleSheet* aSheet);
-  virtual void RemoveSheet(StyleSheet* aSheet);
+  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
 
+  // FIXME(emilio): most of this struct should be const, then we can remove the
+  // duplication with the UrlExtraData member and such.
   nsCOMPtr<nsIURI>       mSheetURI; // for error reports, etc.
   nsCOMPtr<nsIURI>       mOriginalSheetURI;  // for GetHref.  Can be null.
   nsCOMPtr<nsIURI>       mBaseURI; // for resolving relative URIs
   nsCOMPtr<nsIPrincipal> mPrincipal;
   CORSMode               mCORSMode;
   // The Referrer Policy of a stylesheet is used for its child sheets, so it is
   // stored here.
   ReferrerPolicy         mReferrerPolicy;
@@ -69,16 +74,27 @@ struct StyleSheetInfo
   // comment in the style sheet.  This is separate from mSourceMapURL
   // so that the value does not overwrite any value that might have
   // come from a response header.
   nsString mSourceMapURLFromComment;
   // This stores any source URL that might have been seen in a comment
   // in the style sheet.
   nsString mSourceURL;
 
+  RefPtr<const RawServoStyleSheetContents> mContents;
+
+  // XXX We already have mSheetURI, mBaseURI, and mPrincipal.
+  //
+  // Can we somehow replace them with URLExtraData directly? The issue
+  // is currently URLExtraData is immutable, but URIs in StyleSheetInfo
+  // seems to be mutable, so we probably cannot set them altogether.
+  // Also, this is mostly a duplicate reference of the same url data
+  // inside RawServoStyleSheet. We may want to just use that instead.
+  RefPtr<URLExtraData> mURLData;
+
 #ifdef DEBUG
   bool                   mPrincipalSet;
 #endif
 };
 
 } // namespace mozilla
 
 #endif // mozilla_StyleSheetInfo_h
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -8,18 +8,16 @@
 #define mozilla_StyleSheetInlines_h
 
 #include "mozilla/StyleSheetInfo.h"
 #include "mozilla/ServoStyleSheet.h"
 #include "nsINode.h"
 
 namespace mozilla {
 
-MOZ_DEFINE_STYLO_METHODS(StyleSheet, CSSStyleSheet, ServoStyleSheet)
-
 StyleSheetInfo&
 StyleSheet::SheetInfo()
 {
   return *mInner;
 }
 
 const StyleSheetInfo&
 StyleSheet::SheetInfo() const
@@ -65,22 +63,16 @@ StyleSheet::SetURIs(nsIURI* aSheetURI, n
 }
 
 bool
 StyleSheet::IsApplicable() const
 {
   return !mDisabled && SheetInfo().mComplete;
 }
 
-bool
-StyleSheet::HasRules() const
-{
-  MOZ_STYLO_FORWARD(HasRules, ())
-}
-
 StyleSheet*
 StyleSheet::GetParentStyleSheet() const
 {
   return GetParentSheet();
 }
 
 dom::ParentObject
 StyleSheet::GetParentObject() const
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -4,17 +4,17 @@
 
 //! Data needed to style a Gecko document.
 
 use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
 use context::QuirksMode;
 use dom::TElement;
 use gecko_bindings::bindings::{self, RawServoStyleSet};
 use gecko_bindings::structs::{self, RawGeckoPresContextOwned, ServoStyleSetSizes, ServoStyleSheet};
-use gecko_bindings::structs::{ServoStyleSheetInner, StyleSheetInfo, nsIDocument};
+use gecko_bindings::structs::{StyleSheetInfo, nsIDocument};
 use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
 use invalidation::media_queries::{MediaListKey, ToMediaListKey};
 use malloc_size_of::MallocSizeOfOps;
 use media_queries::{Device, MediaList};
 use properties::ComputedValues;
 use selector_parser::SnapshotMap;
 use servo_arc::Arc;
 use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
@@ -49,19 +49,19 @@ impl GeckoStyleSheet {
         GeckoStyleSheet(s)
     }
 
     /// Get the raw `ServoStyleSheet` that we're wrapping.
     pub fn raw(&self) -> &ServoStyleSheet {
         unsafe { &*self.0 }
     }
 
-    fn inner(&self) -> &ServoStyleSheetInner {
+    fn inner(&self) -> &StyleSheetInfo {
         unsafe {
-            &*(self.raw()._base.mInner as *const StyleSheetInfo as *const ServoStyleSheetInner)
+            &*(self.raw().mInner as *const StyleSheetInfo)
         }
     }
 
     /// Gets the StylesheetContents for this stylesheet.
     pub fn contents(&self) -> &StylesheetContents {
         debug_assert!(!self.inner().mContents.mRawPtr.is_null());
         unsafe {
             let contents =
@@ -93,17 +93,17 @@ impl StylesheetInDocument for GeckoStyle
         self.contents().quirks_mode
     }
 
     fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
         use gecko_bindings::structs::mozilla::dom::MediaList as DomMediaList;
         use std::mem;
 
         unsafe {
-            let dom_media_list = self.raw()._base.mMedia.mRawPtr as *const DomMediaList;
+            let dom_media_list = self.raw().mMedia.mRawPtr as *const DomMediaList;
             if dom_media_list.is_null() {
                 return None;
             }
             let raw_list = &*(*dom_media_list).mRawList.mRawPtr;
             let list = Locked::<MediaList>::as_arc(mem::transmute(&raw_list));
             Some(list.read_with(guard))
         }
     }