Bug 1449400 part 5 - Remove StyleSetHandle. r=emilio
authorXidorn Quan <me@upsuper.org>
Thu, 29 Mar 2018 22:15:46 +1100
changeset 410603 c5dd20c8308843f48f4ff940b91b4c59f00c9d42
parent 410602 ed1fbd7316f4b5fedeadd9689623fb589dde460f
child 410604 a69be6eee5a3964e8b2465d9003039c6208931a6
push id61901
push userxquan@mozilla.com
push dateThu, 29 Mar 2018 11:19:10 +0000
treeherderautoland@c5dd20c83088 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1449400
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 1449400 part 5 - Remove StyleSetHandle. r=emilio This patch basically does: * remove StyleSetHandle and its corresponding files * revisit #includes of related header files and change correspondingly * change nsIPresShell::mStyleSet to be UniquePtr<ServoStyleSet> * change the creating path of ServoStyleSet to pass UniquePtr * change other mentions of StyleSetHandle to ServoStyleSet* * remove AsServo() calls on ServoStyleSet Some unfortunate bits: * some methods of (Servo)StyleSet only accepts ServoStyleSheet while many places call into the methods with StyleSheet, so there are many ->AsServo() added to sheets MozReview-Commit-ID: K4zYnuhOurA
chrome/nsChromeRegistry.cpp
dom/animation/KeyframeEffectReadOnly.cpp
dom/animation/KeyframeUtils.cpp
dom/base/ResponsiveImageSelector.cpp
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsIDocument.h
dom/canvas/CanvasRenderingContext2D.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/nsHTMLDocument.cpp
dom/smil/nsSMILCSSValueType.cpp
dom/xbl/nsBindingManager.cpp
dom/xbl/nsXBLPrototypeResources.cpp
dom/xbl/nsXBLResourceLoader.cpp
dom/xbl/nsXBLService.cpp
editor/libeditor/HTMLAnonymousNodeEditor.cpp
gfx/layers/apz/util/ActiveElementManager.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/RestyleManager.cpp
layout/base/ServoRestyleManager.cpp
layout/base/ServoRestyleManager.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsIDocumentViewerPrint.h
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsColorControlFrame.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsGfxButtonControlFrame.cpp
layout/forms/nsMeterFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsProgressFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsInlineFrame.cpp
layout/generic/nsTextFrame.cpp
layout/inspector/InspectorUtils.cpp
layout/mathml/nsMathMLFrame.cpp
layout/printing/nsPrintJob.cpp
layout/style/ComputedStyle.cpp
layout/style/ComputedStyle.h
layout/style/CounterStyleManager.cpp
layout/style/ServoMediaList.cpp
layout/style/ServoStyleSheet.cpp
layout/style/StyleAnimationValue.cpp
layout/style/StyleSetHandle.h
layout/style/StyleSetHandleInlines.h
layout/style/StyleSheet.cpp
layout/style/StyleSheet.h
layout/style/moz.build
layout/style/nsAnimationManager.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsStyleStructInlines.h
layout/tables/nsTableFrame.cpp
layout/xul/nsListBoxBodyFrame.cpp
layout/xul/nsSplitterFrame.cpp
layout/xul/tree/nsTreeStyleCache.cpp
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -34,16 +34,17 @@
 #include "nsIURIMutator.h"
 
 #include "unicode/uloc.h"
 
 nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
 
 // DO NOT use namespace mozilla; it'll break due to a naming conflict between
 // mozilla::TextRange and a TextRange in OSX headers.
+using mozilla::ServoStyleSheet;
 using mozilla::StyleSheet;
 using mozilla::dom::IsChromeURI;
 using mozilla::dom::Location;
 
 ////////////////////////////////////////////////////////////////////////////////
 
 void
 nsChromeRegistry::LogMessage(const char* aMsg, ...)
@@ -398,31 +399,32 @@ nsresult nsChromeRegistry::RefreshWindow
   nsCOMPtr<nsIDocument> document = aWindow->GetDoc();
   if (!document)
     return NS_OK;
 
   // Deal with the agent sheets first.  Have to do all the style sets by hand.
   nsCOMPtr<nsIPresShell> shell = document->GetShell();
   if (shell) {
     // Reload only the chrome URL agent style sheets.
-    nsTArray<RefPtr<StyleSheet>> agentSheets;
+    nsTArray<RefPtr<ServoStyleSheet>> agentSheets;
     rv = shell->GetAgentStyleSheets(agentSheets);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsTArray<RefPtr<StyleSheet>> newAgentSheets;
-    for (StyleSheet* sheet : agentSheets) {
+    nsTArray<RefPtr<ServoStyleSheet>> newAgentSheets;
+    for (ServoStyleSheet* sheet : agentSheets) {
       nsIURI* uri = sheet->GetSheetURI();
 
       if (IsChromeURI(uri)) {
         // Reload the sheet.
         RefPtr<StyleSheet> newSheet;
         rv = document->LoadChromeSheetSync(uri, true, &newSheet);
         if (NS_FAILED(rv)) return rv;
         if (newSheet) {
-          rv = newAgentSheets.AppendElement(newSheet) ? NS_OK : NS_ERROR_FAILURE;
+          rv = newAgentSheets.AppendElement(newSheet->AsServo())
+            ? NS_OK : NS_ERROR_FAILURE;
           if (NS_FAILED(rv)) return rv;
         }
       }
       else {  // Just use the same sheet.
         rv = newAgentSheets.AppendElement(sheet) ? NS_OK : NS_ERROR_FAILURE;
         if (NS_FAILED(rv)) return rv;
       }
     }
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -403,20 +403,18 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
   if (!hasAdditiveValues) {
     return;
   }
 
   if (!aBaseComputedStyle) {
     Element* animatingElement =
       EffectCompositor::GetElementToRestyle(mTarget->mElement,
                                             mTarget->mPseudoType);
-    aBaseComputedStyle =
-      aPresContext->StyleSet()->AsServo()->GetBaseContextForElement(
-          animatingElement,
-          aComputedStyle);
+    aBaseComputedStyle = aPresContext->StyleSet()->
+      GetBaseContextForElement(animatingElement, aComputedStyle);
   }
   RefPtr<RawServoAnimationValue> baseValue =
     Servo_ComputedValues_ExtractAnimationValue(aBaseComputedStyle,
                                                aProperty.mProperty).Consume();
   mBaseStyleValuesForServo.Put(aProperty.mProperty, baseValue);
 }
 
 void
@@ -1483,18 +1481,17 @@ KeyframeEffectReadOnly::CreateComputedSt
   nsCSSPropertyID aProperty,
   const AnimationValue& aValue,
   const ComputedStyle* aBaseComputedStyle)
 {
   MOZ_ASSERT(aBaseComputedStyle,
              "CreateComputedStyleForAnimationValue needs to be called "
              "with a valid ComputedStyle");
 
-  ServoStyleSet* styleSet =
-    aBaseComputedStyle->PresContext()->StyleSet()->AsServo();
+  ServoStyleSet* styleSet = aBaseComputedStyle->PresContext()->StyleSet();
   Element* elementForResolve =
     EffectCompositor::GetElementToRestyle(mTarget->mElement,
                                           mTarget->mPseudoType);
   MOZ_ASSERT(elementForResolve, "The target element shouldn't be null");
   return styleSet->ResolveServoStyleByAddingAnimation(elementForResolve,
                                                       aBaseComputedStyle,
                                                       aValue.mServo);
 }
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -925,18 +925,18 @@ GetComputedKeyframeValues(const nsTArray
   if (!presContext) {
     // This has been reported to happen with some combinations of content
     // (particularly involving resize events and layout flushes? See bug 1407898
     // and bug 1408420) but no reproducible steps have been found.
     // For now we just return an empty array.
     return result;
   }
 
-  result = presContext->StyleSet()->AsServo()
-    ->GetComputedKeyframeValuesFor(aKeyframes, aElement, aComputedStyle);
+  result = presContext->StyleSet()->
+    GetComputedKeyframeValuesFor(aKeyframes, aElement, aComputedStyle);
   return result;
 }
 
 static void
 AppendInitialSegment(AnimationProperty* aAnimationProperty,
                      const KeyframeValueEntry& aFirstEntry)
 {
   AnimationPropertySegment* segment =
--- a/dom/base/ResponsiveImageSelector.cpp
+++ b/dom/base/ResponsiveImageSelector.cpp
@@ -435,19 +435,18 @@ ResponsiveImageSelector::ComputeFinalWid
 {
   nsIDocument* doc = Document();
   nsIPresShell* presShell = doc->GetShell();
   nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
 
   if (!pctx) {
     return false;
   }
-  nscoord effectiveWidth =
-    presShell->StyleSet()->AsServo()->EvaluateSourceSizeList(
-      mServoSourceSizeList.get());
+  nscoord effectiveWidth = presShell->StyleSet()->
+    EvaluateSourceSizeList(mServoSourceSizeList.get());
 
   *aWidth = nsPresContext::AppUnitsToDoubleCSSPixels(std::max(effectiveWidth, 0));
   return true;
 }
 
 ResponsiveImageCandidate::ResponsiveImageCandidate()
 {
   mType = eCandidateType_Invalid;
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -241,18 +241,17 @@
 #include "nsIStructuredCloneContainer.h"
 #include "nsIMutableArray.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "nsWindowSizes.h"
 #include "mozilla/dom/Location.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "gfxPrefs.h"
 #include "nsISupportsPrimitives.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/TabGroup.h"
 #ifdef MOZ_XUL
 #include "mozilla/dom/ContainerBoxObject.h"
 #include "mozilla/dom/ListBoxObject.h"
@@ -2452,17 +2451,17 @@ nsIDocument::RemoveDocStyleSheetsFromSty
 {
   // The stylesheets should forget us
   for (StyleSheet* sheet : Reversed(mStyleSheets)) {
     sheet->ClearAssociatedDocument();
 
     if (sheet->IsApplicable()) {
       nsCOMPtr<nsIPresShell> shell = GetShell();
       if (shell) {
-        shell->StyleSet()->RemoveDocStyleSheet(sheet);
+        shell->StyleSet()->RemoveDocStyleSheet(sheet->AsServo());
       }
     }
     // XXX Tell observers?
   }
 }
 
 void
 nsIDocument::RemoveStyleSheetsFromStyleSets(
@@ -2471,17 +2470,17 @@ nsIDocument::RemoveStyleSheetsFromStyleS
 {
   // The stylesheets should forget us
   for (StyleSheet* sheet : Reversed(aSheets)) {
     sheet->ClearAssociatedDocument();
 
     if (sheet->IsApplicable()) {
       nsCOMPtr<nsIPresShell> shell = GetShell();
       if (shell) {
-        shell->StyleSet()->RemoveStyleSheet(aType, sheet);
+        shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsServo());
       }
     }
     // XXX Tell observers?
   }
 }
 
 void
 nsIDocument::ResetStylesheetsToURI(nsIURI* aURI)
@@ -2533,53 +2532,53 @@ nsIDocument::ResetStylesheetsToURI(nsIUR
   // Now set up our style sets
   nsCOMPtr<nsIPresShell> shell = GetShell();
   if (shell) {
     FillStyleSet(shell->StyleSet());
   }
 }
 
 static void
-AppendSheetsToStyleSet(StyleSetHandle aStyleSet,
+AppendSheetsToStyleSet(ServoStyleSet* aStyleSet,
                        const nsTArray<RefPtr<StyleSheet>>& aSheets,
                        SheetType aType)
 {
   for (StyleSheet* sheet : Reversed(aSheets)) {
-    aStyleSet->AppendStyleSheet(aType, sheet);
-  }
-}
-
-
-void
-nsIDocument::FillStyleSet(StyleSetHandle aStyleSet)
+    aStyleSet->AppendStyleSheet(aType, sheet->AsServo());
+  }
+}
+
+
+void
+nsIDocument::FillStyleSet(ServoStyleSet* aStyleSet)
 {
   NS_PRECONDITION(aStyleSet, "Must have a style set");
   NS_PRECONDITION(aStyleSet->SheetCount(SheetType::Doc) == 0,
                   "Style set already has document sheets?");
 
   MOZ_ASSERT(!mStyleSetFilled);
 
   for (StyleSheet* sheet : Reversed(mStyleSheets)) {
     if (sheet->IsApplicable()) {
-      aStyleSet->AddDocStyleSheet(sheet, this);
+      aStyleSet->AddDocStyleSheet(sheet->AsServo(), this);
     }
   }
 
   if (nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance()) {
     nsTArray<RefPtr<StyleSheet>>& sheets =
       *sheetService->AuthorStyleSheets();
     for (StyleSheet* sheet : sheets) {
-      aStyleSet->AppendStyleSheet(SheetType::Doc, sheet);
+      aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsServo());
     }
   }
 
   // Iterate backwards to maintain order
   for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
     if (sheet->IsApplicable()) {
-      aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      aStyleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
   }
 
   AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eAgentSheet],
                          SheetType::Agent);
   AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eUserSheet],
                          SheetType::User);
   AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eAuthorSheet],
@@ -3873,29 +3872,29 @@ AssertNoStaleServoDataIn(const nsINode& 
     }
   }
 #endif
 }
 
 already_AddRefed<nsIPresShell>
 nsIDocument::CreateShell(nsPresContext* aContext,
                          nsViewManager* aViewManager,
-                         StyleSetHandle aStyleSet)
+                         UniquePtr<ServoStyleSet> aStyleSet)
 {
   NS_ASSERTION(!mPresShell, "We have a presshell already!");
 
   NS_ENSURE_FALSE(GetBFCacheEntry(), nullptr);
 
-  FillStyleSet(aStyleSet);
+  FillStyleSet(aStyleSet.get());
   AssertNoStaleServoDataIn(static_cast<nsINode&>(*this));
 
   RefPtr<PresShell> shell = new PresShell;
   // Note: we don't hold a ref to the shell (it holds a ref to us)
   mPresShell = shell;
-  shell->Init(this, aContext, aViewManager, aStyleSet);
+  shell->Init(this, aContext, aViewManager, Move(aStyleSet));
 
   // Make sure to never paint if we belong to an invisible DocShell.
   nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
   if (docShell && docShell->IsInvisible())
     shell->SetNeverPainting(true);
 
   MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p with PressShell %p and DocShell %p",
                                                 this, shell.get(), docShell.get()));
@@ -4306,29 +4305,29 @@ nsIDocument::AddOnDemandBuiltInUASheet(S
   if (aSheet->IsApplicable()) {
     // This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
     nsCOMPtr<nsIPresShell> shell = GetShell();
     if (shell) {
       // Note that prepending here is necessary to make sure that html.css etc.
       // do not override Firefox OS/Mobile's content.css sheet. Maybe we should
       // have an insertion point to match the order of
       // nsDocumentViewer::CreateStyleSet though?
-      shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet);
+      shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet->AsServo());
     }
   }
 
   NotifyStyleSheetAdded(aSheet, false);
 }
 
 void
 nsIDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
 {
   nsCOMPtr<nsIPresShell> shell = GetShell();
   if (shell) {
-    shell->StyleSet()->AddDocStyleSheet(aSheet, this);
+    shell->StyleSet()->AddDocStyleSheet(aSheet->AsServo(), this);
   }
 }
 
 #define DO_STYLESHEET_NOTIFICATION(className, type, memberName, argName)      \
   do {                                                                        \
     className##Init init;                                                     \
     init.mBubbles = true;                                                     \
     init.mCancelable = true;                                                  \
@@ -4385,17 +4384,17 @@ nsIDocument::AddStyleSheet(StyleSheet* a
   NotifyStyleSheetAdded(aSheet, true);
 }
 
 void
 nsIDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
 {
   nsCOMPtr<nsIPresShell> shell = GetShell();
   if (shell) {
-    shell->StyleSet()->RemoveDocStyleSheet(aSheet);
+    shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsServo());
   }
 }
 
 void
 nsIDocument::RemoveStyleSheet(StyleSheet* aSheet)
 {
   NS_PRECONDITION(aSheet, "null arg");
   RefPtr<StyleSheet> sheet = aSheet; // hold ref so it won't die too soon
@@ -4606,17 +4605,17 @@ nsIDocument::AddAdditionalStyleSheet(add
     return NS_ERROR_INVALID_ARG;
 
   mAdditionalSheets[aType].AppendElement(aSheet);
 
   BeginUpdate(UPDATE_STYLE);
   nsCOMPtr<nsIPresShell> shell = GetShell();
   if (shell) {
     SheetType type = ConvertAdditionalSheetType(aType);
-    shell->StyleSet()->AppendStyleSheet(type, aSheet);
+    shell->StyleSet()->AppendStyleSheet(type, aSheet->AsServo());
   }
 
   // Passing false, so documet.styleSheets.length will not be affected by
   // these additional sheets.
   NotifyStyleSheetAdded(aSheet, false);
   EndUpdate(UPDATE_STYLE);
   return NS_OK;
 }
@@ -4634,17 +4633,17 @@ nsIDocument::RemoveAdditionalStyleSheet(
     sheets.RemoveElementAt(i);
 
     BeginUpdate(UPDATE_STYLE);
     if (!mIsGoingAway) {
       MOZ_ASSERT(sheetRef->IsApplicable());
       nsCOMPtr<nsIPresShell> shell = GetShell();
       if (shell) {
         SheetType type = ConvertAdditionalSheetType(aType);
-        shell->StyleSet()->RemoveStyleSheet(type, sheetRef);
+        shell->StyleSet()->RemoveStyleSheet(type, sheetRef->AsServo());
       }
     }
 
     // Passing false, so documet.styleSheets.length will not be affected by
     // these additional sheets.
     NotifyStyleSheetRemoved(sheetRef, false);
     EndUpdate(UPDATE_STYLE);
 
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -36,17 +36,16 @@
 #include "nsIRequest.h"
 #include "nsILoadGroup.h"
 #include "nsTObserverArray.h"
 #include "nsStubMutationObserver.h"
 #include "nsIChannel.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsContentList.h"
 #include "nsGkAtoms.h"
-#include "mozilla/StyleSetHandle.h"
 #include "PLDHashTable.h"
 #include "nsDOMAttributeMap.h"
 #include "imgIRequest.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/PendingAnimationTracker.h"
 #include "mozilla/dom/BoxObject.h"
 #include "mozilla/dom/DOMImplementation.h"
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -125,17 +125,17 @@ struct nsCSSSelectorList;
 namespace mozilla {
 class AbstractThread;
 class CSSStyleSheet;
 class Encoding;
 class ErrorResult;
 class EventStates;
 class EventListenerManager;
 class PendingAnimationTracker;
-class StyleSetHandle;
+class ServoStyleSet;
 template<typename> class OwningNonNull;
 struct URLExtraData;
 
 namespace css {
 class Loader;
 class ImageLoader;
 class Rule;
 } // namespace css
@@ -1176,19 +1176,20 @@ public:
 
   /**
    * Create a new presentation shell that will use aContext for its
    * presentation context (presentation contexts <b>must not</b> be
    * shared among multiple presentation shells). The caller of this
    * method is responsible for calling BeginObservingDocument() on the
    * presshell if the presshell should observe document mutations.
    */
-  already_AddRefed<nsIPresShell> CreateShell(nsPresContext* aContext,
-                                             nsViewManager* aViewManager,
-                                             mozilla::StyleSetHandle aStyleSet);
+  already_AddRefed<nsIPresShell> CreateShell(
+    nsPresContext* aContext,
+    nsViewManager* aViewManager,
+    mozilla::UniquePtr<mozilla::ServoStyleSet> aStyleSet);
   void DeleteShell();
 
   nsIPresShell* GetShell() const
   {
     return GetBFCacheEntry() ? nullptr : mPresShell;
   }
 
   nsIPresShell* GetObservingShell() const
@@ -3710,17 +3711,17 @@ protected:
   void UpdateDocumentStates(mozilla::EventStates);
 
   void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet);
   void RemoveDocStyleSheetsFromStyleSets();
   void RemoveStyleSheetsFromStyleSets(
       const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
       mozilla::SheetType aType);
   void ResetStylesheetsToURI(nsIURI* aURI);
-  void FillStyleSet(mozilla::StyleSetHandle aStyleSet);
+  void FillStyleSet(mozilla::ServoStyleSet* aStyleSet);
   void AddStyleSheetToStyleSets(mozilla::StyleSheet* aSheet);
   void RemoveStyleSheetFromStyleSets(mozilla::StyleSheet* aSheet);
   void NotifyStyleSheetAdded(mozilla::StyleSheet* aSheet, bool aDocumentSheet);
   void NotifyStyleSheetRemoved(mozilla::StyleSheet* aSheet, bool aDocumentSheet);
   void NotifyStyleSheetApplicableStateChanged();
   // Just like EnableStyleSheetsForSet, but doesn't check whether
   // aSheetSet is null and allows the caller to control whether to set
   // aSheetSet as the preferred set in the CSSLoader.
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -114,18 +114,17 @@
 #include "nsIScreenManager.h"
 #include "nsFilterInstance.h"
 #include "nsSVGLength2.h"
 #include "nsDeviceContext.h"
 #include "nsFontMetrics.h"
 #include "Units.h"
 #include "CanvasUtils.h"
 #include "mozilla/CycleCollectedJSRuntime.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/layers/CanvasClient.h"
 #include "mozilla/layers/WebRenderUserData.h"
 #include "mozilla/layers/WebRenderCanvasRenderer.h"
 #include "mozilla/ServoCSSParser.h"
 
 #undef free // apparently defined by some windows header, clashing with a free()
             // method in SkTypes.h
 #include "SkiaGLGlue.h"
@@ -738,33 +737,22 @@ CanvasPattern::SetTransform(SVGMatrix& a
 void
 CanvasGradient::AddColorStop(float aOffset, const nsAString& aColorstr, ErrorResult& aRv)
 {
   if (aOffset < 0.0 || aOffset > 1.0) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
+  nsIPresShell* shell = mContext ? mContext->GetPresShell() : nullptr;
+  ServoStyleSet* styleSet = shell ? shell->StyleSet() : nullptr;
+
   nscolor color;
-  bool ok;
-
-  nsIPresShell* shell = mContext ? mContext->GetPresShell() : nullptr;
-  ServoStyleSet* servoStyleSet = shell && shell->StyleSet()
-    ? shell->StyleSet()->GetAsServo()
-    : nullptr;
-
-  bool useServoParser =
-    true;
-
-  if (useServoParser) {
-    ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColorstr,
-                                      &color);
-  } else {
-    MOZ_CRASH("old style system disabled");
-  }
+  bool ok = ServoCSSParser::ComputeColor(styleSet, NS_RGB(0, 0, 0),
+                                         aColorstr, &color);
 
   if (!ok) {
     aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     return;
   }
 
   mStops = nullptr;
 
@@ -1153,44 +1141,37 @@ CanvasRenderingContext2D::WrapObject(JSC
 
 bool
 CanvasRenderingContext2D::ParseColor(const nsAString& aString,
                                      nscolor* aColor)
 {
   nsIDocument* document = mCanvasElement ? mCanvasElement->OwnerDoc() : nullptr;
   css::Loader* loader = document ? document->CSSLoader() : nullptr;
 
-  bool useServoParser =
-    true;
-
-  if (useServoParser) {
-    nsIPresShell* presShell = GetPresShell();
-    ServoStyleSet* set = presShell ? presShell->StyleSet()->AsServo() : nullptr;
-
-    // First, try computing the color without handling currentcolor.
-    bool wasCurrentColor = false;
-    if (!ServoCSSParser::ComputeColor(set, NS_RGB(0, 0, 0), aString, aColor,
-                                      &wasCurrentColor, loader)) {
-      return false;
+  nsIPresShell* presShell = GetPresShell();
+  ServoStyleSet* set = presShell ? presShell->StyleSet() : nullptr;
+
+  // First, try computing the color without handling currentcolor.
+  bool wasCurrentColor = false;
+  if (!ServoCSSParser::ComputeColor(set, NS_RGB(0, 0, 0), aString, aColor,
+                                    &wasCurrentColor, loader)) {
+    return false;
+  }
+
+  if (wasCurrentColor && mCanvasElement) {
+    // Otherwise, get the value of the color property, flushing style
+    // if necessary.
+    RefPtr<ComputedStyle> canvasStyle =
+      nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
+    if (canvasStyle) {
+      *aColor = canvasStyle->StyleColor()->mColor;
     }
-
-    if (wasCurrentColor && mCanvasElement) {
-      // Otherwise, get the value of the color property, flushing style
-      // if necessary.
-      RefPtr<ComputedStyle> canvasStyle =
-        nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
-      if (canvasStyle) {
-        *aColor = canvasStyle->StyleColor()->mColor;
-      }
-      // Beware that the presShell could be gone here.
-    }
-    return true;
-  }
-
-  MOZ_CRASH("old style system disabled");
+    // Beware that the presShell could be gone here.
+  }
+  return true;
 }
 
 nsresult
 CanvasRenderingContext2D::Reset()
 {
   if (mCanvasElement) {
     mCanvasElement->InvalidateCanvas();
   }
@@ -2699,17 +2680,17 @@ GetFontStyleForServo(Element* aElement, 
   // In addition to unparseable values, the spec says we need to reject
   // 'inherit' and 'initial'. The easiest way to check for this is to look
   // at font-size-adjust, which the font shorthand resets to 'none'.
   if (Servo_DeclarationBlock_HasCSSWideKeyword(declarations,
                                                eCSSProperty_font_size_adjust)) {
     return nullptr;
   }
 
-  ServoStyleSet* styleSet = aPresShell->StyleSet()->AsServo();
+  ServoStyleSet* styleSet = aPresShell->StyleSet();
 
   RefPtr<ComputedStyle> parentStyle;
   // have to get a parent ComputedStyle for inherit-like relative
   // values (2em, bolder, etc.)
   if (aElement && aElement->IsInComposedDoc()) {
     parentStyle = nsComputedDOMStyle::GetComputedStyle(aElement, nullptr);
     if (!parentStyle) {
       // The flush killed the shell, so we couldn't get any meaningful style
@@ -2718,17 +2699,17 @@ GetFontStyleForServo(Element* aElement, 
       return nullptr;
     }
   } else {
     RefPtr<RawServoDeclarationBlock> declarations =
       CreateFontDeclarationForServo(NS_LITERAL_STRING("10px sans-serif"),
                                     aPresShell->GetDocument());
     MOZ_ASSERT(declarations);
 
-    parentStyle = aPresShell->StyleSet()->AsServo()->
+    parentStyle = aPresShell->StyleSet()->
       ResolveForDeclarations(nullptr, declarations);
   }
 
   MOZ_RELEASE_ASSERT(parentStyle, "Should have a valid parent style");
 
   MOZ_ASSERT(!aPresShell->IsDestroying(),
              "We should have returned an error above if the presshell is "
              "being destroyed.");
@@ -2767,17 +2748,17 @@ ResolveFilterStyleForServo(const nsAStri
 
   // In addition to unparseable values, the spec says we need to reject
   // 'inherit' and 'initial'.
   if (Servo_DeclarationBlock_HasCSSWideKeyword(declarations,
                                                eCSSProperty_filter)) {
     return nullptr;
   }
 
-  ServoStyleSet* styleSet = aPresShell->StyleSet()->AsServo();
+  ServoStyleSet* styleSet = aPresShell->StyleSet();
   RefPtr<ComputedStyle> computedValues =
     styleSet->ResolveForDeclarations(aParentStyle, declarations);
 
   return computedValues.forget();
 }
 
 bool
 CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -94,18 +94,16 @@
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/dom/TouchEvent.h"
 #include "mozilla/ErrorResult.h"
 #include "nsHTMLDocument.h"
 #include "nsGlobalWindow.h"
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "imgIContainer.h"
 #include "nsComputedDOMStyle.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "ReferrerPolicy.h"
 #include "mozilla/dom/HTMLLabelElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_ADDREF_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase)
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -2252,17 +2252,17 @@ nsHTMLDocument::TearingDownEditor()
   if (IsEditingOn()) {
     EditingState oldState = mEditingState;
     mEditingState = eTearingDown;
 
     nsCOMPtr<nsIPresShell> presShell = GetShell();
     if (!presShell)
       return;
 
-    nsTArray<RefPtr<StyleSheet>> agentSheets;
+    nsTArray<RefPtr<ServoStyleSheet>> agentSheets;
     presShell->GetAgentStyleSheets(agentSheets);
 
     auto cache = nsLayoutStylesheetCache::Singleton();
 
     agentSheets.RemoveElement(cache->ContentEditableSheet());
     if (oldState == eDesignMode)
       agentSheets.RemoveElement(cache->DesignModeSheet());
 
@@ -2397,44 +2397,45 @@ nsHTMLDocument::EditingStateChanged()
     nsAutoEditingState push(this, eSettingUp);
 
     nsCOMPtr<nsIPresShell> presShell = GetShell();
     NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
     // Before making this window editable, we need to modify UA style sheet
     // because new style may change whether focused element will be focusable
     // or not.
-    nsTArray<RefPtr<StyleSheet>> agentSheets;
+    nsTArray<RefPtr<ServoStyleSheet>> agentSheets;
     rv = presShell->GetAgentStyleSheets(agentSheets);
     NS_ENSURE_SUCCESS(rv, rv);
 
     auto cache = nsLayoutStylesheetCache::Singleton();
 
-    StyleSheet* contentEditableSheet = cache->ContentEditableSheet();
+    ServoStyleSheet* contentEditableSheet =
+      cache->ContentEditableSheet()->AsServo();
 
     if (!agentSheets.Contains(contentEditableSheet)) {
       agentSheets.AppendElement(contentEditableSheet);
     }
 
     // Should we update the editable state of all the nodes in the document? We
     // need to do this when the designMode value changes, as that overrides
     // specific states on the elements.
     if (designMode) {
       // designMode is being turned on (overrides contentEditable).
-      StyleSheet* designModeSheet = cache->DesignModeSheet();
+      ServoStyleSheet* designModeSheet = cache->DesignModeSheet()->AsServo();
       if (!agentSheets.Contains(designModeSheet)) {
         agentSheets.AppendElement(designModeSheet);
       }
 
       updateState = true;
       spellRecheckAll = oldState == eContentEditable;
     }
     else if (oldState == eDesignMode) {
       // designMode is being turned off (contentEditable is still on).
-      agentSheets.RemoveElement(cache->DesignModeSheet());
+      agentSheets.RemoveElement(cache->DesignModeSheet()->AsServo());
       updateState = true;
     }
 
     rv = presShell->SetAgentStyleSheets(agentSheets);
     NS_ENSURE_SUCCESS(rv, rv);
 
     presShell->RestyleForCSSRuleChanges();
 
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -14,17 +14,17 @@
 #include "nsSMILValue.h"
 #include "nsCSSProps.h"
 #include "nsCSSValue.h"
 #include "nsColor.h"
 #include "nsPresContext.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/StyleAnimationValue.h" // For AnimationValue
 #include "mozilla/ServoCSSParser.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/dom/BaseKeyframeTypesBinding.h" // For CompositeOperation
 #include "mozilla/dom/Element.h"
 #include "nsDebug.h"
 #include "nsStyleUtil.h"
 #include "nsIDocument.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
@@ -513,20 +513,19 @@ ValueFromStringHelper(nsCSSPropertyID aP
     ServoCSSParser::ParseProperty(aPropID, aString, env,
                                   ParsingMode::AllowUnitlessLength |
                                     ParsingMode::AllowAllNumericValues);
   if (!servoDeclarationBlock) {
     return result;
   }
 
   // Compute value
-  aPresContext->StyleSet()->AsServo()->GetAnimationValues(servoDeclarationBlock,
-                                                          aTargetElement,
-                                                          aComputedStyle,
-                                                          result);
+  aPresContext->StyleSet()->
+    GetAnimationValues(servoDeclarationBlock, aTargetElement,
+                       aComputedStyle, result);
 
   return result;
 }
 
 // static
 void
 nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
                                     Element* aTargetElement,
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -46,17 +46,16 @@
 
 #include "nsIScriptContext.h"
 #include "xpcpublic.h"
 #include "js/Wrapper.h"
 
 #include "nsThreadUtils.h"
 #include "mozilla/dom/NodeListBinding.h"
 #include "mozilla/dom/ScriptSettings.h"
-#include "mozilla/ServoStyleSet.h"
 #include "mozilla/Unused.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // Implement our nsISupports methods
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsBindingManager)
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ b/dom/xbl/nsXBLPrototypeResources.cpp
@@ -103,17 +103,17 @@ nsXBLPrototypeResources::FlushSkinSheets
     }
 
     mStyleSheetList.AppendElement(newSheet);
   }
 
   // There may be no shell during unlink.
   if (auto* shell = doc->GetShell()) {
     MOZ_ASSERT(shell->GetPresContext());
-    ComputeServoStyles(*shell->StyleSet()->AsServo());
+    ComputeServoStyles(*shell->StyleSet());
   }
 
   return NS_OK;
 }
 
 nsresult
 nsXBLPrototypeResources::Write(nsIObjectOutputStream* aStream)
 {
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ b/dom/xbl/nsXBLResourceLoader.cpp
@@ -175,17 +175,17 @@ nsXBLResourceLoader::StyleSheetLoaded(St
   mResources->AppendStyleSheet(aSheet);
 
   if (!mInLoadResourcesFunc)
     mPendingSheets--;
 
   if (mPendingSheets == 0) {
     // All stylesheets are loaded.
     mResources->ComputeServoStyles(
-      *mBoundDocument->GetShell()->StyleSet()->AsServo());
+      *mBoundDocument->GetShell()->StyleSet());
 
     // XXX Check for mPendingScripts when scripts also come online.
     if (!mInLoadResourcesFunc)
       NotifyBoundElements();
   }
   return NS_OK;
 }
 
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -397,17 +397,17 @@ EnsureSubtreeStyled(Element* aElement)
     return;
   }
 
   nsIPresShell* presShell = aElement->OwnerDoc()->GetShell();
   if (!presShell || !presShell->DidInitialize()) {
     return;
   }
 
-  ServoStyleSet* servoSet = presShell->StyleSet()->AsServo();
+  ServoStyleSet* servoSet = presShell->StyleSet();
   StyleChildrenIterator iter(aElement);
   for (nsIContent* child = iter.GetNextChild();
        child;
        child = iter.GetNextChild()) {
     if (!child->IsElement()) {
       continue;
     }
 
@@ -460,17 +460,17 @@ public:
     nsIPresShell* presShell = mElement->OwnerDoc()->GetShell();
     if (!mHadData || !presShell || !presShell->DidInitialize()) {
       return;
     }
 
     if (*mResolveStyle) {
       mElement->ClearServoData();
 
-      ServoStyleSet* servoSet = presShell->StyleSet()->AsServo();
+      ServoStyleSet* servoSet = presShell->StyleSet();
       servoSet->StyleNewSubtree(mElement);
     }
   }
 
 private:
   Element* mElement;
   bool mHadData;
   bool* mResolveStyle;
--- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp
+++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp
@@ -203,22 +203,21 @@ HTMLEditor::CreateAnonymousElement(nsAto
       return nullptr;
     }
   }
 
   ManualNACPtr newContent(newContentRaw.forget());
 
   // Must style the new element, otherwise the PostRecreateFramesFor call
   // below will do nothing.
-  if (ServoStyleSet* styleSet = ps->StyleSet()->GetAsServo()) {
-    // Sometimes editor likes to append anonymous content to elements
-    // in display:none subtrees, so avoid styling in those cases.
-    if (ServoStyleSet::MayTraverseFrom(newContent)) {
-      styleSet->StyleNewSubtree(newContent);
-    }
+  ServoStyleSet* styleSet = ps->StyleSet();
+  // Sometimes editor likes to append anonymous content to elements
+  // in display:none subtrees, so avoid styling in those cases.
+  if (ServoStyleSet::MayTraverseFrom(newContent)) {
+    styleSet->StyleNewSubtree(newContent);
   }
 
   ElementDeletionObserver* observer =
     new ElementDeletionObserver(newContent, &aParentContent);
   NS_ADDREF(observer); // NodeWillBeDestroyed releases.
   aParentContent.AddMutationObserver(observer);
   newContent->AddMutationObserver(observer);
 
--- a/gfx/layers/apz/util/ActiveElementManager.cpp
+++ b/gfx/layers/apz/util/ActiveElementManager.cpp
@@ -2,18 +2,16 @@
 /* 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/. */
 
 #include "ActiveElementManager.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/Preferences.h"
 #include "base/message_loop.h"
 #include "base/task.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDocument.h"
 
 #define AEM_LOG(...)
 // #define AEM_LOG(...) printf_stderr("AEM: " __VA_ARGS__)
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -176,18 +176,17 @@
 #include "nsIDragSession.h"
 #include "nsIFrameInlines.h"
 #include "mozilla/gfx/2D.h"
 #include "nsSubDocumentFrame.h"
 #include "nsQueryObject.h"
 #include "nsLayoutStylesheetCache.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include "mozilla/layers/FocusTarget.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/dom/ImageTracker.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsBindingManager.h"
 #include "nsClassHashtable.h"
 #include "nsHashKeys.h"
 
@@ -900,33 +899,33 @@ PresShell::~PresShell()
   // that we now re-enable painting on our refresh driver, since it may need to
   // be re-used by another presentation.
   if (mPaintingIsFrozen) {
     mPresContext->RefreshDriver()->Thaw();
   }
 
   MOZ_ASSERT(mAllocatedPointers.IsEmpty(), "Some pres arena objects were not freed");
 
-  mStyleSet->Delete();
+  mStyleSet = nullptr;
   delete mFrameConstructor;
 
   mCurrentEventContent = nullptr;
 }
 
 /**
  * Initialize the presentation shell. Create view manager and style
  * manager.
  * Note this can't be merged into our constructor because caret initialization
  * calls AddRef() on us.
  */
 void
 PresShell::Init(nsIDocument* aDocument,
                 nsPresContext* aPresContext,
                 nsViewManager* aViewManager,
-                StyleSetHandle aStyleSet)
+                UniquePtr<ServoStyleSet> aStyleSet)
 {
   NS_PRECONDITION(aDocument, "null ptr");
   NS_PRECONDITION(aPresContext, "null ptr");
   NS_PRECONDITION(aViewManager, "null ptr");
   NS_PRECONDITION(!mDocument, "already initialized");
 
   if (!aDocument || !aPresContext || !aViewManager || mDocument) {
     return;
@@ -952,17 +951,17 @@ PresShell::Init(nsIDocument* aDocument,
 
   // Bind the context to the presentation shell.
   mPresContext = aPresContext;
   mPresContext->AttachShell(this);
 
   // Now we can initialize the style set. Make sure to set the member before
   // calling Init, since various subroutines need to find the style set off
   // the PresContext during initialization.
-  mStyleSet = aStyleSet;
+  mStyleSet = Move(aStyleSet);
   mStyleSet->Init(aPresContext);
 
   // Notify our prescontext that it now has a compatibility mode.  Note that
   // this MUST happen after we set up our style set but before we create any
   // frames.
   mPresContext->CompatibilityModeChanged();
 
   // Add the preference style sheet.
@@ -1508,27 +1507,27 @@ PresShell::UpdatePreferenceStyles()
   if (mPrefStyleSheet == newPrefSheet) {
     return;
   }
 
   mStyleSet->BeginUpdate();
 
   RemovePreferenceStyles();
 
-  mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet);
+  mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsServo());
   mPrefStyleSheet = newPrefSheet;
 
   mStyleSet->EndUpdate();
 }
 
 void
 PresShell::RemovePreferenceStyles()
 {
   if (mPrefStyleSheet) {
-    mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet);
+    mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsServo());
     mPrefStyleSheet = nullptr;
   }
 }
 
 void
 PresShell::AddUserSheet(StyleSheet* aSheet)
 {
   // Make sure this does what nsDocumentViewer::CreateStyleSet does wrt
@@ -1541,58 +1540,59 @@ PresShell::AddUserSheet(StyleSheet* aShe
 
   mStyleSet->BeginUpdate();
 
   nsStyleSheetService* sheetService = nsStyleSheetService::gInstance;
   nsTArray<RefPtr<StyleSheet>>& userSheets = *sheetService->UserStyleSheets();
   // Iterate forwards when removing so the searches for RemoveStyleSheet are as
   // short as possible.
   for (StyleSheet* sheet : userSheets) {
-    mStyleSet->RemoveStyleSheet(SheetType::User, sheet);
+    mStyleSet->RemoveStyleSheet(SheetType::User, sheet->AsServo());
   }
 
   // Now iterate backwards, so that the order of userSheets will be the same as
   // the order of sheets from it in the style set.
   for (StyleSheet* sheet : Reversed(userSheets)) {
-    mStyleSet->PrependStyleSheet(SheetType::User, sheet);
+    mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsServo());
   }
 
   mStyleSet->EndUpdate();
   RestyleForCSSRuleChanges();
 }
 
 void
 PresShell::AddAgentSheet(StyleSheet* aSheet)
 {
   // Make sure this does what nsDocumentViewer::CreateStyleSet does
   // wrt ordering.
-  mStyleSet->AppendStyleSheet(SheetType::Agent, aSheet);
+  mStyleSet->AppendStyleSheet(SheetType::Agent, aSheet->AsServo());
   RestyleForCSSRuleChanges();
 }
 
 void
 PresShell::AddAuthorSheet(StyleSheet* aSheet)
 {
   // Document specific "additional" Author sheets should be stronger than the
   // ones added with the StyleSheetService.
   StyleSheet* firstAuthorSheet =
     mDocument->GetFirstAdditionalAuthorSheet();
   if (firstAuthorSheet) {
-    mStyleSet->InsertStyleSheetBefore(SheetType::Doc, aSheet, firstAuthorSheet);
+    mStyleSet->InsertStyleSheetBefore(SheetType::Doc, aSheet->AsServo(),
+                                      firstAuthorSheet->AsServo());
   } else {
-    mStyleSet->AppendStyleSheet(SheetType::Doc, aSheet);
+    mStyleSet->AppendStyleSheet(SheetType::Doc, aSheet->AsServo());
   }
 
   RestyleForCSSRuleChanges();
 }
 
 void
 PresShell::RemoveSheet(SheetType aType, StyleSheet* aSheet)
 {
-  mStyleSet->RemoveStyleSheet(aType, aSheet);
+  mStyleSet->RemoveStyleSheet(aType, aSheet->AsServo());
   RestyleForCSSRuleChanges();
 }
 
 NS_IMETHODIMP
 PresShell::SetDisplaySelection(int16_t aToggle)
 {
   RefPtr<nsFrameSelection> frameSelection = mSelection;
   frameSelection->SetDisplaySelection(aToggle);
@@ -4361,17 +4361,17 @@ PresShell::ContentStateChanged(nsIDocume
 void
 PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
 {
   NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged");
   NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
   MOZ_ASSERT(!aStateMask.IsEmpty());
 
   if (mDidInitialize) {
-    mStyleSet->AsServo()->InvalidateStyleForDocumentStateChanges(aStateMask);
+    mStyleSet->InvalidateStyleForDocumentStateChanges(aStateMask);
   }
 
   if (aStateMask.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
     if (nsIFrame* root = mFrameConstructor->GetRootFrame()) {
       root->SchedulePaint();
     }
   }
 }
@@ -8390,49 +8390,49 @@ PresShell::IsVisible()
   nsIFrame* frame = view->GetFrame();
   if (!frame)
     return true;
 
   return frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY);
 }
 
 nsresult
-PresShell::GetAgentStyleSheets(nsTArray<RefPtr<StyleSheet>>& aSheets)
+PresShell::GetAgentStyleSheets(nsTArray<RefPtr<ServoStyleSheet>>& aSheets)
 {
   aSheets.Clear();
   int32_t sheetCount = mStyleSet->SheetCount(SheetType::Agent);
 
   if (!aSheets.SetCapacity(sheetCount, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   for (int32_t i = 0; i < sheetCount; ++i) {
-    StyleSheet* sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i);
+    ServoStyleSheet* sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i);
     aSheets.AppendElement(sheet);
   }
 
   return NS_OK;
 }
 
 nsresult
-PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<StyleSheet>>& aSheets)
+PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<ServoStyleSheet>>& aSheets)
 {
   return mStyleSet->ReplaceSheets(SheetType::Agent, aSheets);
 }
 
 nsresult
 PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
 {
-  return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet);
+  return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsServo());
 }
 
 nsresult
 PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
 {
-  return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet);
+  return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsServo());
 }
 
 static void
 FreezeElement(nsISupports *aSupports, void * /* unused */)
 {
   nsCOMPtr<nsIObjectLoadingContent> olc(do_QueryInterface(aSupports));
   if (olc) {
     olc->StopPluginInstance();
@@ -9490,56 +9490,56 @@ FindTopFrame(nsIFrame* aRoot)
   return nullptr;
 }
 #endif
 
 
 #ifdef DEBUG
 
 static void
-CopySheetsIntoClone(StyleSetHandle aSet, StyleSetHandle aClone)
+CopySheetsIntoClone(ServoStyleSet* aSet, ServoStyleSet* aClone)
 {
   int32_t i, n = aSet->SheetCount(SheetType::Override);
   for (i = 0; i < n; i++) {
-    StyleSheet* ss = aSet->StyleSheetAt(SheetType::Override, i);
+    ServoStyleSheet* ss = aSet->StyleSheetAt(SheetType::Override, i);
     if (ss)
       aClone->AppendStyleSheet(SheetType::Override, ss);
   }
 
   // The document expects to insert document stylesheets itself
 #if 0
   n = aSet->SheetCount(SheetType::Doc);
   for (i = 0; i < n; i++) {
     StyleSheet* ss = aSet->StyleSheetAt(SheetType::Doc, i);
     if (ss)
       aClone->AddDocStyleSheet(ss, mDocument);
   }
 #endif
 
   n = aSet->SheetCount(SheetType::User);
   for (i = 0; i < n; i++) {
-    StyleSheet* ss = aSet->StyleSheetAt(SheetType::User, i);
+    ServoStyleSheet* ss = aSet->StyleSheetAt(SheetType::User, i);
     if (ss)
       aClone->AppendStyleSheet(SheetType::User, ss);
   }
 
   n = aSet->SheetCount(SheetType::Agent);
   for (i = 0; i < n; i++) {
-    StyleSheet* ss = aSet->StyleSheetAt(SheetType::Agent, i);
+    ServoStyleSheet* ss = aSet->StyleSheetAt(SheetType::Agent, i);
     if (ss)
       aClone->AppendStyleSheet(SheetType::Agent, ss);
   }
 }
 
 
-ServoStyleSet*
+UniquePtr<ServoStyleSet>
 PresShell::CloneStyleSet(ServoStyleSet* aSet)
 {
-  ServoStyleSet* clone = new ServoStyleSet();
-  CopySheetsIntoClone(aSet, clone);
+  auto clone = MakeUnique<ServoStyleSet>();
+  CopySheetsIntoClone(aSet, clone.get());
   return clone;
 }
 
 // After an incremental reflow, we verify the correctness by doing a
 // full reflow into a fresh frame tree.
 bool
 PresShell::VerifyIncrementalReflow()
 {
@@ -9583,22 +9583,20 @@ PresShell::VerifyIncrementalReflow()
   vm->SetRootView(view);
 
   // Make the new presentation context the same size as our
   // presentation context.
   cx->SetVisibleArea(mPresContext->GetVisibleArea());
 
   // Create a new presentation shell to view the document. Use the
   // exact same style information that this document has.
-  nsAutoPtr<ServoStyleSet> newServoSet(CloneStyleSet(mStyleSet->AsServo()));
-  StyleSetHandle newSet(newServoSet);
-
-  nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet);
+  UniquePtr<ServoStyleSet> newSet = CloneStyleSet(StyleSet());
+
+  nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, Move(newSet));
   NS_ENSURE_TRUE(sh, false);
-  newServoSet.forget();
   // Note that after we create the shell, we must make sure to destroy it
   sh->SetVerifyReflowEnable(false); // turn off verify reflow while we're reflowing the test frame tree
   vm->SetPresShell(sh);
   {
     nsAutoCauseReflowNotifier crNotifier(this);
     sh->Initialize();
   }
   mDocument->BindingManager()->ProcessAttachedQueue();
@@ -10316,17 +10314,17 @@ PresShell::AddSizeOfIncludingThis(nsWind
   aSizes.mLayoutPresShellSize += mallocSizeOf(this);
   if (mCaret) {
     aSizes.mLayoutPresShellSize += mCaret->SizeOfIncludingThis(mallocSizeOf);
   }
   aSizes.mLayoutPresShellSize +=
     mApproximatelyVisibleFrames.ShallowSizeOfExcludingThis(mallocSizeOf) +
     mFramesToDirty.ShallowSizeOfExcludingThis(mallocSizeOf);
 
-  StyleSet()->AsServo()->AddSizeOfIncludingThis(aSizes);
+  StyleSet()->AddSizeOfIncludingThis(aSizes);
 
   aSizes.mLayoutTextRunsSize += SizeOfTextRuns(mallocSizeOf);
 
   aSizes.mLayoutPresContextSize +=
     mPresContext->SizeOfIncludingThis(mallocSizeOf);
 
   mFrameConstructor->AddSizeOfIncludingThis(aSizes);
 }
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -9,17 +9,17 @@
 #ifndef mozilla_PresShell_h
 #define mozilla_PresShell_h
 
 #include "MobileViewportManager.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/layers/FocusTarget.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/StyleSetHandle.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/UniquePtr.h"
 #include "nsAutoPtr.h"
 #include "nsContentUtils.h" // For AddScriptBlocker().
 #include "nsCRT.h"
 #include "nsIObserver.h"
 #include "nsIPresShell.h"
 #include "nsISelectionController.h"
 #include "nsIWidget.h"
@@ -40,16 +40,17 @@ 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;
 
@@ -76,17 +77,18 @@ public:
   PresShell();
 
   // nsISupports
   NS_DECL_ISUPPORTS
 
   static bool AccessibleCaretEnabled(nsIDocShell* aDocShell);
 
   void Init(nsIDocument* aDocument, nsPresContext* aPresContext,
-            nsViewManager* aViewManager, StyleSetHandle aStyleSet);
+            nsViewManager* aViewManager,
+            UniquePtr<ServoStyleSet> aStyleSet);
   void Destroy() override;
 
   void UpdatePreferenceStyles() override;
 
   NS_IMETHOD GetSelection(RawSelectionType aRawSelectionType,
                           nsISelection** aSelection) override;
   dom::Selection* GetDOMSelection(RawSelectionType aRawSelectionType) override;
 
@@ -153,19 +155,19 @@ public:
   void SetIgnoreFrameDestruction(bool aIgnore) override;
   void NotifyDestroyingFrame(nsIFrame* aFrame) override;
 
   nsresult CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState) override;
 
   void UnsuppressPainting() override;
 
   nsresult GetAgentStyleSheets(
-      nsTArray<RefPtr<StyleSheet>>& aSheets) override;
+      nsTArray<RefPtr<ServoStyleSheet>>& aSheets) override;
   nsresult SetAgentStyleSheets(
-      const nsTArray<RefPtr<StyleSheet>>& aSheets) override;
+      const nsTArray<RefPtr<ServoStyleSheet>>& aSheets) override;
 
   nsresult AddOverrideStyleSheet(StyleSheet* aSheet) override;
   nsresult RemoveOverrideStyleSheet(StyleSheet* aSheet) override;
 
   nsresult HandleEventWithTarget(WidgetEvent* aEvent,
                                  nsIFrame* aFrame,
                                  nsIContent* aContent,
                                  nsEventStatus* aStatus,
@@ -500,17 +502,17 @@ private:
 
   void SetRenderingState(const RenderingState& aState);
 
   friend class ::nsPresShellEventCB;
 
   bool mCaretEnabled;
 
 #ifdef DEBUG
-  ServoStyleSet* CloneStyleSet(ServoStyleSet* aSet);
+  UniquePtr<ServoStyleSet> CloneStyleSet(ServoStyleSet* aSet);
   bool VerifyIncrementalReflow();
   bool mInVerifyReflow;
   void ShowEventTargetDebug();
 #endif
 
   void RemovePreferenceStyles();
 
   // methods for painting a range to an offscreen buffer
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -4,18 +4,16 @@
  * 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/. */
 
 #include "mozilla/RestyleManager.h"
 #include "mozilla/RestyleManagerInlines.h"
 
 #include "Layers.h"
 #include "LayerAnimationInfo.h" // For LayerAnimationInfo::sRecords
-#include "mozilla/StyleSetHandleInlines.h"
-#include "mozilla/ServoStyleSetInlines.h"
 #include "nsAnimationManager.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsCSSRendering.h"
 #include "nsIFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsIPresShellInlines.h"
 #include "nsPlaceholderFrame.h"
 #include "nsStyleChangeList.h"
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -7,17 +7,17 @@
 #include "mozilla/ServoRestyleManager.h"
 
 #include "mozilla/AutoRestyleTimelineMarker.h"
 #include "mozilla/AutoTimelineMarker.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/ComputedStyleInlines.h"
 #include "mozilla/DocumentStyleRootIterator.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoStyleSet.h"
+#include "mozilla/ServoStyleSetInlines.h"
 #include "mozilla/Unused.h"
 #include "mozilla/ViewportFrame.h"
 #include "mozilla/dom/ChildIterator.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "nsBlockFrame.h"
 #include "nsBulletFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsImageFrame.h"
@@ -1542,17 +1542,17 @@ ServoRestyleManager::ReparentComputedSty
 
   DoReparentComputedStyle(aFrame, *StyleSet());
 
   return NS_OK;
 }
 
 void
 ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
-                                            ServoStyleSet& aStyleSet)
+                                             ServoStyleSet& aStyleSet)
 {
   if (aFrame->IsBackdropFrame()) {
     // Style context of backdrop frame has no parent style, and thus we do not
     // need to reparent it.
     return;
   }
 
   if (aFrame->IsPlaceholderFrame()) {
--- a/layout/base/ServoRestyleManager.h
+++ b/layout/base/ServoRestyleManager.h
@@ -14,16 +14,17 @@
 #include "mozilla/ServoElementSnapshotTable.h"
 #include "nsChangeHint.h"
 #include "nsPresContext.h"
 
 namespace mozilla {
 namespace dom {
 class Element;
 } // namespace dom
+class ServoStyleSet;
 } // namespace mozilla
 class nsAttrValue;
 class nsAtom;
 class nsIContent;
 class nsIFrame;
 class nsStyleChangeList;
 
 namespace mozilla {
@@ -298,20 +299,17 @@ private:
                             ServoPostTraversalFlags aFlags);
 
   struct TextPostTraversalState;
   bool ProcessPostTraversalForText(nsIContent* aTextNode,
                                    TextPostTraversalState& aState,
                                    ServoRestyleState& aRestyleState,
                                    ServoPostTraversalFlags aFlags);
 
-  inline ServoStyleSet* StyleSet() const
-  {
-    return PresContext()->StyleSet()->AsServo();
-  }
+  inline ServoStyleSet* StyleSet() const { return PresContext()->StyleSet(); }
 
   const SnapshotTable& Snapshots() const { return mSnapshots; }
   void ClearSnapshots();
   ServoElementSnapshot& SnapshotFor(mozilla::dom::Element* aElement);
   void TakeSnapshotForAttributeChange(mozilla::dom::Element* aElement,
                                       int32_t aNameSpaceID,
                                       nsAtom* aAttribute);
 
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -35,18 +35,16 @@
 #include "nsIDocumentInlines.h"
 #include "nsTableFrame.h"
 #include "nsTableColFrame.h"
 #include "nsTableRowFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsUnicharUtils.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsViewManager.h"
 #include "nsStyleConsts.h"
 #ifdef MOZ_XUL
 #include "nsXULElement.h"
 #include "mozilla/dom/BoxObject.h"
 #endif // MOZ_XUL
 #include "nsContainerFrame.h"
 #include "nsNameSpaceManager.h"
@@ -1826,17 +1824,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
                                                   ComputedStyle*  aComputedStyle,
                                                   CSSPseudoElementType aPseudoElement,
                                                   FrameConstructionItemList& aItems)
 {
   MOZ_ASSERT(aPseudoElement == CSSPseudoElementType::before ||
              aPseudoElement == CSSPseudoElementType::after,
              "unexpected aPseudoElement");
 
-  StyleSetHandle styleSet = mPresShell->StyleSet();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
 
   // Probe for the existence of the pseudo-element
   RefPtr<ComputedStyle> pseudoComputedStyle;
   pseudoComputedStyle =
     styleSet->ProbePseudoElementStyle(aParentContent, aPseudoElement,
                                       aComputedStyle);
   if (!pseudoComputedStyle)
     return;
@@ -1884,32 +1882,31 @@ nsCSSFrameConstructor::CreateGeneratedCo
   bool hasServoAnimations =
     Servo_ComputedValues_SpecifiesAnimationsOrTransitions(pseudoComputedStyle);
   if (!hasServoAnimations) {
     Servo_SetExplicitStyle(container, pseudoComputedStyle);
   } else {
     // If animations are involved, we avoid the SetExplicitStyle optimization
     // above. We need to grab style with animations from the pseudo element
     // and replace old one.
-    mPresShell->StyleSet()->AsServo()->StyleNewSubtree(container);
-    pseudoComputedStyle =
-      styleSet->AsServo()->ResolveServoStyle(container);
+    mPresShell->StyleSet()->StyleNewSubtree(container);
+    pseudoComputedStyle = styleSet->ResolveServoStyle(container);
   }
 
   uint32_t contentCount = pseudoComputedStyle->StyleContent()->ContentCount();
   for (uint32_t contentIndex = 0; contentIndex < contentCount; contentIndex++) {
     nsCOMPtr<nsIContent> content =
       CreateGeneratedContent(aState, aParentContent, pseudoComputedStyle,
                              contentIndex);
     if (content) {
       container->AppendChildTo(content, false);
       if (content->IsElement()) {
         // If we created any children elements, Servo needs to traverse them, but
         // the root is already set up.
-        mPresShell->StyleSet()->AsServo()->StyleNewSubtree(content->AsElement());
+        mPresShell->StyleSet()->StyleNewSubtree(content->AsElement());
       }
     }
   }
 
   AddFrameConstructionItemsInternal(aState, container, aParentFrame, elemName,
                                     kNameSpaceID_None, true,
                                     pseudoComputedStyle,
                                     ITEM_IS_GENERATED_CONTENT, nullptr,
@@ -2428,28 +2425,27 @@ nsCSSFrameConstructor::ConstructDocEleme
                                 nullptr,
                                 nullptr, do_AddRef(aFrameState));
 
   // XXXbz why, exactly?
   if (!mTempFrameTreeState)
     state.mPresShell->CaptureHistoryState(getter_AddRefs(mTempFrameTreeState));
 
   // --------- CREATE AREA OR BOX FRAME -------
-  if (ServoStyleSet* set = mPresShell->StyleSet()->GetAsServo()) {
-    // Ensure the document element is styled at this point.
-    if (!aDocElement->HasServoData()) {
-      // NOTE(emilio): If the root has a non-null binding, we'll stop at the
-      // document element and won't process any children, loading the bindings
-      // (or failing to do so) will take care of the rest.
-      set->StyleNewSubtree(aDocElement);
-    }
+  ServoStyleSet* set = mPresShell->StyleSet();
+  // Ensure the document element is styled at this point.
+  if (!aDocElement->HasServoData()) {
+    // NOTE(emilio): If the root has a non-null binding, we'll stop at the
+    // document element and won't process any children, loading the bindings
+    // (or failing to do so) will take care of the rest.
+    set->StyleNewSubtree(aDocElement);
   }
 
   RefPtr<ComputedStyle> computedStyle =
-    mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aDocElement);
+    mPresShell->StyleSet()->ResolveServoStyle(aDocElement);
 
   const nsStyleDisplay* display = computedStyle->StyleDisplay();
 
   // Ensure that our XBL bindings are installed.
   if (display->mBinding) {
     // Get the XBL loader.
     nsresult rv;
     bool resolveStyle;
@@ -2471,18 +2467,17 @@ nsCSSFrameConstructor::ConstructDocEleme
     if (binding) {
       // For backwards compat, keep firing the root's constructor
       // after all of its kids' constructors.  So tell the binding
       // manager about it right now.
       mDocument->BindingManager()->AddToAttachedQueue(binding);
     }
 
     if (resolveStyle) {
-      computedStyle =
-        mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aDocElement);
+      computedStyle = mPresShell->StyleSet()->ResolveServoStyle(aDocElement);
       display = computedStyle->StyleDisplay();
     }
   }
 
   // --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
 
   NS_ASSERTION(!display->IsScrollableOverflow() ||
                state.mPresContext->IsPaginated() ||
@@ -2680,17 +2675,17 @@ nsCSSFrameConstructor::ConstructDocEleme
 }
 
 
 nsIFrame*
 nsCSSFrameConstructor::ConstructRootFrame()
 {
   AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
 
-  StyleSetHandle styleSet = mPresShell->StyleSet();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
 
   // --------- BUILD VIEWPORT -----------
   RefPtr<ComputedStyle> viewportPseudoStyle =
     styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport,
                                                  nullptr);
   ViewportFrame* viewportFrame =
     NS_NewViewportFrame(mPresShell, viewportPseudoStyle);
 
@@ -2847,17 +2842,17 @@ nsCSSFrameConstructor::SetUpDocElementCo
   RefPtr<ComputedStyle> rootPseudoStyle;
   // we must create a state because if the scrollbars are GFX it needs the
   // state to build the scrollbar frames.
   nsFrameConstructorState state(mPresShell, nullptr, nullptr, nullptr);
 
   // Start off with the viewport as parent; we'll adjust it as needed.
   nsContainerFrame* parentFrame = viewportFrame;
 
-  StyleSetHandle styleSet = mPresShell->StyleSet();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
   // If paginated, make sure we don't put scrollbars in
   if (!isScrollable) {
     rootPseudoStyle =
       styleSet->ResolveInheritingAnonymousBoxStyle(rootPseudo,
                                                    viewportPseudoStyle);
   } else {
       if (rootPseudo == nsCSSAnonBoxes::canvas) {
         rootPseudo = nsCSSAnonBoxes::scrolledCanvas;
@@ -2951,17 +2946,17 @@ nsCSSFrameConstructor::ConstructAnonymou
 
 nsContainerFrame*
 nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell*  aPresShell,
                                           nsContainerFrame* aParentFrame,
                                           nsIFrame*      aPrevPageFrame,
                                           nsContainerFrame*& aCanvasFrame)
 {
   ComputedStyle* parentComputedStyle = aParentFrame->Style();
-  StyleSetHandle styleSet = aPresShell->StyleSet();
+  ServoStyleSet* styleSet = aPresShell->StyleSet();
 
   RefPtr<ComputedStyle> pagePseudoStyle;
   pagePseudoStyle =
     styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::page,
                                                  parentComputedStyle);
 
   nsContainerFrame* pageFrame = NS_NewPageFrame(aPresShell, pagePseudoStyle);
 
@@ -4235,22 +4230,21 @@ nsCSSFrameConstructor::GetAnonymousConte
       SetFlagsOnSubtree(content, NODE_IS_EDITABLE);
     }
     if (NS_FAILED(rv)) {
       content->UnbindFromTree();
       return rv;
     }
   }
 
-  if (ServoStyleSet* styleSet = mPresShell->StyleSet()->GetAsServo()) {
-    // Eagerly compute styles for the anonymous content tree.
-    for (auto& info : aContent) {
-      if (info.mContent->IsElement()) {
-        styleSet->StyleNewSubtree(info.mContent->AsElement());
-      }
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
+  // Eagerly compute styles for the anonymous content tree.
+  for (auto& info : aContent) {
+    if (info.mContent->IsElement()) {
+      styleSet->StyleNewSubtree(info.mContent->AsElement());
     }
   }
 
   return NS_OK;
 }
 
 static
 bool IsXULDisplayType(const nsStyleDisplay* aDisplay)
@@ -4593,17 +4587,17 @@ nsCSSFrameConstructor::BeginBuildingScro
                                 /* aParentIsWrapperAnonBox = */ false,
                                 anonymousItems);
   }
 
   aNewFrame = gfxScrollFrame;
   gfxScrollFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
 
   // we used the style that was passed in. So resolve another one.
-  StyleSetHandle styleSet = mPresShell->StyleSet();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
   RefPtr<ComputedStyle> scrolledChildStyle =
     styleSet->ResolveInheritingAnonymousBoxStyle(aScrolledPseudo, contentStyle);
 
   if (gfxScrollFrame) {
      gfxScrollFrame->SetInitialChildList(kPrincipalList, anonymousItems);
   }
 
   return scrolledChildStyle.forget();
@@ -5004,17 +4998,17 @@ nsCSSFrameConstructor::InitAndRestoreFra
       mCounterManager.AddCounterResetsAndIncrements(aNewFrame)) {
     CountersDirty();
   }
 }
 
 already_AddRefed<ComputedStyle>
 nsCSSFrameConstructor::ResolveComputedStyle(nsIContent* aContent)
 {
-  ServoStyleSet* styleSet = mPresShell->StyleSet()->AsServo();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
 
   if (aContent->IsElement()) {
     return styleSet->ResolveServoStyle(aContent->AsElement());
   }
 
   MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eTEXT),
              "shouldn't waste time creating ComputedStyles for "
              "comments and processing instructions");
@@ -5050,17 +5044,17 @@ nsCSSFrameConstructor::FlushAccumulatedB
     return;
   }
 
   nsAtom* anonPseudo = nsCSSAnonBoxes::mozMathMLAnonymousBlock;
 
   ComputedStyle* parentContext =
     nsFrame::CorrectStyleParentFrame(aParentFrame,
                                      anonPseudo)->Style();
-  StyleSetHandle styleSet = mPresShell->StyleSet();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
   RefPtr<ComputedStyle> blockContext;
   blockContext = styleSet->
     ResolveInheritingAnonymousBoxStyle(anonPseudo, parentContext);
 
   // then, create a block frame that will wrap the child frames. Make it a
   // MathML frame so that Get(Absolute/Float)ContainingBlockFor know that this
   // is not a suitable block.
   nsContainerFrame* blockFrame =
@@ -5691,17 +5685,17 @@ nsCSSFrameConstructor::AddFrameConstruct
       if (newPendingBinding->mBinding) {
         pendingBinding = newPendingBinding;
         // aState takes over owning newPendingBinding
         aState.AddPendingBinding(newPendingBinding.forget());
       }
 
       if (resolveStyle) {
         computedStyle =
-          mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aContent->AsElement());
+          mPresShell->StyleSet()->ResolveServoStyle(aContent->AsElement());
       }
 
       display = computedStyle->StyleDisplay();
       aComputedStyle = computedStyle;
       aTag = mDocument->BindingManager()->ResolveTag(aContent, &aNameSpaceID);
     }
   }
 
@@ -7072,17 +7066,17 @@ IsFlattenedTreeChild(nsIContent* aParent
   return false;
 }
 #endif
 
 void
 nsCSSFrameConstructor::StyleNewChildRange(nsIContent* aStartChild,
                                           nsIContent* aEndChild)
 {
-  ServoStyleSet* styleSet = mPresShell->StyleSet()->AsServo();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
 
   for (nsIContent* child = aStartChild; child != aEndChild;
        child = child->GetNextSibling()) {
     if (child->IsElement() && !child->AsElement()->HasServoData()) {
       Element* parent = child->AsElement()->GetFlattenedTreeParentElement();
       // NB: Parent may be null if the content is appended to a shadow root, and
       // isn't assigned to any insertion point.
       if (MOZ_LIKELY(parent) && parent->HasServoData()) {
@@ -10748,17 +10742,17 @@ nsCSSFrameConstructor::CreateFloatingLet
     aComputedStyle->StyleDisplay(), aParentFrame);
   InitAndRestoreFrame(aState, letterContent, containingBlock, letterFrame);
 
   // Init the text frame to refer to the letter frame.
   //
   // Make sure we get a proper style for it (the one passed in is for the letter
   // frame and will have the float property set on it; the text frame shouldn't
   // have that set).
-  StyleSetHandle styleSet = mPresShell->StyleSet();
+  ServoStyleSet* styleSet = mPresShell->StyleSet();
   RefPtr<ComputedStyle> textSC = styleSet->
     ResolveStyleForText(aTextContent, aComputedStyle);
   aTextFrame->SetComputedStyleWithoutNotification(textSC);
   InitAndRestoreFrame(aState, aTextContent, letterFrame, aTextFrame);
 
   // And then give the text frame to the letter frame
   SetInitialSingleChild(letterFrame, aTextFrame);
 
@@ -10829,17 +10823,17 @@ nsCSSFrameConstructor::CreateLetterFrame
 
   if (sc) {
     if (parentFrame->IsLineFrame()) {
       nsIFrame* parentIgnoringFirstLine =
         nsFrame::CorrectStyleParentFrame(aBlockFrame,
                                          nsCSSPseudoElements::firstLetter);
 
       sc =
-        mPresShell->StyleSet()->AsServo()->ReparentComputedStyle(
+        mPresShell->StyleSet()->ReparentComputedStyle(
           sc,
           parentComputedStyle,
           parentIgnoringFirstLine->Style(),
           parentComputedStyle,
           blockContent->AsElement());
     }
 
     RefPtr<ComputedStyle> textSC = mPresShell->StyleSet()->
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -17,18 +17,16 @@
 #include "nsReadableUtils.h"
 #include "nsIContent.h"
 #include "nsIContentViewer.h"
 #include "nsIDocumentViewerPrint.h"
 #include "mozilla/dom/BeforeUnloadEvent.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsIFrame.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsSubDocumentFrame.h"
 #include "nsGenericHTMLElement.h"
 
 #include "nsILinkHandler.h"
 #include "nsIDOMDocument.h"
 #include "nsISelectionListener.h"
@@ -680,27 +678,27 @@ nsDocumentViewer::InitPresentationStuff(
 
   if (GetIsPrintPreview())
     return NS_OK;
 
   NS_ASSERTION(!mPresShell,
                "Someone should have destroyed the presshell!");
 
   // Create the style set...
-  StyleSetHandle styleSet = CreateStyleSet(mDocument);
+  UniquePtr<ServoStyleSet> styleSet = CreateStyleSet(mDocument);
 
   // Now make the shell for the document
-  mPresShell = mDocument->CreateShell(mPresContext, mViewManager, styleSet);
+  mPresShell = mDocument->CreateShell(mPresContext, mViewManager,
+                                      mozilla::Move(styleSet));
   if (!mPresShell) {
-    styleSet->Delete();
     return NS_ERROR_FAILURE;
   }
 
   // We're done creating the style set
-  styleSet->EndUpdate();
+  mPresShell->StyleSet()->EndUpdate();
 
   if (aDoInitialReflow) {
     // Since Initialize() will create frames for *all* items
     // that are currently in the document tree, we need to flush
     // any pending notifications to prevent the content sink from
     // duplicating layout frames for content it has added to the tree
     // but hasn't notified the document about. (Bug 154018)
     //
@@ -2304,25 +2302,25 @@ nsDocumentViewer::RequestWindowClose(boo
     mDeferredWindowClose = true;
   } else
 #endif
     *aCanClose = true;
 
   return NS_OK;
 }
 
-StyleSetHandle
+UniquePtr<ServoStyleSet>
 nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
 {
   // Make sure this does the same thing as PresShell::AddSheet wrt ordering.
 
   // this should eventually get expanded to allow for creating
   // different sets for different media
 
-  StyleSetHandle styleSet = new ServoStyleSet();
+  UniquePtr<ServoStyleSet> styleSet = MakeUnique<ServoStyleSet>();
 
   styleSet->BeginUpdate();
 
   // The document will fill in the document sheets when we create the presshell
 
   if (aDocument->IsBeingUsedAsImage()) {
     MOZ_ASSERT(aDocument->IsSVGDocument(),
                "Do we want to skip most sheets for this new image type?");
@@ -2342,18 +2340,19 @@ nsDocumentViewer::CreateStyleSet(nsIDocu
   // Handle the user sheets.
   StyleSheet* sheet = nullptr;
   if (nsContentUtils::IsInChromeDocshell(aDocument)) {
     sheet = cache->UserChromeSheet();
   } else {
     sheet = cache->UserContentSheet();
   }
 
-  if (sheet)
-    styleSet->AppendStyleSheet(SheetType::User, sheet);
+  if (sheet) {
+    styleSet->AppendStyleSheet(SheetType::User, sheet->AsServo());
+  }
 
   // Append chrome sheets (scrollbars + forms).
   bool shouldOverride = false;
   // We don't want a docshell here for external resource docs, so just
   // look at mContainer.
   nsCOMPtr<nsIDocShell> ds(mContainer);
   nsCOMPtr<nsIDOMEventTarget> chromeHandler;
   nsCOMPtr<nsIURI> uri;
@@ -2379,117 +2378,117 @@ nsDocumentViewer::CreateStyleSet(nsIDocu
         while ( (token = nsCRT::strtok(newStr, ", ", &newStr)) ) {
           NS_NewURI(getter_AddRefs(uri), nsDependentCString(token), nullptr,
                     baseURI);
           if (!uri) continue;
 
           cssLoader->LoadSheetSync(uri, &chromeSheet);
           if (!chromeSheet) continue;
 
-          styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet);
+          styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsServo());
           shouldOverride = true;
         }
         free(str);
       }
     }
   }
 
   if (!shouldOverride) {
     sheet = cache->ScrollbarsSheet();
     if (sheet) {
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
   }
 
   if (!aDocument->IsSVGDocument()) {
     // !!! IMPORTANT - KEEP THIS BLOCK IN SYNC WITH
     // !!! SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded.
 
     // SVGForeignObjectElement::BindToTree calls SVGDocument::
     // EnsureNonSVGUserAgentStyleSheetsLoaded to loads these UA sheet
     // on-demand. (Excluding the quirks sheet, which should never be loaded for
     // an SVG document, and excluding xul.css which will be loaded on demand by
     // nsXULElement::BindToTree.)
 
     sheet = cache->NumberControlSheet();
     if (sheet) {
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
 
     sheet = cache->FormsSheet();
     if (sheet) {
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
 
     if (aDocument->LoadsFullXULStyleSheetUpFront()) {
       // This is the only place components.css gets loaded, unlike xul.css
       sheet = cache->XULComponentsSheet();
       if (sheet) {
-        styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+        styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
       }
 
       // nsXULElement::BindToTree loads xul.css on-demand if we don't load it
       // up-front here.
       sheet = cache->XULSheet();
       if (sheet) {
-        styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+        styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
       }
     }
 
     sheet = cache->MinimalXULSheet();
     if (sheet) {
       // Load the minimal XUL rules for scrollbars and a few other XUL things
       // that non-XUL (typically HTML) documents commonly use.
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
 
     sheet = cache->CounterStylesSheet();
     if (sheet) {
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
 
     if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) {
       sheet = cache->NoScriptSheet();
       if (sheet) {
-        styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+        styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
       }
     }
 
     if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) {
       sheet = cache->NoFramesSheet();
       if (sheet) {
-        styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+        styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
       }
     }
 
     // We don't add quirk.css here; nsPresContext::CompatibilityModeChanged will
     // append it if needed.
 
     sheet = cache->HTMLSheet();
     if (sheet) {
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
 
     styleSet->PrependStyleSheet(SheetType::Agent,
-                                cache->UASheet());
+                                cache->UASheet()->AsServo());
   } else {
     // SVG documents may have scrollbars and need the scrollbar styling.
     sheet = cache->MinimalXULSheet();
     if (sheet) {
-      styleSet->PrependStyleSheet(SheetType::Agent, sheet);
+      styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
     }
   }
 
   nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
   if (sheetService) {
     for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
-      styleSet->AppendStyleSheet(SheetType::Agent, sheet);
+      styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsServo());
     }
     for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) {
-      styleSet->PrependStyleSheet(SheetType::User, sheet);
+      styleSet->PrependStyleSheet(SheetType::User, sheet->AsServo());
     }
   }
 
   // Caller will handle calling EndUpdate, per contract.
   return styleSet;
 }
 
 NS_IMETHODIMP
--- a/layout/base/nsIDocumentViewerPrint.h
+++ b/layout/base/nsIDocumentViewerPrint.h
@@ -2,20 +2,21 @@
 /* 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 nsIDocumentViewerPrint_h___
 #define nsIDocumentViewerPrint_h___
 
 #include "nsISupports.h"
+#include "mozilla/UniquePtr.h"
 
 class nsIDocument;
 namespace mozilla {
-class StyleSetHandle;
+class ServoStyleSet;
 } // namespace mozilla
 class nsIPresShell;
 class nsPresContext;
 class nsViewManager;
 
 // {c6f255cf-cadd-4382-b57f-cd2a9874169b}
 #define NS_IDOCUMENT_VIEWER_PRINT_IID \
 { 0xc6f255cf, 0xcadd, 0x4382, \
@@ -34,17 +35,18 @@ public:
   virtual bool GetIsPrinting() = 0;
 
   virtual void SetIsPrintPreview(bool aIsPrintPreview) = 0;
   virtual bool GetIsPrintPreview() = 0;
 
   // The style set returned by CreateStyleSet is in the middle of an
   // update batch so that the caller can add sheets to it if needed.
   // Callers should call EndUpdate() on it when ready to use.
-  virtual mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) = 0;
+  virtual mozilla::UniquePtr<mozilla::ServoStyleSet>
+    CreateStyleSet(nsIDocument* aDocument) = 0;
 
   /**
    * This is used by nsPagePrintTimer to make nsDocumentViewer::Destroy()
    * a no-op until printing is finished.  That prevents the nsDocumentViewer
    * and its document, presshell and prescontext from going away.
    */
   virtual void IncrementDestroyBlockedCount() = 0;
   virtual void DecrementDestroyBlockedCount() = 0;
@@ -73,17 +75,18 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumen
                               NS_IDOCUMENT_VIEWER_PRINT_IID)
 
 /* Use this macro when declaring classes that implement this interface. */
 #define NS_DECL_NSIDOCUMENTVIEWERPRINT \
   void SetIsPrinting(bool aIsPrinting) override; \
   bool GetIsPrinting() override; \
   void SetIsPrintPreview(bool aIsPrintPreview) override; \
   bool GetIsPrintPreview() override; \
-  mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) override; \
+  mozilla::UniquePtr<mozilla::ServoStyleSet> \
+    CreateStyleSet(nsIDocument* aDocument) override; \
   void IncrementDestroyBlockedCount() override; \
   void DecrementDestroyBlockedCount() override; \
   void OnDonePrinting() override; \
   bool IsInitializedForPrintPreview() override; \
   void InitializeForPrintPreview() override; \
   void SetPrintPreviewPresentation(nsViewManager* aViewManager, \
                                    nsPresContext* aPresContext, \
                                    nsIPresShell* aPresShell) override;
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -8,19 +8,20 @@
 
 #ifndef nsIPresShell_h___
 #define nsIPresShell_h___
 
 #include "mozilla/ArenaObjectID.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/FlushType.h"
 #include "mozilla/MemoryReporting.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/StaticPtr.h"
-#include "mozilla/StyleSetHandle.h"
 #include "mozilla/StyleSheet.h"
+#include "mozilla/UniquePtr.h"
 #include "mozilla/WeakPtr.h"
 #include "GeckoProfiler.h"
 #include "gfxPoint.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsISupports.h"
 #include "nsIContent.h"
 #include "nsISelectionController.h"
@@ -51,17 +52,17 @@ class nsPresContext;
 class nsWindowSizes;
 class nsViewManager;
 class nsView;
 class nsIPageSequenceFrame;
 class nsCanvasFrame;
 class nsCaret;
 namespace mozilla {
 class AccessibleCaretEventHub;
-class CSSStyleSheet;
+class ServoStyleSheet;
 } // namespace mozilla
 class nsFrameSelection;
 class nsFrameManager;
 class nsILayoutHistoryState;
 class nsIReflowCallback;
 class nsIDOMNode;
 class nsCSSFrameConstructor;
 class nsISelection;
@@ -273,17 +274,17 @@ public:
    * Set the document accessible for this pres shell.
    */
   void SetDocAccessible(mozilla::a11y::DocAccessible* aDocAccessible)
   {
     mDocAccessible = aDocAccessible;
   }
 #endif
 
-  mozilla::StyleSetHandle StyleSet() const { return mStyleSet; }
+  mozilla::ServoStyleSet* StyleSet() const { return mStyleSet.get(); }
 
   nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor; }
 
   /* Enable/disable author style level. Disabling author style disables the entire
    * author level of the cascade, including the HTML preshint level.
    */
   // XXX these could easily be inlined, but there is a circular #include
   // problem with nsStyleSet.
@@ -988,23 +989,23 @@ public:
    * Unsuppress painting.
    */
   virtual void UnsuppressPainting() = 0;
 
   /**
    * Get the set of agent style sheets for this presentation
    */
   virtual nsresult GetAgentStyleSheets(
-      nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) = 0;
+      nsTArray<RefPtr<mozilla::ServoStyleSheet>>& aSheets) = 0;
 
   /**
    * Replace the set of agent style sheets
    */
   virtual nsresult SetAgentStyleSheets(
-      const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) = 0;
+      const nsTArray<RefPtr<mozilla::ServoStyleSheet>>& aSheets) = 0;
 
   /**
    * Add an override style sheet for this presentation
    */
   virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) = 0;
 
   /**
    * Remove an override style sheet
@@ -1689,17 +1690,17 @@ protected:
   // IMPORTANT: The ownership implicit in the following member variables
   // has been explicitly checked.  If you add any members to this class,
   // please make the ownership explicit (pinkerton, scc).
 
   // These are the same Document and PresContext owned by the DocViewer.
   // we must share ownership.
   nsCOMPtr<nsIDocument>     mDocument;
   RefPtr<nsPresContext>   mPresContext;
-  mozilla::StyleSetHandle   mStyleSet;      // [OWNS]
+  mozilla::UniquePtr<mozilla::ServoStyleSet> mStyleSet;
   nsCSSFrameConstructor*    mFrameConstructor; // [OWNS]
   nsViewManager*           mViewManager;   // [WEAK] docViewer owns it so I don't have to
   nsPresArena               mFrameArena;
   RefPtr<nsFrameSelection> mSelection;
   // Pointer into mFrameConstructor - this is purely so that GetRootFrame() can
   // be inlined:
   nsFrameManager*       mFrameManager;
   mozilla::WeakPtr<nsDocShell>                 mForwardingContainer;
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -111,18 +111,17 @@
 #include "mozilla/Preferences.h"
 #include "nsFrameSelection.h"
 #include "FrameLayerBuilder.h"
 #include "mozilla/layers/APZUtils.h"    // for apz::CalculatePendingDisplayPort
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/StyleAnimationValue.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/WheelHandlingHelper.h" // for WheelHandlingUtils
 #include "RegionBuilder.h"
 #include "SVGViewportElement.h"
 #include "DisplayItemClip.h"
 #include "mozilla/layers/StackingContextHelper.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
 #include "prenv.h"
 #include "RetainedDisplayListBuilder.h"
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -18,18 +18,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsIPresShell.h"
 #include "nsIPresShellInlines.h"
 #include "nsDocShell.h"
 #include "nsIContentViewer.h"
 #include "nsPIDOMWindow.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include "nsIDocumentInlines.h"
 #include "nsIPrintSettings.h"
 #include "nsLanguageAtomService.h"
 #include "mozilla/LookAndFeel.h"
 #include "nsIInterfaceRequestorUtils.h"
@@ -116,32 +115,21 @@ class ContainerLayerPresContext : public
 public:
   nsPresContext* mPresContext;
 };
 
 
 nscolor
 nsPresContext::MakeColorPref(const nsString& aColor)
 {
-  bool ok;
+  ServoStyleSet* styleSet = mShell ? mShell->StyleSet() : nullptr;
+
   nscolor result;
-
-  ServoStyleSet* servoStyleSet = mShell && mShell->StyleSet()
-    ? mShell->StyleSet()->GetAsServo()
-    : nullptr;
-
-  bool useServoParser =
-    true;
-
-  if (useServoParser) {
-    ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColor,
-                                      &result);
-  } else {
-    MOZ_CRASH("old style system disabled");
-  }
+  bool ok = ServoCSSParser::
+    ComputeColor(styleSet, NS_RGB(0, 0, 0), aColor, &result);
 
   if (!ok) {
     // Any better choices?
     result = NS_RGB(0, 0, 0);
   }
 
   return result;
 }
@@ -1197,18 +1185,18 @@ nsPresContext::CompatibilityModeChanged(
     return;
   }
 
   nsIDocument* doc = mShell->GetDocument();
   if (!doc) {
     return;
   }
 
-  StyleSetHandle styleSet = mShell->StyleSet();
-  styleSet->AsServo()->CompatibilityModeChanged();
+  ServoStyleSet* styleSet = mShell->StyleSet();
+  styleSet->CompatibilityModeChanged();
 
   if (doc->IsSVGDocument()) {
     // SVG documents never load quirk.css.
     return;
   }
 
   bool needsQuirkSheet = CompatibilityMode() == eCompatibility_NavQuirks;
   if (mQuirkSheetAdded == needsQuirkSheet) {
@@ -1216,21 +1204,21 @@ nsPresContext::CompatibilityModeChanged(
   }
 
   auto cache = nsLayoutStylesheetCache::Singleton();
   StyleSheet* sheet = cache->QuirkSheet();
 
   if (needsQuirkSheet) {
     // quirk.css needs to come after html.css; we just keep it at the end.
     DebugOnly<nsresult> rv =
-      styleSet->AppendStyleSheet(SheetType::Agent, sheet);
+      styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsServo());
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css");
   } else {
     DebugOnly<nsresult> rv =
-      styleSet->RemoveStyleSheet(SheetType::Agent, sheet);
+      styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsServo());
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css");
   }
 
   mQuirkSheetAdded = needsQuirkSheet;
 }
 
 // Helper function for setting Anim Mode on image
 static void SetImgAnimModeOnImgReq(imgIRequest* aImgReq, uint16_t aMode)
@@ -1465,17 +1453,17 @@ GetPropagatedScrollbarStylesForViewport(
   Element* docElement = document->GetRootElement();
 
   // docElement might be null if we're doing this after removing it.
   if (!docElement) {
     return nullptr;
   }
 
   // Check the style on the document root element
-  StyleSetHandle styleSet = aPresContext->StyleSet();
+  ServoStyleSet* styleSet = aPresContext->StyleSet();
   RefPtr<ComputedStyle> rootStyle =
     styleSet->ResolveStyleFor(docElement, nullptr, LazyComputeBehavior::Allow);
   if (CheckOverflow(rootStyle->StyleDisplay(), aStyles)) {
     // tell caller we stole the overflow style from the root element
     return docElement;
   }
 
   // Don't look in the BODY for non-HTML documents or HTML documents
@@ -3017,17 +3005,17 @@ nsPresContext::GetBidiEngine()
 void
 nsPresContext::FlushFontFeatureValues()
 {
   if (!mShell) {
     return; // we've been torn down
   }
 
   if (mFontFeatureValuesDirty) {
-    StyleSetHandle styleSet = mShell->StyleSet();
+    ServoStyleSet* styleSet = mShell->StyleSet();
     mFontFeatureValuesLookup = styleSet->BuildFontFeatureValueSet();
     mFontFeatureValuesDirty = false;
   }
 }
 
 nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
                                      nsPresContextType aType)
   : nsPresContext(aDocument, aType)
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -218,17 +218,18 @@ public:
   nsIDocument* Document() const
   {
       NS_ASSERTION(!mShell || !mShell->GetDocument() ||
                    mShell->GetDocument() == mDocument,
                    "nsPresContext doesn't have the same document as nsPresShell!");
       return mDocument;
   }
 
-  mozilla::StyleSetHandle StyleSet() const { return GetPresShell()->StyleSet(); }
+  mozilla::ServoStyleSet* StyleSet() const
+    { return GetPresShell()->StyleSet(); }
 
   bool HasPendingMediaQueryUpdates() const
   {
     return !!mPendingMediaFeatureValuesChange;
   }
 
   nsCSSFrameConstructor* FrameConstructor()
     { return PresShell()->FrameConstructor(); }
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -4,18 +4,17 @@
  * 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/. */
 #include "nsButtonFrameRenderer.h"
 #include "nsCSSRendering.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSPseudoElements.h"
 #include "nsNameSpaceManager.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/Unused.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
 #include "nsFrame.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/Element.h"
 #include "Layers.h"
 #include "gfxPrefs.h"
@@ -554,17 +553,17 @@ nsButtonFrameRenderer::PaintBorder(
 /**
  * Call this when styles change
  */
 void
 nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext)
 {
   // get all the styles
   ComputedStyle* context = mFrame->Style();
-  StyleSetHandle styleSet = aPresContext->StyleSet();
+  ServoStyleSet* styleSet = aPresContext->StyleSet();
 
   // get styles assigned to -moz-inner-focus (ie dotted border on Windows)
   mInnerFocusStyle =
     styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
                                       CSSPseudoElementType::mozFocusInner,
                                       context);
 }
 
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -8,18 +8,16 @@
 
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsGkAtoms.h"
 #include "nsIDOMNode.h"
 #include "nsIFormControl.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsIDocument.h"
 
 using mozilla::dom::Element;
 using mozilla::dom::HTMLInputElement;
 using mozilla::dom::CallerType;
 
 nsColorControlFrame::nsColorControlFrame(ComputedStyle* aStyle)
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -28,18 +28,17 @@
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNode.h"
 #include "nsISelectControlFrame.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
 #include "nsListControlFrame.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
 #include "nsThemeConstants.h"
 #include "mozilla/Likely.h"
 #include <algorithm>
@@ -1385,17 +1384,17 @@ nsComboboxDisplayFrame::BuildDisplayList
 
 nsIFrame*
 nsComboboxControlFrame::CreateFrameForDisplayNode()
 {
   MOZ_ASSERT(mDisplayContent);
 
   // Get PresShell
   nsIPresShell *shell = PresShell();
-  StyleSetHandle styleSet = shell->StyleSet();
+  ServoStyleSet* styleSet = shell->StyleSet();
 
   // create the ComputedStyle for the anonymous block frame and text frame
   RefPtr<ComputedStyle> computedStyle;
   computedStyle = styleSet->
     ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
                                        mComputedStyle);
 
   RefPtr<ComputedStyle> textComputedStyle;
--- a/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/layout/forms/nsGfxButtonControlFrame.cpp
@@ -2,18 +2,16 @@
 /* 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/. */
 
 #include "nsGfxButtonControlFrame.h"
 #include "nsIFormControl.h"
 #include "nsGkAtoms.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsContentUtils.h"
 #include "nsTextNode.h"
 
 using namespace mozilla;
 
 nsGfxButtonControlFrame::nsGfxButtonControlFrame(ComputedStyle* aStyle)
   : nsHTMLButtonControlFrame(aStyle, kClassID)
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -15,18 +15,16 @@
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsFontMetrics.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLMeterElement.h"
 #include "nsCSSPseudoElements.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsThemeConstants.h"
 #include <algorithm>
 
 using namespace mozilla;
 using mozilla::dom::Element;
 using mozilla::dom::HTMLMeterElement;
 
 nsIFrame*
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -16,18 +16,16 @@
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsThemeConstants.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/EventStates.h"
 #include "nsContentUtils.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsCSSPseudoElements.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsThreadUtils.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/dom/MutationEventBinding.h"
 
 #ifdef ACCESSIBILITY
 #include "mozilla/a11y/AccTypes.h"
 #endif
 
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -15,18 +15,16 @@
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsFontMetrics.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLProgressElement.h"
 #include "nsCSSPseudoElements.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsThemeConstants.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsIFrame*
 NS_NewProgressFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -19,18 +19,17 @@
 #include "nsIDocument.h"
 #include "nsNameSpaceManager.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsPresContext.h"
 #include "nsNodeInfoManager.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsThemeConstants.h"
 
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
 #define LONG_SIDE_TO_SHORT_SIDE_RATIO 10
 
@@ -74,17 +73,17 @@ nsRangeFrame::Init(nsIContent*       aCo
   // input. Instead, we do it here so that the APZ finds out about it, and
   // makes sure to wait for content to run handlers before handling the touch
   // input itself.
   if (!mDummyTouchListener) {
     mDummyTouchListener = new DummyTouchListener();
   }
   aContent->AddEventListener(NS_LITERAL_STRING("touchstart"), mDummyTouchListener, false);
 
-  StyleSetHandle styleSet = PresContext()->StyleSet();
+  ServoStyleSet* styleSet = PresContext()->StyleSet();
 
   mOuterFocusStyle =
     styleSet->ProbePseudoElementStyle(aContent->AsElement(),
                                       CSSPseudoElementType::mozFocusOuter,
                                       Style());
 
   return nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
 }
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -35,18 +35,16 @@
 
 #include "nsFocusManager.h"
 #include "nsPresState.h"
 #include "nsAttrValueInlines.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/TextEditRules.h"
 #include "nsContentUtils.h"
 #include "nsTextNode.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/Text.h"
 #include "mozilla/MathAlgorithms.h"
 #include "nsFrameSelection.h"
 
 #define DEFAULT_COLUMN_WIDTH 20
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -51,18 +51,16 @@
 #include "nsIFrameInlines.h"
 #include "CounterStyleManager.h"
 #include "nsISelection.h"
 #include "mozilla/dom/HTMLDetailsElement.h"
 #include "mozilla/dom/HTMLSummaryElement.h"
 #include "mozilla/RestyleManagerInlines.h"
 #include "mozilla/ServoRestyleManager.h"
 #include "mozilla/ServoStyleSet.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/Telemetry.h"
 
 #include "nsBidiPresUtils.h"
 
 #include <inttypes.h>
 
 static const int MIN_LINES_NEEDING_CURSOR = 20;
 
@@ -7548,17 +7546,17 @@ nsBlockFrame::UpdatePseudoElementStyles(
     for (nsIFrame* kid : firstLineFrame->PrincipalChildList()) {
       manager->ReparentComputedStyle(kid);
     }
   }
 }
 
 already_AddRefed<ComputedStyle>
 nsBlockFrame::ResolveBulletStyle(CSSPseudoElementType aType,
-                                 StyleSetHandle aStyleSet)
+                                 ServoStyleSet* aStyleSet)
 {
   ComputedStyle* parentStyle =
     CorrectStyleParentFrame(this,
                             nsCSSPseudoElements::GetPseudoAtom(aType))->
     Style();
 
   return aStyleSet->ResolvePseudoElementStyle(mContent->AsElement(), aType,
                                               parentStyle, nullptr);
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -40,17 +40,17 @@ enum class LineReflowStatus {
   Truncated
 };
 
 class nsBlockInFlowLineIterator;
 class nsBulletFrame;
 namespace mozilla {
 class BlockReflowInput;
 class ServoRestyleState;
-class StyleSetHandle;
+class ServoStyleSet;
 } // namespace mozilla
 
 /**
  * Some invariants:
  * -- The overflow out-of-flows list contains the out-of-
  * flow frames whose placeholders are in the overflow list.
  * -- A given piece of content has at most one placeholder
  * frame in a block's normal child list.
@@ -938,17 +938,17 @@ protected:
   // Remove and return the pushed floats list.
   nsFrameList* RemovePushedFloats();
 
   // Resolve a ComputedStyle for our bullet frame.  aType should be
   // mozListBullet or mozListNumber.  Passing in the style set is an
   // optimization, because all callsites have it.
   already_AddRefed<ComputedStyle> ResolveBulletStyle(
     mozilla::CSSPseudoElementType aType,
-    mozilla::StyleSetHandle aStyleSet);
+    mozilla::ServoStyleSet* aStyleSet);
 
 #ifdef DEBUG
   void VerifyLines(bool aFinalCheckOK);
   void VerifyOverflowSituation();
   int32_t GetDepth() const;
 #endif
 
   nscoord mMinWidth, mPrefWidth;
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -7,18 +7,17 @@
 /* rendering object for CSS :first-letter pseudo-element */
 
 #include "nsFirstLetterFrame.h"
 #include "nsPresContext.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsIContent.h"
 #include "nsLineLayout.h"
 #include "nsGkAtoms.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsFrameManager.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/RestyleManagerInlines.h"
 #include "nsPlaceholderFrame.h"
 #include "nsCSSFrameConstructor.h"
 
 using namespace mozilla;
 using namespace mozilla::layout;
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -24,18 +24,17 @@
 #include "nsPresContext.h"
 #include "nsIContentInlines.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsHTMLParts.h"
 #include "nsNameSpaceManager.h"
 #include "nsCSSAnonBoxes.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/dom/Element.h"
 #include "nsDisplayList.h"
 #include "nsNodeUtils.h"
 #include "mozAutoDocUpdate.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/HTMLFrameSetElement.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
@@ -798,17 +797,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
                             nsReflowStatus&          aStatus)
 {
   MarkInReflow();
   DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
   MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
 
   nsIPresShell *shell = aPresContext->PresShell();
-  StyleSetHandle styleSet = shell->StyleSet();
+  ServoStyleSet* styleSet = shell->StyleSet();
 
   GetParent()->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
 
   //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight());
   // Always get the size so that the caller knows how big we are
   GetDesiredSize(aPresContext, aReflowInput, aDesiredSize);
 
   nscoord width  = (aDesiredSize.Width() <= aReflowInput.AvailableWidth())
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -66,18 +66,17 @@
 
 #include "nsError.h"
 #include "nsBidiUtils.h"
 #include "nsBidiPresUtils.h"
 
 #include "gfxRect.h"
 #include "ImageLayers.h"
 #include "ImageContainer.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsBlockFrame.h"
 #include "nsStyleStructInlines.h"
 
 #include "mozilla/Preferences.h"
 
 #include "mozilla/dom/Link.h"
 #include "SVGImageContext.h"
 #include "mozilla/dom/HTMLAnchorElement.h"
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -17,18 +17,16 @@
 #include "nsCSSAnonBoxes.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/RestyleManagerInlines.h"
 #include "nsDisplayList.h"
 #include "mozilla/Likely.h"
 #include "SVGTextFrame.h"
 #include "nsStyleChangeList.h"
 #include "mozilla/ComputedStyle.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/ServoStyleSet.h"
 
 #ifdef DEBUG
 #undef NOISY_PUSHING
 #endif
 
 using namespace mozilla;
 using namespace mozilla::layout;
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -61,18 +61,17 @@
 #include "nsGkAtoms.h"
 #include "nsFrameSelection.h"
 #include "nsRange.h"
 #include "nsCSSRendering.h"
 #include "nsContentUtils.h"
 #include "nsLineBreaker.h"
 #include "nsIFrameInlines.h"
 #include "mozilla/intl/WordBreaker.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/layers/LayersMessages.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
 #include "mozilla/layers/WebRenderBridgeChild.h"
 #include "mozilla/webrender/WebRenderAPI.h"
 #include "mozilla/layers/StackingContextHelper.h"
 
 #include <algorithm>
 #include <limits>
--- a/layout/inspector/InspectorUtils.cpp
+++ b/layout/inspector/InspectorUtils.cpp
@@ -34,17 +34,17 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/CSSLexer.h"
 #include "mozilla/dom/InspectorUtilsBinding.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "nsCSSParser.h"
 #include "nsCSSProps.h"
 #include "nsCSSValue.h"
 #include "nsColor.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsStyleUtil.h"
 #include "nsQueryObject.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleRule.h"
 #include "mozilla/ServoStyleRuleMap.h"
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/dom/InspectorUtils.h"
 #include "mozilla/dom/InspectorFontFace.h"
@@ -62,17 +62,17 @@ namespace dom {
 InspectorUtils::GetAllStyleSheets(GlobalObject& aGlobalObject,
                                   nsIDocument& aDocument,
                                   nsTArray<RefPtr<StyleSheet>>& aResult)
 {
   // Get the agent, then user and finally xbl sheets in the style set.
   nsIPresShell* presShell = aDocument.GetShell();
 
   if (presShell) {
-    StyleSetHandle styleSet = presShell->StyleSet();
+    ServoStyleSet* styleSet = presShell->StyleSet();
     SheetType sheetType = SheetType::Agent;
     for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) {
       aResult.AppendElement(styleSet->StyleSheetAt(sheetType, i));
     }
     sheetType = SheetType::User;
     for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) {
       aResult.AppendElement(styleSet->StyleSheetAt(sheetType, i));
     }
@@ -182,17 +182,17 @@ InspectorUtils::GetCSSStyleRules(GlobalO
     return;
   }
 
   nsTArray<const RawServoStyleRule*> rawRuleList;
   Servo_ComputedValues_GetStyleRuleList(computedStyle, &rawRuleList);
 
   AutoTArray<ServoStyleRuleMap*, 1> maps;
   {
-    ServoStyleSet* styleSet = shell->StyleSet()->AsServo();
+    ServoStyleSet* styleSet = shell->StyleSet();
     ServoStyleRuleMap* map = styleSet->StyleRuleMap();
     maps.AppendElement(map);
   }
 
   // Collect style rule maps for bindings.
   for (nsIContent* bindingContent = &aElement; bindingContent;
        bindingContent = bindingContent->GetBindingParent()) {
     for (nsXBLBinding* binding = bindingContent->GetXBLBinding();
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -12,18 +12,17 @@
 #include "nsLayoutUtils.h"
 #include "nsNameSpaceManager.h"
 #include "nsMathMLChar.h"
 #include "nsCSSPseudoElements.h"
 #include "nsMathMLElement.h"
 #include "gfxMathTable.h"
 
 // used to map attributes into CSS rules
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsDisplayList.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 eMathMLFrameType
 nsMathMLFrame::GetMathMLFrameType()
 {
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -114,18 +114,17 @@ static const char kPrintingPromptService
 #include "nsCDefaultURIFixup.h"
 #include "nsIURIFixup.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLFrameElement.h"
 #include "nsContentList.h"
 #include "nsIChannel.h"
 #include "xpcpublic.h"
 #include "nsVariant.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //-----------------------------------------------------
 // PR LOGGING
 #include "mozilla/Logging.h"
 
@@ -2340,41 +2339,42 @@ nsPrintJob::ReflowPrintObject(const Uniq
   nsresult rv = aPO->mPresContext->Init(printData->mPrintDC);
   NS_ENSURE_SUCCESS(rv, rv);
 
   aPO->mViewManager = new nsViewManager();
 
   rv = aPO->mViewManager->Init(printData->mPrintDC);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  StyleSetHandle styleSet = mDocViewerPrint->CreateStyleSet(aPO->mDocument);
+  UniquePtr<ServoStyleSet> styleSet =
+    mDocViewerPrint->CreateStyleSet(aPO->mDocument);
 
   if (aPO->mDocument->IsSVGDocument()) {
     // The SVG document only loads minimal-xul.css, so it doesn't apply other
     // styles. We should add ua.css for applying style which related to print.
     auto cache = nsLayoutStylesheetCache::Singleton();
-    styleSet->PrependStyleSheet(SheetType::Agent, cache->UASheet());
+    styleSet->PrependStyleSheet(SheetType::Agent, cache->UASheet()->AsServo());
   }
 
   aPO->mPresShell = aPO->mDocument->CreateShell(aPO->mPresContext,
-                                                aPO->mViewManager, styleSet);
+                                                aPO->mViewManager,
+                                                Move(styleSet));
   if (!aPO->mPresShell) {
-    styleSet->Delete();
     return NS_ERROR_FAILURE;
   }
 
   // If we're printing selection then remove the unselected nodes from our
   // cloned document.
   int16_t printRangeType = nsIPrintSettings::kRangeAllPages;
   printData->mPrintSettings->GetPrintRange(&printRangeType);
   if (printRangeType == nsIPrintSettings::kRangeSelection) {
     DeleteUnselectedNodes(aPO->mDocument->GetOriginalDocument(), aPO->mDocument);
   }
 
-  styleSet->EndUpdate();
+  aPO->mPresShell->StyleSet()->EndUpdate();
 
   // The pres shell now owns the style set object.
 
 
   bool doReturn = false;;
   bool documentIsTopLevel = false;
   nsSize adjSize;
 
--- a/layout/style/ComputedStyle.cpp
+++ b/layout/style/ComputedStyle.cpp
@@ -25,18 +25,16 @@
 
 #include "GeckoProfiler.h"
 #include "nsIDocument.h"
 #include "nsPrintfCString.h"
 #include "RubyUtils.h"
 #include "mozilla/ArenaObjectID.h"
 #include "mozilla/ComputedStyleInlines.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 
 #include "mozilla/ReflowInput.h"
 #include "nsLayoutUtils.h"
 #include "nsCoord.h"
 
 // Ensure the binding function declarations in ComputedStyle.h matches
 // those in ServoBindings.h.
 #include "mozilla/ServoBindings.h"
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -9,17 +9,16 @@
 #ifndef _ComputedStyle_h_
 #define _ComputedStyle_h_
 
 #include "nsIMemoryReporter.h"
 #include <algorithm>
 #include "mozilla/ArenaObjectID.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/RestyleLogging.h"
-#include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoTypes.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/StyleComplexColor.h"
 #include "mozilla/CachedInheritingStyles.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSPseudoElements.h"
 
 // Includes nsStyleStructID.
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -12,18 +12,17 @@
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Types.h"
 #include "mozilla/WritingModes.h"
 #include "nsCSSCounterStyleRule.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsTHashtable.h"
 #include "nsUnicodeProperties.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 
 namespace mozilla {
 
 struct AdditiveSymbol
 {
   CounterValue weight;
   nsString symbol;
 };
@@ -2030,17 +2029,17 @@ CounterStyleManager::BuildCounterStyle(n
   MOZ_ASSERT(NS_IsMainThread());
   CounterStyle* data = GetCounterStyle(aName);
   if (data) {
     return data;
   }
 
   // Names are compared case-sensitively here. Predefined names should
   // have been lowercased by the parser.
-  StyleSetHandle styleSet = mPresContext->StyleSet();
+  ServoStyleSet* styleSet = mPresContext->StyleSet();
   nsCSSCounterStyleRule* rule = styleSet->CounterStyleRuleForName(aName);
   if (rule) {
     MOZ_ASSERT(rule->Name() == aName);
     data = new (mPresContext) CustomCounterStyle(aName, this, rule);
   } else {
     for (const BuiltinCounterStyle& item : gBuiltinStyleTable) {
       if (item.GetStyleName() == aName) {
         int32_t style = item.GetStyle();
@@ -2081,17 +2080,17 @@ CounterStyleManager::GetStyleNameFromTyp
 bool
 CounterStyleManager::NotifyRuleChanged()
 {
   bool changed = false;
   for (auto iter = mStyles.Iter(); !iter.Done(); iter.Next()) {
     CounterStyle* style = iter.Data();
     bool toBeUpdated = false;
     bool toBeRemoved = false;
-    StyleSetHandle styleSet = mPresContext->StyleSet();
+    ServoStyleSet* styleSet = mPresContext->StyleSet();
     nsCSSCounterStyleRule* newRule = styleSet->CounterStyleRuleForName(iter.Key());
     if (!newRule) {
       if (style->IsCustomStyle()) {
         toBeRemoved = true;
       }
     } else {
       if (!style->IsCustomStyle()) {
         toBeRemoved = true;
--- a/layout/style/ServoMediaList.cpp
+++ b/layout/style/ServoMediaList.cpp
@@ -89,14 +89,14 @@ ServoMediaList::Delete(const nsAString& 
   }
   return NS_ERROR_DOM_NOT_FOUND_ERR;
 }
 
 bool
 ServoMediaList::Matches(nsPresContext* aPresContext) const
 {
   const RawServoStyleSet* rawSet =
-    aPresContext->StyleSet()->AsServo()->RawSet();
+    aPresContext->StyleSet()->RawSet();
   MOZ_ASSERT(rawSet, "The RawServoStyleSet should be valid!");
   return Servo_MediaList_Matches(mRawList, rawSet);
 }
 
 } // namespace mozilla
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -6,17 +6,16 @@
 
 #include "mozilla/ServoStyleSheet.h"
 
 #include "mozilla/css/Rule.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoCSSRuleList.h"
 #include "mozilla/ServoImportRule.h"
 #include "mozilla/ServoMediaList.h"
-#include "mozilla/ServoStyleSet.h"
 #include "mozilla/css/GroupRule.h"
 #include "mozilla/dom/CSSRuleList.h"
 #include "mozilla/dom/MediaList.h"
 #include "nsIStyleSheetLinkingElement.h"
 #include "Loader.h"
 
 
 #include "mozAutoDocUpdate.h"
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -6,18 +6,17 @@
 
 /* Utilities for animation of computed style values */
 
 #include "mozilla/StyleAnimationValue.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/Tuple.h"
 #include "mozilla/UniquePtr.h"
 #include "nsAutoPtr.h"
 #include "nsCOMArray.h"
 #include "nsString.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsComputedDOMStyle.h"
 #include "nsContentUtils.h"
@@ -236,20 +235,18 @@ AnimationValue::FromString(nsCSSProperty
   RefPtr<RawServoDeclarationBlock> declarations =
     ServoCSSParser::ParseProperty(aProperty, aValue,
                                   ServoCSSParser::GetParsingEnvironment(doc));
 
   if (!declarations) {
     return result;
   }
 
-  result.mServo =
-    shell->StyleSet()->AsServo()->ComputeAnimationValue(aElement,
-                                                        declarations,
-                                                        computedStyle);
+  result.mServo = shell->StyleSet()->
+    ComputeAnimationValue(aElement, declarations, computedStyle);
   return result;
 }
 
 /* static */ AnimationValue
 AnimationValue::Opacity(float aOpacity)
 {
   AnimationValue result;
   result.mServo = Servo_AnimationValue_Opacity(aOpacity).Consume();
deleted file mode 100644
--- a/layout/style/StyleSetHandle.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_StyleSetHandle_h
-#define mozilla_StyleSetHandle_h
-
-#include "mozilla/AtomArray.h"
-#include "mozilla/EventStates.h"
-#include "mozilla/MediaFeatureChange.h"
-#include "mozilla/RefPtr.h"
-#include "mozilla/ServoTypes.h"
-#include "mozilla/SheetType.h"
-#include "mozilla/StyleSheet.h"
-#include "nsChangeHint.h"
-#include "nsCSSPseudoElements.h"
-#include "nsTArray.h"
-
-class nsBindingManager;
-class nsCSSCounterStyleRule;
-struct nsFontFaceRuleContainer;
-class nsAtom;
-class nsICSSAnonBoxPseudo;
-class nsIContent;
-class nsIDocument;
-class nsStyleSet;
-class nsPresContext;
-class gfxFontFeatureValueSet;
-
-namespace mozilla {
-
-class ComputedStyle;
-class CSSStyleSheet;
-class ServoStyleSet;
-namespace dom {
-class Element;
-class ShadowRoot;
-} // namespace dom
-namespace css {
-class Rule;
-} // namespace css
-
-/**
- * Smart pointer class that can hold a pointer to either an nsStyleSet
- * or a ServoStyleSet.
- */
-class StyleSetHandle
-{
-public:
-  // We define this Ptr class with a StyleSet API that forwards on to the
-  // wrapped pointer, rather than putting these methods on StyleSetHandle
-  // itself, so that we can have StyleSetHandle behave like a smart pointer and
-  // be dereferenced with operator->.
-  class Ptr
-  {
-  public:
-    friend class ::mozilla::StyleSetHandle;
-
-    ServoStyleSet* AsServo()
-    {
-      return reinterpret_cast<ServoStyleSet*>(mValue);
-    }
-
-    ServoStyleSet* GetAsServo() { return AsServo(); }
-
-
-    const ServoStyleSet* AsServo() const
-    {
-      return const_cast<Ptr*>(this)->AsServo();
-    }
-
-    const ServoStyleSet* GetAsServo() const { return AsServo(); }
-
-    // These inline methods are defined in StyleSetHandleInlines.h.
-    inline void Delete();
-
-    // Style set interface.  These inline methods are defined in
-    // StyleSetHandleInlines.h and just forward to the underlying
-    // nsStyleSet or ServoStyleSet.  See corresponding comments in
-    // nsStyleSet.h for descriptions of these methods.
-
-    inline void Init(nsPresContext* aPresContext);
-    inline void BeginShutdown();
-    inline void Shutdown();
-    inline bool GetAuthorStyleDisabled() const;
-    inline void SetAuthorStyleDisabled(bool aStyleDisabled);
-    inline void BeginUpdate();
-    inline nsresult EndUpdate();
-    inline already_AddRefed<ComputedStyle>
-    ResolveStyleFor(dom::Element* aElement,
-                    ComputedStyle* aParentContext,
-                    LazyComputeBehavior aMayCompute);
-    inline already_AddRefed<ComputedStyle>
-    ResolveStyleFor(dom::Element* aElement, LazyComputeBehavior aMayCompute);
-
-    // TODO(emilio): This might be nicer (albeit a bit slower) if we just grab
-    // the style from the parent in ServoStyleSet.
-    //
-    // It may be faster if we account not having to pass it around in
-    // nsCSSFrameConstructor though.
-    inline already_AddRefed<ComputedStyle>
-    ResolveStyleForText(nsIContent* aTextNode, ComputedStyle* aParentContext);
-
-    inline already_AddRefed<ComputedStyle>
-    ResolveStyleForFirstLetterContinuation(ComputedStyle* aParentContext);
-    inline already_AddRefed<ComputedStyle>
-    ResolveStyleForPlaceholder();
-    inline already_AddRefed<ComputedStyle>
-    ResolvePseudoElementStyle(dom::Element* aParentElement,
-                              mozilla::CSSPseudoElementType aType,
-                              ComputedStyle* aParentContext,
-                              dom::Element* aPseudoElement);
-    inline already_AddRefed<ComputedStyle>
-    ResolveInheritingAnonymousBoxStyle(nsAtom* aPseudoTag,
-                                       ComputedStyle* aParentContext);
-    inline already_AddRefed<ComputedStyle>
-    ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag);
-#ifdef MOZ_XUL
-    inline already_AddRefed<ComputedStyle>
-    ResolveXULTreePseudoStyle(dom::Element* aParentElement,
-                              nsICSSAnonBoxPseudo* aPseudoTag,
-                              ComputedStyle* aParentContext,
-                              const AtomArray& aInputWord);
-#endif
-    inline nsresult AppendStyleSheet(SheetType aType, StyleSheet* aSheet);
-    inline nsresult PrependStyleSheet(SheetType aType, StyleSheet* aSheet);
-    inline nsresult RemoveStyleSheet(SheetType aType, StyleSheet* aSheet);
-    inline nsresult ReplaceSheets(SheetType aType,
-                           const nsTArray<RefPtr<StyleSheet>>& aNewSheets);
-    inline nsresult InsertStyleSheetBefore(SheetType aType,
-                                    StyleSheet* aNewSheet,
-                                    StyleSheet* aReferenceSheet);
-    inline int32_t SheetCount(SheetType aType) const;
-    inline StyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const;
-    inline void AppendAllXBLStyleSheets(nsTArray<StyleSheet*>& aArray) const;
-    inline nsresult RemoveDocStyleSheet(StyleSheet* aSheet);
-    inline nsresult AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument);
-
-    inline void RuleRemoved(StyleSheet&, css::Rule&);
-    inline void RuleAdded(StyleSheet&, css::Rule&);
-    inline void RuleChanged(StyleSheet&, css::Rule*);
-
-    inline void RecordShadowStyleChange(mozilla::dom::ShadowRoot& aShadowRoot);
-    inline bool StyleSheetsHaveChanged() const;
-    inline void InvalidateStyleForCSSRuleChanges();
-    inline nsRestyleHint MediumFeaturesChanged(mozilla::MediaFeatureChangeReason);
-    inline already_AddRefed<ComputedStyle>
-    ProbePseudoElementStyle(dom::Element* aParentElement,
-                            mozilla::CSSPseudoElementType aType,
-                            ComputedStyle* aParentContext);
-    inline already_AddRefed<ComputedStyle>
-    ProbePseudoElementStyle(dom::Element* aParentElement,
-                            mozilla::CSSPseudoElementType aType);
-
-    inline bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
-    inline nsCSSCounterStyleRule* CounterStyleRuleForName(nsAtom* aName);
-    inline already_AddRefed<gfxFontFeatureValueSet> BuildFontFeatureValueSet();
-
-    inline bool EnsureUniqueInnerOnCSSSheets();
-    inline void SetNeedsRestyleAfterEnsureUniqueInner();
-
-  private:
-    // Stores a pointer to an nsStyleSet or a ServoStyleSet.  The least
-    // significant bit is 0 for the former, 1 for the latter.  This is
-    // valid as the least significant bit will never be used for a pointer
-    // value on platforms we care about.
-    uintptr_t mValue;
-  };
-
-  StyleSetHandle() { mPtr.mValue = 0; }
-  StyleSetHandle(const StyleSetHandle& aOth) { mPtr.mValue = aOth.mPtr.mValue; }
-  MOZ_IMPLICIT StyleSetHandle(nsStyleSet* aSet) { *this = aSet; }
-  MOZ_IMPLICIT StyleSetHandle(ServoStyleSet* aSet) { *this = aSet; }
-
-  StyleSetHandle& operator=(nsStyleSet* aStyleSet)
-  {
-    mPtr.mValue = reinterpret_cast<uintptr_t>(aStyleSet);
-    return *this;
-  }
-
-  StyleSetHandle& operator=(ServoStyleSet* aStyleSet)
-  {
-    mPtr.mValue =
-      aStyleSet ? reinterpret_cast<uintptr_t>(aStyleSet) : 0;
-    return *this;
-  }
-
-  // Make StyleSetHandle usable in boolean contexts.
-  explicit operator bool() const { return !!mPtr.mValue; }
-  bool operator!() const { return !mPtr.mValue; }
-  bool operator==(const StyleSetHandle& aOth) const
-  {
-    return mPtr.mValue == aOth.mPtr.mValue;
-  }
-  bool operator!=(const StyleSetHandle& aOth) const { return !(*this == aOth); }
-
-  // Make StyleSetHandle behave like a smart pointer.
-  Ptr* operator->() { return &mPtr; }
-  const Ptr* operator->() const { return &mPtr; }
-
-private:
-  Ptr mPtr;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_StyleSetHandle_h
deleted file mode 100644
--- a/layout/style/StyleSetHandleInlines.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_StyleSetHandleInlines_h
-#define mozilla_StyleSetHandleInlines_h
-
-#include "mozilla/StyleSheetInlines.h"
-#include "mozilla/ComputedStyle.h"
-#include "mozilla/ServoStyleSet.h"
-#include "mozilla/ComputedStyle.h"
-
-
-#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
-  return AsServo()->method_ servoargs_;
-
-
-#define FORWARD(method_, args_) FORWARD_CONCRETE(method_, args_, args_)
-
-namespace mozilla {
-
-void
-StyleSetHandle::Ptr::Delete()
-{
-  if (mValue) {
-    delete AsServo();
-  }
-}
-
-void
-StyleSetHandle::Ptr::Init(nsPresContext* aPresContext)
-{
-  FORWARD(Init, (aPresContext));
-}
-
-void
-StyleSetHandle::Ptr::BeginShutdown()
-{
-  FORWARD(BeginShutdown, ());
-}
-
-void
-StyleSetHandle::Ptr::Shutdown()
-{
-  FORWARD(Shutdown, ());
-}
-
-bool
-StyleSetHandle::Ptr::GetAuthorStyleDisabled() const
-{
-  FORWARD(GetAuthorStyleDisabled, ());
-}
-
-void
-StyleSetHandle::Ptr::SetAuthorStyleDisabled(bool aStyleDisabled)
-{
-  FORWARD(SetAuthorStyleDisabled, (aStyleDisabled));
-}
-
-void
-StyleSetHandle::Ptr::BeginUpdate()
-{
-  FORWARD(BeginUpdate, ());
-}
-
-nsresult
-StyleSetHandle::Ptr::EndUpdate()
-{
-  FORWARD(EndUpdate, ());
-}
-
-// resolve a ComputedStyle
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
-                                     ComputedStyle* aParentStyle,
-                                     LazyComputeBehavior aMayCompute)
-{
-  FORWARD(ResolveStyleFor, (aElement, aParentStyle, aMayCompute));
-}
-
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveStyleForText(nsIContent* aTextNode,
-                                         ComputedStyle* aParentStyle)
-{
-  FORWARD(ResolveStyleForText, (aTextNode, aParentStyle));
-}
-
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveStyleForPlaceholder()
-{
-  FORWARD(ResolveStyleForPlaceholder, ());
-}
-
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveStyleForFirstLetterContinuation(ComputedStyle* aParentStyle)
-{
-  FORWARD(ResolveStyleForFirstLetterContinuation, (aParentStyle));
-}
-
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolvePseudoElementStyle(dom::Element* aParentElement,
-                                               CSSPseudoElementType aType,
-                                               ComputedStyle* aParentStyle,
-                                               dom::Element* aPseudoElement)
-{
-  FORWARD(ResolvePseudoElementStyle, (aParentElement, aType, aParentStyle, aPseudoElement));
-}
-
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveInheritingAnonymousBoxStyle(nsAtom* aPseudoTag,
-                                                        ComputedStyle* aParentStyle)
-{
-  FORWARD(ResolveInheritingAnonymousBoxStyle, (aPseudoTag, aParentStyle));
-}
-
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag)
-{
-  FORWARD(ResolveNonInheritingAnonymousBoxStyle, (aPseudoTag));
-}
-
-#ifdef MOZ_XUL
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ResolveXULTreePseudoStyle(dom::Element* aParentElement,
-                                               nsICSSAnonBoxPseudo* aPseudoTag,
-                                               ComputedStyle* aParentStyle,
-                                               const AtomArray& aInputWord)
-{
-  FORWARD(ResolveXULTreePseudoStyle, (aParentElement, aPseudoTag, aParentStyle, aInputWord));
-}
-#endif
-
-// manage the set of style sheets in the style set
-nsresult
-StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet)
-{
-  FORWARD_CONCRETE(AppendStyleSheet, (aType, aSheet->AsGecko()),
-                                     (aType, aSheet->AsServo()));
-}
-
-nsresult
-StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheet* aSheet)
-{
-  FORWARD_CONCRETE(PrependStyleSheet, (aType, aSheet->AsGecko()),
-                                      (aType, aSheet->AsServo()));
-}
-
-nsresult
-StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet)
-{
-  FORWARD_CONCRETE(RemoveStyleSheet, (aType, aSheet->AsGecko()),
-                                     (aType, aSheet->AsServo()));
-}
-
-nsresult
-StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
-                       const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
-{
-  nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
-  for (auto& sheet : aNewSheets) {
-    newSheets.AppendElement(sheet->AsServo());
-  }
-  return AsServo()->ReplaceSheets(aType, newSheets);
-}
-
-nsresult
-StyleSetHandle::Ptr::InsertStyleSheetBefore(SheetType aType,
-                                StyleSheet* aNewSheet,
-                                StyleSheet* aReferenceSheet)
-{
-  FORWARD_CONCRETE(
-    InsertStyleSheetBefore,
-    (aType, aNewSheet->AsGecko(), aReferenceSheet->AsGecko()),
-    (aType, aNewSheet->AsServo(), aReferenceSheet->AsServo()));
-}
-
-int32_t
-StyleSetHandle::Ptr::SheetCount(SheetType aType) const
-{
-  FORWARD(SheetCount, (aType));
-}
-
-StyleSheet*
-StyleSetHandle::Ptr::StyleSheetAt(SheetType aType, int32_t aIndex) const
-{
-  FORWARD(StyleSheetAt, (aType, aIndex));
-}
-
-void
-StyleSetHandle::Ptr::AppendAllXBLStyleSheets(nsTArray<StyleSheet*>& aArray) const
-{
-  FORWARD(AppendAllXBLStyleSheets, (aArray));
-}
-
-nsresult
-StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheet* aSheet)
-{
-  FORWARD_CONCRETE(RemoveDocStyleSheet, (aSheet->AsGecko()),
-                                        (aSheet->AsServo()));
-}
-
-nsresult
-StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheet* aSheet,
-                                      nsIDocument* aDocument)
-{
-  FORWARD_CONCRETE(AddDocStyleSheet, (aSheet->AsGecko(), aDocument),
-                                     (aSheet->AsServo(), aDocument));
-}
-
-void
-StyleSetHandle::Ptr::RuleRemoved(StyleSheet& aSheet, css::Rule& aRule)
-{
-  FORWARD_CONCRETE(RuleRemoved, (*aSheet.AsGecko(), aRule),
-                                (*aSheet.AsServo(), aRule));
-}
-
-void
-StyleSetHandle::Ptr::RuleAdded(StyleSheet& aSheet, css::Rule& aRule)
-{
-  FORWARD_CONCRETE(RuleAdded, (*aSheet.AsGecko(), aRule),
-                              (*aSheet.AsServo(), aRule));
-}
-
-void
-StyleSetHandle::Ptr::RuleChanged(StyleSheet& aSheet, css::Rule* aRule)
-{
-  FORWARD_CONCRETE(RuleChanged, (*aSheet.AsGecko(), aRule),
-                                (*aSheet.AsServo(), aRule));
-}
-
-void
-StyleSetHandle::Ptr::RecordShadowStyleChange(mozilla::dom::ShadowRoot& aShadowRoot)
-{
-  FORWARD(RecordShadowStyleChange, (aShadowRoot));
-}
-
-bool
-StyleSetHandle::Ptr::StyleSheetsHaveChanged() const
-{
-  FORWARD(StyleSheetsHaveChanged, ());
-}
-nsRestyleHint
-StyleSetHandle::Ptr::MediumFeaturesChanged(mozilla::MediaFeatureChangeReason aReason)
-{
-  FORWARD(MediumFeaturesChanged, (aReason));
-}
-void
-StyleSetHandle::Ptr::InvalidateStyleForCSSRuleChanges()
-{
-  FORWARD(InvalidateStyleForCSSRuleChanges, ());
-}
-
-// check whether there is ::before/::after style for an element
-already_AddRefed<ComputedStyle>
-StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
-                                             CSSPseudoElementType aType,
-                                             ComputedStyle* aParentStyle)
-{
-  FORWARD(ProbePseudoElementStyle, (aParentElement, aType, aParentStyle));
-}
-
-bool
-StyleSetHandle::Ptr::
-AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
-{
-  FORWARD(AppendFontFaceRules, (aArray));
-}
-
-nsCSSCounterStyleRule*
-StyleSetHandle::Ptr::CounterStyleRuleForName(nsAtom* aName)
-{
-  FORWARD(CounterStyleRuleForName, (aName));
-}
-
-already_AddRefed<gfxFontFeatureValueSet>
-StyleSetHandle::Ptr::BuildFontFeatureValueSet()
-{
-  FORWARD(BuildFontFeatureValueSet, ());
-}
-
-bool
-StyleSetHandle::Ptr::EnsureUniqueInnerOnCSSSheets()
-{
-  FORWARD(EnsureUniqueInnerOnCSSSheets, ());
-}
-
-void
-StyleSetHandle::Ptr::SetNeedsRestyleAfterEnsureUniqueInner()
-{
-  FORWARD(SetNeedsRestyleAfterEnsureUniqueInner, ());
-}
-
-} // namespace mozilla
-
-#undef FORWARD
-
-#endif // mozilla_StyleSetHandleInlines_h
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -12,17 +12,16 @@
 #include "mozilla/dom/CSSRuleList.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/MediaList.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/ShadowRootBinding.h"
 #include "mozilla/ServoCSSRuleList.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoStyleSheet.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/StyleSheetInlines.h"
 
 #include "mozAutoDocUpdate.h"
 #include "NullPrincipal.h"
 
 namespace mozilla {
 
 StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode)
@@ -355,25 +354,25 @@ void
 StyleSheet::WillDirty()
 {
   if (mInner->mComplete) {
     EnsureUniqueInner();
   }
 }
 
 void
-StyleSheet::AddStyleSet(const StyleSetHandle& aStyleSet)
+StyleSheet::AddStyleSet(ServoStyleSet* aStyleSet)
 {
   NS_ASSERTION(!mStyleSets.Contains(aStyleSet),
                "style set already registered");
   mStyleSets.AppendElement(aStyleSet);
 }
 
 void
-StyleSheet::DropStyleSet(const StyleSetHandle& aStyleSet)
+StyleSheet::DropStyleSet(ServoStyleSet* aStyleSet)
 {
   DebugOnly<bool> found = mStyleSets.RemoveElement(aStyleSet);
   NS_ASSERTION(found, "didn't find style set");
 }
 
 void
 StyleSheet::EnsureUniqueInner()
 {
@@ -394,17 +393,17 @@ StyleSheet::EnsureUniqueInner()
   // 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();
 
   // let our containing style sets know that if we call
   // nsPresContext::EnsureSafeToHandOutCSSRules we will need to restyle the
   // document
-  for (StyleSetHandle& setHandle : mStyleSets) {
+  for (ServoStyleSet* setHandle : mStyleSets) {
     setHandle->SetNeedsRestyleAfterEnsureUniqueInner();
   }
 }
 
 void
 StyleSheet::AppendAllChildSheets(nsTArray<StyleSheet*>& aArray)
 {
   for (StyleSheet* child = GetFirstChild(); child; child = child->mNext) {
@@ -522,56 +521,56 @@ StyleSheet::GetContainingShadow() const
   }
 
   return mOwningNode->AsContent()->GetContainingShadow();
 }
 
 #define NOTIFY(function_, args_) do {                     \
   StyleSheet* current = this;                             \
   do {                                                    \
-    for (StyleSetHandle handle : current->mStyleSets) {   \
+    for (ServoStyleSet* handle : current->mStyleSets) {   \
       handle->function_ args_;                            \
     }                                                     \
     if (auto* shadow = current->GetContainingShadow()) {  \
       shadow->function_ args_;                            \
     }                                                     \
     current = current->mParent;                           \
   } while (current);                                      \
 } while (0)
 
 void
 StyleSheet::RuleAdded(css::Rule& aRule)
 {
   DidDirty();
   mDirtyFlags |= MODIFIED_RULES;
-  NOTIFY(RuleAdded, (*this, aRule));
+  NOTIFY(RuleAdded, (*AsServo(), aRule));
 
   if (mDocument) {
     mDocument->StyleRuleAdded(this, &aRule);
   }
 }
 
 void
 StyleSheet::RuleRemoved(css::Rule& aRule)
 {
   DidDirty();
   mDirtyFlags |= MODIFIED_RULES;
-  NOTIFY(RuleRemoved, (*this, aRule));
+  NOTIFY(RuleRemoved, (*AsServo(), aRule));
 
   if (mDocument) {
     mDocument->StyleRuleRemoved(this, &aRule);
   }
 }
 
 void
 StyleSheet::RuleChanged(css::Rule* aRule)
 {
   DidDirty();
   mDirtyFlags |= MODIFIED_RULES;
-  NOTIFY(RuleChanged, (*this, aRule));
+  NOTIFY(RuleChanged, (*AsServo(), aRule));
 
   if (mDocument) {
     mDocument->StyleRuleChanged(this, aRule);
   }
 }
 
 #undef NOTIFY
 
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -18,18 +18,18 @@
 class nsIDocument;
 class nsINode;
 class nsIPrincipal;
 class nsCSSRuleProcessor;
 
 namespace mozilla {
 
 class CSSStyleSheet;
+class ServoStyleSet;
 class ServoStyleSheet;
-class StyleSetHandle;
 struct StyleSheetInfo;
 struct CSSStyleSheetInner;
 
 namespace dom {
 class CSSImportRule;
 class CSSRuleList;
 class MediaList;
 class ShadowRoot;
@@ -255,18 +255,18 @@ public:
   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(const StyleSetHandle& aStyleSet);
-  void DropStyleSet(const StyleSetHandle& aStyleSet);
+  void AddStyleSet(ServoStyleSet* aStyleSet);
+  void DropStyleSet(ServoStyleSet* aStyleSet);
 
   nsresult DeleteRuleFromGroup(css::GroupRule* aGroup, uint32_t aIndex);
   nsresult InsertRuleIntoGroup(const nsAString& aRule,
                                css::GroupRule* aGroup, uint32_t aIndex);
 
   // Find the ID of the owner inner window.
   uint64_t FindOwningWindowInnerID() const;
 
@@ -364,17 +364,17 @@ protected:
   // 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.
   StyleSheetInfo* mInner;
 
-  nsTArray<StyleSetHandle> mStyleSets;
+  nsTArray<ServoStyleSet*> mStyleSets;
 
   friend class ::nsCSSRuleProcessor;
 
   // 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;
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -107,18 +107,16 @@ EXPORTS.mozilla += [
     'ServoSupportsRule.h',
     'ServoTraversalStatistics.h',
     'ServoTypes.h',
     'ServoUtils.h',
     'SheetType.h',
     'StyleAnimationValue.h',
     'StyleComplexColor.h',
     'StylePrefs.h',
-    'StyleSetHandle.h',
-    'StyleSetHandleInlines.h',
     'StyleSheet.h',
     'StyleSheetInfo.h',
     'StyleSheetInlines.h',
     'URLExtraData.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'CSS.h',
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -357,17 +357,17 @@ public:
     MOZ_ASSERT(aComputedStyle);
   }
 
   bool BuildKeyframes(nsPresContext* aPresContext,
                       nsAtom* aName,
                       const nsTimingFunction& aTimingFunction,
                       nsTArray<Keyframe>& aKeyframes)
   {
-    ServoStyleSet* styleSet = aPresContext->StyleSet()->AsServo();
+    ServoStyleSet* styleSet = aPresContext->StyleSet();
     MOZ_ASSERT(styleSet);
     return styleSet->GetKeyframesForName(aName,
                                          aTimingFunction,
                                          aKeyframes);
   }
   void SetKeyframes(KeyframeEffectReadOnly& aEffect,
                     nsTArray<Keyframe>&& aKeyframes)
   {
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -32,18 +32,17 @@
 #include "nsROCSSPrimitiveValue.h"
 
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 
 #include "nsCSSPseudoElements.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/IntegerRange.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoRestyleManager.h"
 #include "mozilla/RestyleManagerInlines.h"
 #include "imgIRequest.h"
 #include "nsLayoutUtils.h"
 #include "nsCSSKeywords.h"
 #include "nsStyleCoord.h"
 #include "nsDisplayList.h"
 #include "nsDOMCSSDeclaration.h"
@@ -115,17 +114,17 @@ DocumentNeedsRestyle(
     return true;
   }
 
   nsPresContext* presContext = shell->GetPresContext();
   MOZ_ASSERT(presContext);
 
   // Unfortunately we don't know if the sheet change affects mContent or not, so
   // just assume it will and that we need to flush normally.
-  StyleSetHandle styleSet = shell->StyleSet();
+  ServoStyleSet* styleSet = shell->StyleSet();
   if (styleSet->StyleSheetsHaveChanged()) {
     return true;
   }
 
   // Pending media query updates can definitely change style on the element. For
   // example, if you change the zoom factor and then call getComputedStyle, you
   // should be able to observe the style with the new media queries.
   //
@@ -545,17 +544,17 @@ nsComputedDOMStyle::DoGetComputedStyleNo
         RefPtr<ComputedStyle> ret = result;
         return ret.forget();
       }
     }
   }
 
   // No frame has been created, or we have a pseudo, or we're looking
   // for the default style, so resolve the style ourselves.
-  ServoStyleSet* styleSet = presShell->StyleSet()->AsServo();
+  ServoStyleSet* styleSet = presShell->StyleSet();
 
   StyleRuleInclusion rules = aStyleType == eDefaultOnly
                              ? StyleRuleInclusion::DefaultOnly
                              : StyleRuleInclusion::All;
   RefPtr<ComputedStyle> result =
      styleSet->ResolveStyleLazily(aElement, pseudoType, rules);
   return result.forget();
 }
@@ -574,18 +573,18 @@ nsComputedDOMStyle::GetUnanimatedCompute
   MOZ_ASSERT(shell, "How in the world did we get a style a few lines above?");
 
   Element* elementOrPseudoElement =
     EffectCompositor::GetElementToRestyle(aElement, pseudoType);
   if (!elementOrPseudoElement) {
     return nullptr;
   }
 
-  return shell->StyleSet()->AsServo()->GetBaseContextForElement(
-    elementOrPseudoElement, style);
+  return shell->StyleSet()->
+    GetBaseContextForElement(elementOrPseudoElement, style);
 }
 
 nsMargin
 nsComputedDOMStyle::GetAdjustedValuesForBoxSizing()
 {
   // We want the width/height of whatever parts 'width' or 'height' controls,
   // which can be different depending on the value of the 'box-sizing' property.
   const nsStylePosition* stylePos = StylePosition();
--- a/layout/style/nsStyleStructInlines.h
+++ b/layout/style/nsStyleStructInlines.h
@@ -12,17 +12,16 @@
 #ifndef nsStyleStructInlines_h_
 #define nsStyleStructInlines_h_
 
 #include "nsIFrame.h"
 #include "nsStyleStruct.h"
 #include "nsIContent.h" // for GetParent()
 #include "nsTextFrame.h" // for nsTextFrame::ShouldSuppressLineBreak
 #include "nsSVGUtils.h" // for nsSVGUtils::IsInSVGTextSubtree
-#include "mozilla/ServoStyleSet.h"
 
 inline void
 nsStyleImage::EnsureCachedBIData() const
 {
   if (!mCachedBIData) {
     const_cast<nsStyleImage*>(this)->mCachedBIData =
       mozilla::MakeUnique<CachedBorderImageData>();
   }
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -36,18 +36,16 @@
 #include "nsIDOMElement.h"
 #include "nsIScriptError.h"
 #include "nsFrameManager.h"
 #include "nsError.h"
 #include "nsCSSFrameConstructor.h"
 #include "mozilla/Range.h"
 #include "mozilla/ServoRestyleManager.h"
 #include "mozilla/ServoStyleSet.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsDisplayList.h"
 #include "nsIScrollableFrame.h"
 #include "nsCSSProps.h"
 #include "nsStyleChangeList.h"
 #include <algorithm>
 
 #include "gfxPrefs.h"
 #include "mozilla/layers/StackingContextHelper.h"
--- a/layout/xul/nsListBoxBodyFrame.cpp
+++ b/layout/xul/nsListBoxBodyFrame.cpp
@@ -21,18 +21,17 @@
 #include "nsCSSFrameConstructor.h"
 #include "nsIScrollableFrame.h"
 #include "nsScrollbarFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsFontMetrics.h"
 #include "nsITimer.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/dom/Text.h"
 #include "nsPIBoxObject.h"
 #include "nsLayoutUtils.h"
 #include "nsPIListBoxObject.h"
 #include "nsContentUtils.h"
 #include "ChildIterator.h"
 #include "gfxContext.h"
 #include "prtime.h"
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -24,18 +24,16 @@
 #include "nsIPresShell.h"
 #include "nsFrameList.h"
 #include "nsHTMLParts.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsBoxLayoutState.h"
 #include "nsIServiceManager.h"
 #include "nsContainerFrame.h"
 #include "nsContentCID.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/UniquePtr.h"
--- a/layout/xul/tree/nsTreeStyleCache.cpp
+++ b/layout/xul/tree/nsTreeStyleCache.cpp
@@ -1,18 +1,17 @@
 /* -*- 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/. */
 
 #include "nsTreeStyleCache.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/StyleSetHandle.h"
-#include "mozilla/StyleSetHandleInlines.h"
+#include "mozilla/ServoStyleSet.h"
 
 using namespace mozilla;
 
 nsTreeStyleCache::Transition::Transition(DFAState aState, nsAtom* aSymbol)
   : mState(aState), mInputSymbol(aSymbol)
 {
 }