Bug 1457920: Remove ServoStyleSheet usage. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 30 Apr 2018 19:23:14 +0200
changeset 470081 04bb8bf9a707b925182b3ec604d41fffc2484b8a
parent 470080 7d3b204b45dcafd1deb993e4d450e02be53c82df
child 470082 174b29e059781c268a853a429ba42a6a2de2965b
push id9179
push userarchaeopteryx@coole-files.de
push dateThu, 03 May 2018 15:28:18 +0000
treeherdermozilla-beta@e6f9ade8bca7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1457920
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457920: Remove ServoStyleSheet usage. r=xidorn MozReview-Commit-ID: LIBkovuQ6MB
chrome/nsChromeRegistry.cpp
dom/base/nsTreeSanitizer.cpp
dom/html/nsHTMLDocument.cpp
layout/base/PresShell.cpp
layout/inspector/ServoStyleRuleMap.cpp
layout/inspector/ServoStyleRuleMap.h
layout/style/Loader.cpp
layout/style/Loader.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.toml
layout/style/ServoCSSRuleList.cpp
layout/style/ServoCSSRuleList.h
layout/style/ServoImportRule.cpp
layout/style/ServoKeyframesRule.cpp
layout/style/ServoStyleSet.cpp
layout/style/StyleSheetInlines.h
layout/style/nsLayoutStylesheetCache.cpp
servo/components/style/gecko/data.rs
servo/components/style/shared_lock.rs
servo/ports/geckolib/error_reporter.rs
servo/ports/geckolib/glue.rs
servo/ports/geckolib/stylesheet_loader.rs
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -34,17 +34,16 @@
 #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, ...)
@@ -399,22 +398,22 @@ 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<ServoStyleSheet>> agentSheets;
+    nsTArray<RefPtr<StyleSheet>> agentSheets;
     rv = shell->GetAgentStyleSheets(agentSheets);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsTArray<RefPtr<ServoStyleSheet>> newAgentSheets;
-    for (ServoStyleSheet* sheet : agentSheets) {
+    nsTArray<RefPtr<StyleSheet>> newAgentSheets;
+    for (StyleSheet* 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) {
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -1086,19 +1086,20 @@ nsTreeSanitizer::SanitizeStyleSheet(cons
 {
   nsresult rv = NS_OK;
   aSanitized.Truncate();
   // aSanitized will hold the permitted CSS text.
   // -moz-binding is blacklisted.
   bool didSanitize = false;
   // Create a sheet to hold the parsed CSS
   RefPtr<StyleSheet> sheet =
-    new ServoStyleSheet(mozilla::css::eAuthorSheetFeatures,
-                        CORS_NONE, aDocument->GetReferrerPolicy(),
-                        SRIMetadata());
+    new StyleSheet(mozilla::css::eAuthorSheetFeatures,
+                   CORS_NONE,
+                   aDocument->GetReferrerPolicy(),
+                   SRIMetadata());
   sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
   sheet->SetPrincipal(aDocument->NodePrincipal());
   sheet->ParseSheetSync(
     aDocument->CSSLoader(),
     NS_ConvertUTF16toUTF8(aOriginal),
     /* aLoadData = */ nullptr,
     /* aLineNumber = */ 0);
   NS_ENSURE_SUCCESS(rv, true);
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -2251,17 +2251,17 @@ nsHTMLDocument::TearingDownEditor()
   if (IsEditingOn()) {
     EditingState oldState = mEditingState;
     mEditingState = eTearingDown;
 
     nsCOMPtr<nsIPresShell> presShell = GetShell();
     if (!presShell)
       return;
 
-    nsTArray<RefPtr<ServoStyleSheet>> agentSheets;
+    nsTArray<RefPtr<StyleSheet>> agentSheets;
     presShell->GetAgentStyleSheets(agentSheets);
 
     auto cache = nsLayoutStylesheetCache::Singleton();
 
     agentSheets.RemoveElement(cache->ContentEditableSheet());
     if (oldState == eDesignMode)
       agentSheets.RemoveElement(cache->DesignModeSheet());
 
@@ -2396,17 +2396,17 @@ 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<ServoStyleSheet>> agentSheets;
+    nsTArray<RefPtr<StyleSheet>> agentSheets;
     rv = presShell->GetAgentStyleSheets(agentSheets);
     NS_ENSURE_SUCCESS(rv, rv);
 
     auto cache = nsLayoutStylesheetCache::Singleton();
 
     StyleSheet* contentEditableSheet = cache->ContentEditableSheet();
 
     if (!agentSheets.Contains(contentEditableSheet)) {
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -8571,35 +8571,35 @@ PresShell::IsVisible()
   nsIFrame* frame = view->GetFrame();
   if (!frame)
     return true;
 
   return frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY);
 }
 
 nsresult
-PresShell::GetAgentStyleSheets(nsTArray<RefPtr<ServoStyleSheet>>& aSheets)
+PresShell::GetAgentStyleSheets(nsTArray<RefPtr<StyleSheet>>& 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) {
-    ServoStyleSheet* sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i);
+    StyleSheet* sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i);
     aSheets.AppendElement(sheet);
   }
 
   return NS_OK;
 }
 
 nsresult
-PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<ServoStyleSheet>>& aSheets)
+PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<StyleSheet>>& aSheets)
 {
   return mStyleSet->ReplaceSheets(SheetType::Agent, aSheets);
 }
 
 nsresult
 PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
 {
   return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet);
@@ -9675,41 +9675,41 @@ FindTopFrame(nsIFrame* aRoot)
 
 #ifdef DEBUG
 
 static void
 CopySheetsIntoClone(ServoStyleSet* aSet, ServoStyleSet* aClone)
 {
   int32_t i, n = aSet->SheetCount(SheetType::Override);
   for (i = 0; i < n; i++) {
-    ServoStyleSheet* ss = aSet->StyleSheetAt(SheetType::Override, i);
+    StyleSheet* 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++) {
-    ServoStyleSheet* ss = aSet->StyleSheetAt(SheetType::User, i);
+    StyleSheet* ss = aSet->StyleSheetAt(SheetType::User, i);
     if (ss)
       aClone->AppendStyleSheet(SheetType::User, ss);
   }
 
   n = aSet->SheetCount(SheetType::Agent);
   for (i = 0; i < n; i++) {
-    ServoStyleSheet* ss = aSet->StyleSheetAt(SheetType::Agent, i);
+    StyleSheet* ss = aSet->StyleSheetAt(SheetType::Agent, i);
     if (ss)
       aClone->AppendStyleSheet(SheetType::Agent, ss);
   }
 }
 
 
 UniquePtr<ServoStyleSet>
 PresShell::CloneStyleSet(ServoStyleSet* aSet)
--- a/layout/inspector/ServoStyleRuleMap.cpp
+++ b/layout/inspector/ServoStyleRuleMap.cpp
@@ -20,17 +20,17 @@ namespace mozilla {
 
 void
 ServoStyleRuleMap::EnsureTable(ServoStyleSet& aStyleSet)
 {
   if (!IsEmpty()) {
     return;
   }
   aStyleSet.EnumerateStyleSheetArrays(
-    [this](const nsTArray<RefPtr<ServoStyleSheet>>& aArray) {
+    [this](const nsTArray<RefPtr<StyleSheet>>& aArray) {
       for (auto& sheet : aArray) {
         FillTableFromStyleSheet(*sheet);
       }
     });
 }
 
 void
 ServoStyleRuleMap::EnsureTable(nsXBLPrototypeResources& aXBLResources)
@@ -50,45 +50,45 @@ ServoStyleRuleMap::EnsureTable(ShadowRoo
     return;
   }
   for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
     FillTableFromStyleSheet(*aShadowRoot.SheetAt(index));
   }
 }
 
 void
-ServoStyleRuleMap::SheetAdded(ServoStyleSheet& aStyleSheet)
+ServoStyleRuleMap::SheetAdded(StyleSheet& aStyleSheet)
 {
   if (!IsEmpty()) {
     FillTableFromStyleSheet(aStyleSheet);
   }
 }
 
 void
-ServoStyleRuleMap::SheetRemoved(ServoStyleSheet& aStyleSheet)
+ServoStyleRuleMap::SheetRemoved(StyleSheet& aStyleSheet)
 {
   // Invalidate all data inside. This isn't strictly necessary since
   // we should always get update from document before new queries come.
   // But it is probably still safer if we try to avoid having invalid
   // pointers inside. Also if the document keep adding and removing
   // stylesheets, this would also prevent us from infinitely growing
   // memory usage.
   mTable.Clear();
 }
 
 void
-ServoStyleRuleMap::RuleAdded(ServoStyleSheet& aStyleSheet, css::Rule& aStyleRule)
+ServoStyleRuleMap::RuleAdded(StyleSheet& aStyleSheet, css::Rule& aStyleRule)
 {
   if (!IsEmpty()) {
     FillTableFromRule(aStyleRule);
   }
 }
 
 void
-ServoStyleRuleMap::RuleRemoved(ServoStyleSheet& aStyleSheet,
+ServoStyleRuleMap::RuleRemoved(StyleSheet& aStyleSheet,
                                css::Rule& aStyleRule)
 {
   if (IsEmpty()) {
     return;
   }
 
   switch (aStyleRule.Type()) {
     case CSSRuleBinding::STYLE_RULE: {
@@ -155,16 +155,16 @@ void
 ServoStyleRuleMap::FillTableFromRuleList(ServoCSSRuleList& aRuleList)
 {
   for (uint32_t i : IntegerRange(aRuleList.Length())) {
     FillTableFromRule(*aRuleList.GetRule(i));
   }
 }
 
 void
-ServoStyleRuleMap::FillTableFromStyleSheet(ServoStyleSheet& aSheet)
+ServoStyleRuleMap::FillTableFromStyleSheet(StyleSheet& aSheet)
 {
   if (aSheet.IsComplete()) {
     FillTableFromRuleList(*aSheet.GetCssRulesInternal());
   }
 }
 
 } // namespace mozilla
--- a/layout/inspector/ServoStyleRuleMap.h
+++ b/layout/inspector/ServoStyleRuleMap.h
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoStyleRuleMap_h
 #define mozilla_ServoStyleRuleMap_h
 
 #include "mozilla/ServoStyleRule.h"
-#include "mozilla/ServoStyleSheet.h"
+#include "mozilla/StyleSheet.h"
 
 #include "nsDataHashtable.h"
 
 struct RawServoStyleRule;
 class nsXBLPrototypeResources;
 
 namespace mozilla {
 class ServoCSSRuleList;
@@ -33,35 +33,35 @@ public:
   void EnsureTable(nsXBLPrototypeResources&);
   void EnsureTable(dom::ShadowRoot&);
 
   ServoStyleRule* Lookup(const RawServoStyleRule* aRawRule) const
   {
     return mTable.Get(aRawRule);
   }
 
-  void SheetAdded(ServoStyleSheet&);
-  void SheetRemoved(ServoStyleSheet&);
+  void SheetAdded(StyleSheet&);
+  void SheetRemoved(StyleSheet&);
 
-  void RuleAdded(ServoStyleSheet& aStyleSheet, css::Rule&);
-  void RuleRemoved(ServoStyleSheet& aStyleSheet, css::Rule&);
+  void RuleAdded(StyleSheet& aStyleSheet, css::Rule&);
+  void RuleRemoved(StyleSheet& aStyleSheet, css::Rule&);
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
 
   ~ServoStyleRuleMap() = default;
 
 private:
   // Since we would never have a document which contains no style rule,
   // we use IsEmpty as an indication whether we need to walk through
   // all stylesheets to fill the table.
   bool IsEmpty() const { return mTable.Count() == 0; }
 
-  void FillTableFromRule(css::Rule& aRule);
-  void FillTableFromRuleList(ServoCSSRuleList& aRuleList);
-  void FillTableFromStyleSheet(ServoStyleSheet& aSheet);
+  void FillTableFromRule(css::Rule&);
+  void FillTableFromRuleList(ServoCSSRuleList&);
+  void FillTableFromStyleSheet(StyleSheet&);
 
   typedef nsDataHashtable<nsPtrHashKey<const RawServoStyleRule>,
                           WeakPtr<ServoStyleRule>> Hashtable;
   Hashtable mTable;
 };
 
 } // namespace mozilla
 
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -1105,17 +1105,17 @@ Loader::CreateSheet(nsIURI* aURI,
       nsAutoCString sourceUri;
       if (mDocument && mDocument->GetDocumentURI()) {
         mDocument->GetDocumentURI()->GetAsciiSpec(sourceUri);
       }
       SRICheck::IntegrityMetadata(aIntegrity, sourceUri, mReporter,
                                   &sriMetadata);
     }
 
-    *aSheet = new ServoStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
+    *aSheet = new StyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
     (*aSheet)->SetURIs(sheetURI, originalURI, baseURI);
   }
 
   NS_ASSERTION(*aSheet, "We should have a sheet by now!");
   NS_ASSERTION(aSheetState != eSheetStateUnknown, "Have to set a state!");
   LOG(("  State: %s", gStateStrings[aSheetState]));
 
   return NS_OK;
@@ -1651,17 +1651,17 @@ Loader::ParseSheet(const nsAString& aUTF
                              aLoadData, aAllowAsync, aCompleted);
   } else {
     return DoParseSheetServo(sheet, aUTF8,
                              aLoadData, aAllowAsync, aCompleted);
   }
 }
 
 nsresult
-Loader::DoParseSheetServo(ServoStyleSheet* aSheet,
+Loader::DoParseSheetServo(StyleSheet* aSheet,
                           const nsACString& aBytes,
                           SheetLoadData* aLoadData,
                           bool aAllowAsync,
                           bool& aCompleted)
 {
   aLoadData->mIsBeingParsed = true;
 
   // Some cases, like inline style and UA stylesheets, need to be parsed
--- a/layout/style/Loader.h
+++ b/layout/style/Loader.h
@@ -572,17 +572,17 @@ private:
   // sheet had an @import).  If aCompleted is true when this returns, then
   // ParseSheet also called SheetComplete on aLoadData.
   nsresult ParseSheet(const nsAString& aUTF16,
                       const nsACString& aUTF8,
                       SheetLoadData* aLoadData,
                       bool aAllowAsync,
                       bool& aCompleted);
 
-  nsresult DoParseSheetServo(ServoStyleSheet* aSheet,
+  nsresult DoParseSheetServo(StyleSheet* aSheet,
                              const nsACString& aBytes,
                              SheetLoadData* aLoadData,
                              bool aAllowAsync,
                              bool& aCompleted);
 
   // The load of the sheet in aLoadData is done, one way or another.  Do final
   // cleanup, including releasing aLoadData.
   void SheetComplete(SheetLoadData* aLoadData, nsresult aStatus);
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -453,48 +453,48 @@ Gecko_GetUnvisitedLinkAttrDeclarationBlo
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoUnvisitedLinkDecl());
 }
 
-ServoStyleSheet* Gecko_StyleSheet_Clone(
-    const ServoStyleSheet* aSheet,
-    const ServoStyleSheet* aNewParentSheet)
+StyleSheet* Gecko_StyleSheet_Clone(
+    const StyleSheet* aSheet,
+    const StyleSheet* aNewParentSheet)
 {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(aSheet->GetParentSheet(), "Should only be used for @import");
   MOZ_ASSERT(aNewParentSheet, "Wat");
 
   RefPtr<StyleSheet> newSheet =
     aSheet->Clone(nullptr, nullptr, nullptr, nullptr);
 
   // NOTE(emilio): This code runs in the StylesheetInner constructor, which
   // means that the inner pointer of `aNewParentSheet` still points to the old
   // one.
   //
   // So we _don't_ update neither the parent pointer of the stylesheet, nor the
   // child list (yet). This is fixed up in that same constructor.
-  return static_cast<ServoStyleSheet*>(newSheet.forget().take());
+  return static_cast<StyleSheet*>(newSheet.forget().take());
 }
 
 void
-Gecko_StyleSheet_AddRef(const ServoStyleSheet* aSheet)
+Gecko_StyleSheet_AddRef(const StyleSheet* aSheet)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  const_cast<ServoStyleSheet*>(aSheet)->AddRef();
+  const_cast<StyleSheet*>(aSheet)->AddRef();
 }
 
 void
-Gecko_StyleSheet_Release(const ServoStyleSheet* aSheet)
+Gecko_StyleSheet_Release(const StyleSheet* aSheet)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  const_cast<ServoStyleSheet*>(aSheet)->Release();
+  const_cast<StyleSheet*>(aSheet)->Release();
 }
 
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetVisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
 {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
@@ -2589,19 +2589,19 @@ Gecko_StyleSheet_FinishAsyncParse(SheetL
   NS_DispatchToMainThread(NS_NewRunnableFunction(__func__,
                                                  [d = Move(loadData),
                                                   s = Move(sheetContents)]() mutable {
     MOZ_ASSERT(NS_IsMainThread());
     d->get()->mSheet->FinishAsyncParse(s.forget());
   }));
 }
 
-static already_AddRefed<ServoStyleSheet>
+static already_AddRefed<StyleSheet>
 LoadImportSheet(css::Loader* aLoader,
-                ServoStyleSheet* aParent,
+                StyleSheet* aParent,
                 SheetLoadData* aParentLoadData,
                 css::LoaderReusableStyleSheets* aReusableSheets,
                 css::URLValue* aURL,
                 already_AddRefed<RawServoMediaList> aMediaList)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aLoader, "Should've catched this before");
   MOZ_ASSERT(aParent, "Only used for @import, so parent should exist!");
@@ -2620,38 +2620,38 @@ LoadImportSheet(css::Loader* aLoader,
       !aParent->GetFirstChild() ||
       aParent->GetFirstChild() == previousFirstChild) {
     // Servo and Gecko have different ideas of what a valid URL is, so we might
     // get in here with a URL string that NS_NewURI can't handle.  We may also
     // reach here via an import cycle.  For the import cycle case, we need some
     // sheet object per spec, even if its empty.  DevTools uses the URI to
     // realize it has hit an import cycle, so we mark it complete to make the
     // sheet readable from JS.
-    RefPtr<ServoStyleSheet> emptySheet =
+    RefPtr<StyleSheet> emptySheet =
       aParent->CreateEmptyChildSheet(media.forget());
     // Make a dummy URI if we don't have one because some methods assume
     // non-null URIs.
     if (!uri) {
       NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:invalid"));
     }
     emptySheet->SetURIs(uri, uri, uri);
     emptySheet->SetPrincipal(aURL->mExtraData->GetPrincipal());
     emptySheet->SetComplete();
     aParent->PrependStyleSheet(emptySheet);
     return emptySheet.forget();
   }
 
-  RefPtr<ServoStyleSheet> sheet =
-    static_cast<ServoStyleSheet*>(aParent->GetFirstChild());
+  RefPtr<StyleSheet> sheet =
+    static_cast<StyleSheet*>(aParent->GetFirstChild());
   return sheet.forget();
 }
 
-ServoStyleSheet*
+StyleSheet*
 Gecko_LoadStyleSheet(css::Loader* aLoader,
-                     ServoStyleSheet* aParent,
+                     StyleSheet* aParent,
                      SheetLoadData* aParentLoadData,
                      css::LoaderReusableStyleSheets* aReusableSheets,
                      ServoBundledURI aServoURL,
                      RawServoMediaListStrong aMediaList)
 {
   MOZ_ASSERT(NS_IsMainThread());
   RefPtr<css::URLValue> url = aServoURL.IntoCssUrl();
   return LoadImportSheet(aLoader, aParent, aParentLoadData, aReusableSheets,
@@ -2670,17 +2670,17 @@ Gecko_LoadStyleSheetAsync(css::SheetLoad
   RefPtr<RawServoImportRule> importRule = aImportRule.Consume();
   NS_DispatchToMainThread(NS_NewRunnableFunction(__func__,
                                                  [data = Move(loadData),
                                                   url = Move(urlVal),
                                                   media = Move(mediaList),
                                                   import = Move(importRule)]() mutable {
     MOZ_ASSERT(NS_IsMainThread());
     SheetLoadData* d = data->get();
-    RefPtr<ServoStyleSheet> sheet =
+    RefPtr<StyleSheet> sheet =
       LoadImportSheet(d->mLoader, d->mSheet, d, nullptr, url, media.forget());
     Servo_ImportRule_SetSheet(import, sheet);
   }));
 }
 
 nsCSSKeyword
 Gecko_LookupCSSKeyword(const uint8_t* aString, uint32_t aLength)
 {
@@ -2770,22 +2770,22 @@ Gecko_SetJemallocThreadLocalArena(bool e
 }
 
 #include "nsStyleStructList.h"
 
 #undef STYLE_STRUCT
 
 
 ErrorReporter*
-Gecko_CreateCSSErrorReporter(ServoStyleSheet* sheet,
-                             Loader* loader,
-                             nsIURI* uri)
+Gecko_CreateCSSErrorReporter(StyleSheet* aSheet,
+                             Loader* aLoader,
+                             nsIURI* aURI)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return new ErrorReporter(sheet, loader, uri);
+  return new ErrorReporter(aSheet, aLoader, aURI);
 }
 
 void
 Gecko_DestroyCSSErrorReporter(ErrorReporter* reporter)
 {
   delete reporter;
 }
 
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -214,17 +214,17 @@ whitelist-types = [
     "mozilla::AnonymousCounterStyle",
     "mozilla::AtomArray",
     "mozilla::ComputedTiming",
     "mozilla::ComputedTimingFunction",
     "mozilla::ComputedTimingFunction::BeforeFlag",
     "mozilla::SeenPtrs",
     "mozilla::ServoElementSnapshot.*",
     "mozilla::ComputedStyle",
-    "mozilla::ServoStyleSheet",
+    "mozilla::StyleSheet",
     "mozilla::ServoStyleSheetInner",
     "mozilla::ServoStyleSetSizes",
     "mozilla::ServoTraversalStatistics",
     "mozilla::css::ErrorReporter",
     "mozilla::css::LoaderReusableStyleSheets",
     "mozilla::css::SheetLoadData",
     "mozilla::css::SheetLoadDataHolder",
     "mozilla::css::SheetParsingMode",
--- a/layout/style/ServoCSSRuleList.cpp
+++ b/layout/style/ServoCSSRuleList.cpp
@@ -15,25 +15,25 @@
 #include "mozilla/ServoImportRule.h"
 #include "mozilla/ServoFontFaceRule.h"
 #include "mozilla/ServoFontFeatureValuesRule.h"
 #include "mozilla/ServoKeyframesRule.h"
 #include "mozilla/ServoMediaRule.h"
 #include "mozilla/ServoNamespaceRule.h"
 #include "mozilla/ServoPageRule.h"
 #include "mozilla/ServoStyleRule.h"
-#include "mozilla/ServoStyleSheet.h"
 #include "mozilla/ServoSupportsRule.h"
+#include "mozilla/StyleSheet.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 ServoCSSRuleList::ServoCSSRuleList(already_AddRefed<ServoCssRules> aRawRules,
-                                   ServoStyleSheet* aDirectOwnerStyleSheet)
+                                   StyleSheet* aDirectOwnerStyleSheet)
   : mStyleSheet(aDirectOwnerStyleSheet)
   , mRawRules(aRawRules)
 {
   Servo_CssRules_ListTypes(mRawRules, &mRules);
 }
 
 // QueryInterface implementation for ServoCSSRuleList
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoCSSRuleList)
--- a/layout/style/ServoCSSRuleList.h
+++ b/layout/style/ServoCSSRuleList.h
@@ -25,25 +25,25 @@ class Rule;
 class ServoCSSRuleList final : public dom::CSSRuleList
 {
 public:
   // @param aDirectOwnerStyleSheet should be set to the owner stylesheet
   // if this rule list is owned directly by a stylesheet, which means it
   // is a top level CSSRuleList. If it's owned by a group rule, nullptr.
   // If this param is set, the caller doesn't need to call SetStyleSheet.
   ServoCSSRuleList(already_AddRefed<ServoCssRules> aRawRules,
-                   ServoStyleSheet* aDirectOwnerStyleSheet);
+                   StyleSheet* aDirectOwnerStyleSheet);
   css::GroupRule* GetParentRule() const { return mParentRule; }
   void SetParentRule(css::GroupRule* aParentRule);
   void SetStyleSheet(StyleSheet* aSheet);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoCSSRuleList, dom::CSSRuleList)
 
-  ServoStyleSheet* GetParentObject() final { return mStyleSheet; }
+  StyleSheet* GetParentObject() final { return mStyleSheet; }
 
   css::Rule* IndexedGetter(uint32_t aIndex, bool& aFound) final;
   uint32_t Length() final { return mRules.Length(); }
 
   void DropReference();
 
   css::Rule* GetRule(uint32_t aIndex);
   nsresult InsertRule(const nsAString& aRule, uint32_t aIndex);
@@ -67,17 +67,17 @@ private:
   }
 
   template<typename Func>
   void EnumerateInstantiatedRules(Func aCallback);
 
   void DropAllRules();
 
   // mStyleSheet may be nullptr when it drops the reference to us.
-  ServoStyleSheet* mStyleSheet = nullptr;
+  StyleSheet* mStyleSheet = nullptr;
   // mParentRule is nullptr if it isn't a nested rule list.
   css::GroupRule* mParentRule = nullptr;
   RefPtr<ServoCssRules> mRawRules;
   // Array stores either a number indicating rule type, or a pointer to
   // css::Rule. If the value is less than kMaxRuleType, the given rule
   // instance has not been constructed, and the value means the type
   // of the rule. Otherwise, it is a pointer.
   nsTArray<uintptr_t> mRules;
--- a/layout/style/ServoImportRule.cpp
+++ b/layout/style/ServoImportRule.cpp
@@ -4,28 +4,29 @@
  * 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/. */
 
 /* representation of CSSImportRule for stylo */
 
 #include "mozilla/ServoImportRule.h"
 
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoStyleSheet.h"
+#include "mozilla/StyleSheet.h"
 
 namespace mozilla {
 
 ServoImportRule::ServoImportRule(RefPtr<RawServoImportRule> aRawRule,
-                                 uint32_t aLine, uint32_t aColumn)
+                                 uint32_t aLine,
+                                 uint32_t aColumn)
   : CSSImportRule(aLine, aColumn)
   , mRawRule(Move(aRawRule))
 {
   const auto* sheet = Servo_ImportRule_GetSheet(mRawRule.get());
   MOZ_ASSERT(sheet);
-  mChildSheet = const_cast<ServoStyleSheet*>(sheet);
+  mChildSheet = const_cast<StyleSheet*>(sheet);
   mChildSheet->SetOwnerRule(this);
 }
 
 ServoImportRule::~ServoImportRule()
 {
   if (mChildSheet) {
     mChildSheet->SetOwnerRule(nullptr);
   }
--- a/layout/style/ServoKeyframesRule.cpp
+++ b/layout/style/ServoKeyframesRule.cpp
@@ -34,27 +34,27 @@ public:
   {
     mParentRule = aParentRule;
     for (css::Rule* rule : mRules) {
       if (rule) {
         rule->SetParentRule(aParentRule);
       }
     }
   }
-  void SetStyleSheet(ServoStyleSheet* aSheet)
+  void SetStyleSheet(StyleSheet* aSheet)
   {
     mStyleSheet = aSheet;
     for (css::Rule* rule : mRules) {
       if (rule) {
         rule->SetStyleSheet(aSheet);
       }
     }
   }
 
-  ServoStyleSheet* GetParentObject() final { return mStyleSheet; }
+  StyleSheet* GetParentObject() final { return mStyleSheet; }
 
   ServoKeyframeRule* GetRule(uint32_t aIndex) {
     if (!mRules[aIndex]) {
       uint32_t line = 0, column = 0;
       RefPtr<RawServoKeyframe> rule =
         Servo_KeyframesRule_GetKeyframeAt(mRawRule, aIndex,
                                           &line, &column).Consume();
       ServoKeyframeRule* ruleObj =
@@ -119,17 +119,17 @@ private:
     if (mParentRule || mStyleSheet) {
       DropReference();
     }
     mRules.Clear();
     mRawRule = nullptr;
   }
 
   // may be nullptr when the style sheet drops the reference to us.
-  ServoStyleSheet* mStyleSheet = nullptr;
+  StyleSheet* mStyleSheet = nullptr;
   ServoKeyframesRule* mParentRule = nullptr;
   RefPtr<RawServoKeyframesRule> mRawRule;
   nsCOMArray<css::Rule> mRules;
 };
 
 // QueryInterface implementation for ServoKeyframeList
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoKeyframeList)
 NS_INTERFACE_MAP_END_INHERITING(dom::CSSRuleList)
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -708,18 +708,17 @@ ServoStyleSet::ResolveXULTreePseudoStyle
       &aInputWord,
       mRawSet.get()
   ).Consume();
 }
 #endif
 
 // manage the set of style sheets in the style set
 nsresult
-ServoStyleSet::AppendStyleSheet(SheetType aType,
-                                ServoStyleSheet* aSheet)
+ServoStyleSet::AppendStyleSheet(SheetType aType, StyleSheet* aSheet)
 {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(IsCSSSheetType(aType));
   MOZ_ASSERT(aSheet->RawContents(), "Raw sheet should be in place before insertion.");
 
   RemoveSheetOfType(aType, aSheet);
   AppendSheetOfType(aType, aSheet);
@@ -735,18 +734,17 @@ ServoStyleSet::AppendStyleSheet(SheetTyp
   if (mStyleRuleMap) {
     mStyleRuleMap->SheetAdded(*aSheet);
   }
 
   return NS_OK;
 }
 
 nsresult
-ServoStyleSet::PrependStyleSheet(SheetType aType,
-                                 ServoStyleSheet* aSheet)
+ServoStyleSet::PrependStyleSheet(SheetType aType, StyleSheet* aSheet)
 {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(IsCSSSheetType(aType));
   MOZ_ASSERT(aSheet->RawContents(),
              "Raw sheet should be in place before insertion.");
 
   RemoveSheetOfType(aType, aSheet);
@@ -763,18 +761,17 @@ ServoStyleSet::PrependStyleSheet(SheetTy
   if (mStyleRuleMap) {
     mStyleRuleMap->SheetAdded(*aSheet);
   }
 
   return NS_OK;
 }
 
 nsresult
-ServoStyleSet::RemoveStyleSheet(SheetType aType,
-                                ServoStyleSheet* aSheet)
+ServoStyleSet::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet)
 {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(IsCSSSheetType(aType));
 
   RemoveSheetOfType(aType, aSheet);
   if (mRawSet) {
     // Maintain a mirrored list of sheets on the servo side.
     Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), aSheet);
@@ -785,17 +782,17 @@ ServoStyleSet::RemoveStyleSheet(SheetTyp
     mStyleRuleMap->SheetRemoved(*aSheet);
   }
 
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::ReplaceSheets(SheetType aType,
-                             const nsTArray<RefPtr<ServoStyleSheet>>& aNewSheets)
+                             const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
 {
   // Gecko uses a two-dimensional array keyed by sheet type, whereas Servo
   // stores a flattened list. This makes ReplaceSheets a pretty clunky thing
   // to express. If the need ever arises, we can easily make this more efficent,
   // probably by aligning the representations better between engines.
 
   SetStylistStyleSheetsDirty();
 
@@ -820,18 +817,18 @@ ServoStyleSet::ReplaceSheets(SheetType a
   // Just don't bother calling SheetRemoved / SheetAdded, and recreate the rule
   // map when needed.
   mStyleRuleMap = nullptr;
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
-                                      ServoStyleSheet* aNewSheet,
-                                      ServoStyleSheet* aReferenceSheet)
+                                      StyleSheet* aNewSheet,
+                                      StyleSheet* aReferenceSheet)
 {
   MOZ_ASSERT(aNewSheet);
   MOZ_ASSERT(aReferenceSheet);
   MOZ_ASSERT(aNewSheet->IsApplicable());
   MOZ_ASSERT(aNewSheet != aReferenceSheet, "Can't place sheet before itself.");
   MOZ_ASSERT(aNewSheet->RawContents(), "Raw sheet should be in place before insertion.");
   MOZ_ASSERT(aReferenceSheet->RawContents(), "Reference sheet should have a raw sheet.");
 
@@ -856,17 +853,17 @@ ServoStyleSet::InsertStyleSheetBefore(Sh
 
 int32_t
 ServoStyleSet::SheetCount(SheetType aType) const
 {
   MOZ_ASSERT(IsCSSSheetType(aType));
   return mSheets[aType].Length();
 }
 
-ServoStyleSheet*
+StyleSheet*
 ServoStyleSet::StyleSheetAt(SheetType aType, int32_t aIndex) const
 {
   MOZ_ASSERT(IsCSSSheetType(aType));
   return mSheets[aType][aIndex];
 }
 
 void
 ServoStyleSet::AppendAllNonDocumentAuthorSheets(nsTArray<StyleSheet*>& aArray) const
@@ -877,38 +874,37 @@ ServoStyleSet::AppendAllNonDocumentAutho
       for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
         aArray.AppendElement(aShadowRoot.SheetAt(index));
       }
     });
   }
 }
 
 nsresult
-ServoStyleSet::RemoveDocStyleSheet(ServoStyleSheet* aSheet)
+ServoStyleSet::RemoveDocStyleSheet(StyleSheet* aSheet)
 {
   return RemoveStyleSheet(SheetType::Doc, aSheet);
 }
 
 nsresult
-ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
-                                nsIDocument* aDocument)
+ServoStyleSet::AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument)
 {
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(aSheet->RawContents(), "Raw sheet should be in place by this point.");
 
   RefPtr<StyleSheet> strong(aSheet);
 
   RemoveSheetOfType(SheetType::Doc, aSheet);
 
   size_t index =
     aDocument->FindDocStyleSheetInsertionPoint(mSheets[SheetType::Doc], *aSheet);
 
   if (index < mSheets[SheetType::Doc].Length()) {
     // This case is insert before.
-    ServoStyleSheet *beforeSheet = mSheets[SheetType::Doc][index];
+    StyleSheet *beforeSheet = mSheets[SheetType::Doc][index];
     InsertSheetOfType(SheetType::Doc, aSheet, beforeSheet);
 
     if (mRawSet) {
       // Maintain a mirrored list of sheets on the servo side.
       Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(), aSheet, beforeSheet);
       SetStylistStyleSheetsDirty();
     }
   } else {
@@ -1136,39 +1132,39 @@ ServoStyleSet::SetStylistXBLStyleSheetsD
   // We need to invalidate cached style in getComputedStyle for undisplayed
   // elements, since we don't know if any of the style sheet change that we
   // do would affect undisplayed elements.
   MOZ_ASSERT(GetPresContext());
   GetPresContext()->RestyleManager()->IncrementUndisplayedRestyleGeneration();
 }
 
 void
-ServoStyleSet::RuleAdded(ServoStyleSheet& aSheet, css::Rule& aRule)
+ServoStyleSet::RuleAdded(StyleSheet& aSheet, css::Rule& aRule)
 {
   if (mStyleRuleMap) {
     mStyleRuleMap->RuleAdded(aSheet, aRule);
   }
 
   // FIXME(emilio): Could be more granular based on aRule.
   MarkOriginsDirty(aSheet.GetOrigin());
 }
 
 void
-ServoStyleSet::RuleRemoved(ServoStyleSheet& aSheet, css::Rule& aRule)
+ServoStyleSet::RuleRemoved(StyleSheet& aSheet, css::Rule& aRule)
 {
   if (mStyleRuleMap) {
     mStyleRuleMap->RuleRemoved(aSheet, aRule);
   }
 
   // FIXME(emilio): Could be more granular based on aRule.
   MarkOriginsDirty(aSheet.GetOrigin());
 }
 
 void
-ServoStyleSet::RuleChanged(ServoStyleSheet& aSheet, css::Rule* aRule)
+ServoStyleSet::RuleChanged(StyleSheet& aSheet, css::Rule* aRule)
 {
   // FIXME(emilio): Could be more granular based on aRule.
   MarkOriginsDirty(aSheet.GetOrigin());
 }
 
 #ifdef DEBUG
 void
 ServoStyleSet::AssertTreeIsClean()
@@ -1536,48 +1532,45 @@ ServoStyleSet::MayTraverseFrom(const Ele
 bool
 ServoStyleSet::ShouldTraverseInParallel() const
 {
   MOZ_ASSERT(mDocument->GetShell(), "Styling a document without a shell?");
   return mDocument->GetShell()->IsActive();
 }
 
 void
-ServoStyleSet::PrependSheetOfType(SheetType aType,
-                                  ServoStyleSheet* aSheet)
+ServoStyleSet::PrependSheetOfType(SheetType aType, StyleSheet* aSheet)
 {
   aSheet->AddStyleSet(this);
   mSheets[aType].InsertElementAt(0, aSheet);
 }
 
 void
-ServoStyleSet::AppendSheetOfType(SheetType aType,
-                                 ServoStyleSheet* aSheet)
+ServoStyleSet::AppendSheetOfType(SheetType aType, StyleSheet* aSheet)
 {
   aSheet->AddStyleSet(this);
   mSheets[aType].AppendElement(aSheet);
 }
 
 void
 ServoStyleSet::InsertSheetOfType(SheetType aType,
-                                 ServoStyleSheet* aSheet,
-                                 ServoStyleSheet* aBeforeSheet)
+                                 StyleSheet* aSheet,
+                                 StyleSheet* aBeforeSheet)
 {
   for (uint32_t i = 0; i < mSheets[aType].Length(); ++i) {
     if (mSheets[aType][i] == aBeforeSheet) {
       aSheet->AddStyleSet(this);
       mSheets[aType].InsertElementAt(i, aSheet);
       return;
     }
   }
 }
 
 void
-ServoStyleSet::RemoveSheetOfType(SheetType aType,
-                                 ServoStyleSheet* aSheet)
+ServoStyleSet::RemoveSheetOfType(SheetType aType, StyleSheet* aSheet)
 {
   for (uint32_t i = 0; i < mSheets[aType].Length(); ++i) {
     if (mSheets[aType][i] == aSheet) {
       aSheet->DropStyleSet(this);
       mSheets[aType].RemoveElementAt(i);
     }
   }
 }
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -3,17 +3,16 @@
 /* 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_StyleSheetInlines_h
 #define mozilla_StyleSheetInlines_h
 
 #include "mozilla/StyleSheetInfo.h"
-#include "mozilla/ServoStyleSheet.h"
 #include "nsINode.h"
 
 namespace mozilla {
 
 StyleSheetInfo&
 StyleSheet::SheetInfo()
 {
   return *mInner;
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -786,18 +786,20 @@ nsLayoutStylesheetCache::InvalidatePrefe
     gStyleCache->mChromePreferenceSheet = nullptr;
   }
 }
 
 void
 nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
                                               nsPresContext* aPresContext)
 {
-  *aSheet = new ServoStyleSheet(eAgentSheetFeatures, CORS_NONE,
-                                mozilla::net::RP_Unset, dom::SRIMetadata());
+  *aSheet = new StyleSheet(eAgentSheetFeatures,
+                           CORS_NONE,
+                           mozilla::net::RP_Unset,
+                           dom::SRIMetadata());
 
   StyleSheet* sheet = *aSheet;
 
   nsCOMPtr<nsIURI> uri;
   NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet", nullptr);
   MOZ_ASSERT(uri, "URI creation shouldn't fail");
 
   sheet->SetURIs(uri, uri, uri);
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -3,59 +3,59 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Data needed to style a Gecko document.
 
 use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
 use context::QuirksMode;
 use dom::TElement;
 use gecko_bindings::bindings::{self, RawServoStyleSet};
-use gecko_bindings::structs::{self, RawGeckoPresContextOwned, ServoStyleSetSizes, ServoStyleSheet};
+use gecko_bindings::structs::{self, RawGeckoPresContextOwned, ServoStyleSetSizes, StyleSheet as DomStyleSheet};
 use gecko_bindings::structs::{StyleSheetInfo, nsIDocument};
 use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
 use invalidation::media_queries::{MediaListKey, ToMediaListKey};
 use malloc_size_of::MallocSizeOfOps;
 use media_queries::{Device, MediaList};
 use properties::ComputedValues;
 use selector_parser::SnapshotMap;
 use servo_arc::Arc;
 use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
 use stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
 use stylist::Stylist;
 
 /// Little wrapper to a Gecko style sheet.
 #[derive(Debug, Eq, PartialEq)]
-pub struct GeckoStyleSheet(*const ServoStyleSheet);
+pub struct GeckoStyleSheet(*const DomStyleSheet);
 
 impl ToMediaListKey for ::gecko::data::GeckoStyleSheet {
     fn to_media_list_key(&self) -> MediaListKey {
         use std::mem;
         unsafe { MediaListKey::from_raw(mem::transmute(self.0)) }
     }
 }
 
 impl GeckoStyleSheet {
-    /// Create a `GeckoStyleSheet` from a raw `ServoStyleSheet` pointer.
+    /// Create a `GeckoStyleSheet` from a raw `DomStyleSheet` pointer.
     #[inline]
-    pub unsafe fn new(s: *const ServoStyleSheet) -> Self {
+    pub unsafe fn new(s: *const DomStyleSheet) -> Self {
         debug_assert!(!s.is_null());
         bindings::Gecko_StyleSheet_AddRef(s);
         Self::from_addrefed(s)
     }
 
-    /// Create a `GeckoStyleSheet` from a raw `ServoStyleSheet` pointer that
+    /// Create a `GeckoStyleSheet` from a raw `DomStyleSheet` pointer that
     /// already holds a strong reference.
     #[inline]
-    pub unsafe fn from_addrefed(s: *const ServoStyleSheet) -> Self {
+    pub unsafe fn from_addrefed(s: *const DomStyleSheet) -> Self {
         debug_assert!(!s.is_null());
         GeckoStyleSheet(s)
     }
 
-    /// Get the raw `ServoStyleSheet` that we're wrapping.
-    pub fn raw(&self) -> &ServoStyleSheet {
+    /// Get the raw `StyleSheet` that we're wrapping.
+    pub fn raw(&self) -> &DomStyleSheet {
         unsafe { &*self.0 }
     }
 
     fn inner(&self) -> &StyleSheetInfo {
         unsafe {
             &*(self.raw().mInner as *const StyleSheetInfo)
         }
     }
--- a/servo/components/style/shared_lock.rs
+++ b/servo/components/style/shared_lock.rs
@@ -232,17 +232,17 @@ pub trait ToCssWithGuard {
         s
     }
 }
 
 /// Parameters needed for deep clones.
 #[cfg(feature = "gecko")]
 pub struct DeepCloneParams {
     /// The new sheet we're cloning rules into.
-    pub reference_sheet: *const ::gecko_bindings::structs::ServoStyleSheet,
+    pub reference_sheet: *const ::gecko_bindings::structs::StyleSheet,
 }
 
 /// Parameters needed for deep clones.
 #[cfg(feature = "servo")]
 pub struct DeepCloneParams;
 
 /// A trait to do a deep clone of a given CSS type. Gets a lock and a read
 /// guard, in order to be able to read and clone nested structures.
--- a/servo/ports/geckolib/error_reporter.rs
+++ b/servo/ports/geckolib/error_reporter.rs
@@ -9,32 +9,34 @@
 use cssparser::{CowRcStr, serialize_identifier, ToCss};
 use cssparser::{SourceLocation, ParseError, ParseErrorKind, Token, BasicParseErrorKind};
 use selectors::parser::SelectorParseErrorKind;
 use std::ffi::CStr;
 use std::ptr;
 use style::error_reporting::{ParseErrorReporter, ContextualParseError};
 use style::gecko_bindings::bindings::{Gecko_CreateCSSErrorReporter, Gecko_DestroyCSSErrorReporter};
 use style::gecko_bindings::bindings::Gecko_ReportUnexpectedCSSError;
-use style::gecko_bindings::structs::{Loader, ServoStyleSheet, nsIURI};
+use style::gecko_bindings::structs::{Loader, StyleSheet as DomStyleSheet, nsIURI};
 use style::gecko_bindings::structs::ErrorReporter as GeckoErrorReporter;
 use style::gecko_bindings::structs::URLExtraData as RawUrlExtraData;
 use style::stylesheets::UrlExtraData;
 use style_traits::{StyleParseErrorKind, ValueParseErrorKind};
 
 pub type ErrorKind<'i> = ParseErrorKind<'i, StyleParseErrorKind<'i>>;
 
 /// Wrapper around an instance of Gecko's CSS error reporter.
 pub struct ErrorReporter(*mut GeckoErrorReporter);
 
 impl ErrorReporter {
     /// Create a new instance of the Gecko error reporter.
-    pub fn new(sheet: *mut ServoStyleSheet,
-               loader: *mut Loader,
-               extra_data: *mut RawUrlExtraData) -> ErrorReporter {
+    pub fn new(
+        sheet: *mut DomStyleSheet,
+        loader: *mut Loader,
+        extra_data: *mut RawUrlExtraData,
+    ) -> Self {
         unsafe {
             let url = extra_data.as_ref()
                 .map(|d| d.mBaseURI.raw::<nsIURI>())
                 .unwrap_or(ptr::null_mut());
             ErrorReporter(Gecko_CreateCSSErrorReporter(sheet, loader, url))
         }
     }
 }
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -87,17 +87,17 @@ use style::gecko_bindings::bindings::Raw
 use style::gecko_bindings::bindings::nsCSSValueBorrowedMut;
 use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
 use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
 use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
 use style::gecko_bindings::structs;
 use style::gecko_bindings::structs::{CallerType, CSSPseudoElementType, CompositeOperation};
 use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
 use style::gecko_bindings::structs::{RawServoStyleRule, ComputedStyleStrong, RustString};
-use style::gecko_bindings::structs::{ServoStyleSheet, SheetLoadData, SheetLoadDataHolder};
+use style::gecko_bindings::structs::{StyleSheet as DomStyleSheet, SheetLoadData, SheetLoadDataHolder};
 use style::gecko_bindings::structs::{SheetParsingMode, nsAtom, nsCSSPropertyID};
 use style::gecko_bindings::structs::{nsCSSFontDesc, nsCSSCounterDesc};
 use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair};
 use style::gecko_bindings::structs::AtomArray;
 use style::gecko_bindings::structs::IterationCompositeOperation;
 use style::gecko_bindings::structs::MallocSizeOf as GeckoMallocSizeOf;
 use style::gecko_bindings::structs::OriginFlags;
 use style::gecko_bindings::structs::OriginFlags_Author;
@@ -1189,17 +1189,17 @@ fn mode_to_origin(mode: SheetParsingMode
 }
 
 /// Note: The load_data corresponds to this sheet, and is passed as the parent
 /// load data for child sheet loads. It may be null for certain cases where we
 /// know we won't have child loads.
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(
     loader: *mut Loader,
-    stylesheet: *mut ServoStyleSheet,
+    stylesheet: *mut DomStyleSheet,
     load_data: *mut SheetLoadData,
     bytes: *const nsACString,
     mode: SheetParsingMode,
     extra_data: *mut URLExtraData,
     line_number_offset: u32,
     quirks_mode: nsCompatibility,
     reusable_sheets: *mut LoaderReusableStyleSheets,
 ) -> RawServoStyleSheetContentsStrong {
@@ -1258,17 +1258,17 @@ pub extern "C" fn Servo_StyleSheet_FromU
     } else {
         async_parser.parse();
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_AppendStyleSheet(
     raw_data: RawServoStyleSetBorrowed,
-    sheet: *const ServoStyleSheet,
+    sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.append_stylesheet(sheet, &guard);
 }
@@ -1283,48 +1283,48 @@ pub extern "C" fn Servo_AuthorStyles_Dro
     styles: RawServoAuthorStylesOwned,
 ) {
     let _ = styles.into_box::<AuthorStyles<_>>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet(
     styles: RawServoAuthorStylesBorrowedMut,
-    sheet: *const ServoStyleSheet,
+    sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let sheet = GeckoStyleSheet::new(sheet);
     styles.stylesheets.append_stylesheet(None, sheet, &guard);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_InsertStyleSheetBefore(
     styles: RawServoAuthorStylesBorrowedMut,
-    sheet: *const ServoStyleSheet,
-    before_sheet: *const ServoStyleSheet,
+    sheet: *const DomStyleSheet,
+    before_sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     styles.stylesheets.insert_stylesheet_before(
         None,
         GeckoStyleSheet::new(sheet),
         GeckoStyleSheet::new(before_sheet),
         &guard,
     );
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_RemoveStyleSheet(
     styles: RawServoAuthorStylesBorrowedMut,
-    sheet: *const ServoStyleSheet,
+    sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     styles.stylesheets.remove_stylesheet(
         None,
         GeckoStyleSheet::new(sheet),
@@ -1449,48 +1449,48 @@ pub unsafe extern "C" fn Servo_StyleSet_
         mAffectsNonDocumentRules: affects_non_document_rules,
         mUsesViewportUnits: uses_viewport_units,
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_PrependStyleSheet(
     raw_data: RawServoStyleSetBorrowed,
-    sheet: *const ServoStyleSheet,
+    sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.prepend_stylesheet(sheet, &guard);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
     raw_data: RawServoStyleSetBorrowed,
-    sheet: *const ServoStyleSheet,
-    before_sheet: *const ServoStyleSheet
+    sheet: *const DomStyleSheet,
+    before_sheet: *const DomStyleSheet
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.insert_stylesheet_before(
         sheet,
         unsafe { GeckoStyleSheet::new(before_sheet) },
         &guard,
     );
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
     raw_data: RawServoStyleSetBorrowed,
-    sheet: *const ServoStyleSheet
+    sheet: *const DomStyleSheet
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.remove_stylesheet(sheet, &guard);
 }
@@ -1555,17 +1555,17 @@ pub extern "C" fn Servo_StyleSheet_GetRu
     sheet: RawServoStyleSheetContentsBorrowed
 ) -> ServoCssRulesStrong {
     StylesheetContents::as_arc(&sheet).rules.clone().into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_Clone(
     raw_sheet: RawServoStyleSheetContentsBorrowed,
-    reference_sheet: *const ServoStyleSheet,
+    reference_sheet: *const DomStyleSheet,
 ) -> RawServoStyleSheetContentsStrong {
     use style::shared_lock::{DeepCloneParams, DeepCloneWithLock};
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let contents = StylesheetContents::as_arc(&raw_sheet);
     let params = DeepCloneParams { reference_sheet };
 
     Arc::new(contents.deep_clone_with_lock(
@@ -1676,17 +1676,17 @@ pub extern "C" fn Servo_CssRules_ListTyp
 #[no_mangle]
 pub extern "C" fn Servo_CssRules_InsertRule(
     rules: ServoCssRulesBorrowed,
     contents: RawServoStyleSheetContentsBorrowed,
     rule: *const nsACString,
     index: u32,
     nested: bool,
     loader: *mut Loader,
-    gecko_stylesheet: *mut ServoStyleSheet,
+    gecko_stylesheet: *mut DomStyleSheet,
     rule_type: *mut u16,
 ) -> nsresult {
     let loader = if loader.is_null() {
         None
     } else {
         Some(StylesheetLoader::new(loader, gecko_stylesheet, ptr::null_mut(), ptr::null_mut()))
     };
     let loader = loader.as_ref().map(|loader| loader as &StyleStylesheetLoader);
@@ -2131,26 +2131,26 @@ pub extern "C" fn Servo_ImportRule_GetHr
     read_locked_arc(rule, |rule: &ImportRule| {
         write!(unsafe { &mut *result }, "{}", rule.url.as_str()).unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_GetSheet(
     rule: RawServoImportRuleBorrowed,
-) -> *const ServoStyleSheet {
+) -> *const DomStyleSheet {
     read_locked_arc(rule, |rule: &ImportRule| {
-        rule.stylesheet.as_sheet().unwrap().raw() as *const ServoStyleSheet
+        rule.stylesheet.as_sheet().unwrap().raw() as *const DomStyleSheet
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_SetSheet(
     rule: RawServoImportRuleBorrowed,
-    sheet: *mut ServoStyleSheet,
+    sheet: *mut DomStyleSheet,
 ) {
     write_locked_arc(rule, |rule: &mut ImportRule| {
         let sheet = unsafe { GeckoStyleSheet::new(sheet) };
         rule.stylesheet = ImportSheet::new(sheet);
     })
 }
 
 #[no_mangle]
--- a/servo/ports/geckolib/stylesheet_loader.rs
+++ b/servo/ports/geckolib/stylesheet_loader.rs
@@ -7,35 +7,37 @@ use nsstring::nsCString;
 use servo_arc::Arc;
 use style::context::QuirksMode;
 use style::error_reporting::NullReporter;
 use style::gecko::data::GeckoStyleSheet;
 use style::gecko::global_style_data::GLOBAL_STYLE_DATA;
 use style::gecko_bindings::bindings;
 use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
 use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
-use style::gecko_bindings::structs::{ServoStyleSheet, SheetLoadData, SheetLoadDataHolder};
+use style::gecko_bindings::structs::{StyleSheet as DomStyleSheet, SheetLoadData, SheetLoadDataHolder};
 use style::gecko_bindings::structs::URLExtraData;
 use style::gecko_bindings::sugar::ownership::FFIArcHelpers;
 use style::gecko_bindings::sugar::refptr::RefPtr;
 use style::media_queries::MediaList;
 use style::parser::ParserContext;
 use style::shared_lock::{Locked, SharedRwLock};
 use style::stylesheets::{ImportRule, Origin, StylesheetLoader as StyleStylesheetLoader};
 use style::stylesheets::StylesheetContents;
 use style::stylesheets::import_rule::ImportSheet;
 use style::values::CssUrl;
 
-pub struct StylesheetLoader(*mut Loader, *mut ServoStyleSheet, *mut SheetLoadData, *mut LoaderReusableStyleSheets);
+pub struct StylesheetLoader(*mut Loader, *mut DomStyleSheet, *mut SheetLoadData, *mut LoaderReusableStyleSheets);
 
 impl StylesheetLoader {
-    pub fn new(loader: *mut Loader,
-               parent: *mut ServoStyleSheet,
-               parent_load_data: *mut SheetLoadData,
-               reusable_sheets: *mut LoaderReusableStyleSheets) -> Self {
+    pub fn new(
+        loader: *mut Loader,
+        parent: *mut DomStyleSheet,
+        parent_load_data: *mut SheetLoadData,
+        reusable_sheets: *mut LoaderReusableStyleSheets,
+    ) -> Self {
         StylesheetLoader(loader, parent, parent_load_data, reusable_sheets)
     }
 }
 
 impl StyleStylesheetLoader for StylesheetLoader {
     fn request_stylesheet(
         &self,
         url: CssUrl,