Bug 1456471: Unify MediaList and ServoMediaList. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 24 Apr 2018 15:41:40 +0200
changeset 469154 60cbb70f1912edd725181b8a66d601566c2af28f
parent 469153 a1ea9ba622e615e1cb262894d1f8b9ee581ae43e
child 469155 ff274dd24756e046c25bf37451fa77286c7ce737
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1456471
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 1456471: Unify MediaList and ServoMediaList. r=xidorn MozReview-Commit-ID: KFWxoohpGlb
layout/style/MediaList.cpp
layout/style/MediaList.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.toml
layout/style/ServoMediaList.cpp
layout/style/ServoMediaList.h
layout/style/ServoMediaRule.cpp
layout/style/ServoMediaRule.h
layout/style/ServoStyleSheet.cpp
layout/style/moz.build
servo/components/style/gecko/data.rs
--- a/layout/style/MediaList.cpp
+++ b/layout/style/MediaList.cpp
@@ -5,19 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* base class for representation of media lists */
 
 #include "mozilla/dom/MediaList.h"
 
 #include "mozAutoDocUpdate.h"
 #include "mozilla/dom/MediaListBinding.h"
-#include "mozilla/ServoMediaList.h"
+#include "mozilla/ServoBindings.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheetInlines.h"
-#include "nsCSSParser.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
@@ -64,30 +64,113 @@ MediaList::DoMediaChange(Func aCallback)
     // and "owned by a sheet" (as in <style media>), and then pass something
     // meaningful here.
     mStyleSheet->RuleChanged(nullptr);
   }
 
   return rv;
 }
 
+already_AddRefed<MediaList>
+MediaList::Clone()
+{
+  RefPtr<MediaList> clone =
+    new MediaList(Servo_MediaList_DeepClone(mRawList).Consume());
+  return clone.forget();
+}
+
+MediaList::MediaList()
+  : mRawList(Servo_MediaList_Create().Consume())
+{
+}
+
+MediaList::MediaList(const nsAString& aMedia, CallerType aCallerType)
+  : MediaList()
+{
+  SetTextInternal(aMedia, aCallerType);
+}
+
+void
+MediaList::GetText(nsAString& aMediaText)
+{
+  Servo_MediaList_GetText(mRawList, &aMediaText);
+}
+
 /* static */ already_AddRefed<MediaList>
 MediaList::Create(const nsAString& aMedia, CallerType aCallerType)
 {
-  RefPtr<ServoMediaList> mediaList = new ServoMediaList(aMedia, aCallerType);
+  RefPtr<MediaList> mediaList = new MediaList(aMedia, aCallerType);
   return mediaList.forget();
 }
 
 void
+MediaList::SetText(const nsAString& aMediaText)
+{
+  SetTextInternal(aMediaText, CallerType::NonSystem);
+}
+
+void
 MediaList::GetMediaText(nsAString& aMediaText)
 {
   GetText(aMediaText);
 }
 
 void
+MediaList::SetTextInternal(const nsAString& aMediaText, CallerType aCallerType)
+{
+  NS_ConvertUTF16toUTF8 mediaText(aMediaText);
+  Servo_MediaList_SetText(mRawList, &mediaText, aCallerType);
+}
+
+uint32_t
+MediaList::Length()
+{
+  return Servo_MediaList_GetLength(mRawList);
+}
+
+void
+MediaList::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aReturn)
+{
+  aFound = Servo_MediaList_GetMediumAt(mRawList, aIndex, &aReturn);
+  if (!aFound) {
+    SetDOMStringToNull(aReturn);
+  }
+}
+
+nsresult
+MediaList::Delete(const nsAString& aOldMedium)
+{
+  NS_ConvertUTF16toUTF8 oldMedium(aOldMedium);
+  if (Servo_MediaList_DeleteMedium(mRawList, &oldMedium)) {
+    return NS_OK;
+  }
+  return NS_ERROR_DOM_NOT_FOUND_ERR;
+}
+
+bool
+MediaList::Matches(nsPresContext* aPresContext) const
+{
+  const RawServoStyleSet* rawSet =
+    aPresContext->StyleSet()->RawSet();
+  MOZ_ASSERT(rawSet, "The RawServoStyleSet should be valid!");
+  return Servo_MediaList_Matches(mRawList, rawSet);
+}
+
+nsresult
+MediaList::Append(const nsAString& aNewMedium)
+{
+  if (aNewMedium.IsEmpty()) {
+    return NS_ERROR_DOM_NOT_FOUND_ERR;
+  }
+  NS_ConvertUTF16toUTF8 newMedium(aNewMedium);
+  Servo_MediaList_AppendMedium(mRawList, &newMedium);
+  return NS_OK;
+}
+
+void
 MediaList::SetMediaText(const nsAString& aMediaText)
 {
   DoMediaChange([&]() {
     SetText(aMediaText);
     return NS_OK;
   });
 }
 
--- a/layout/style/MediaList.h
+++ b/layout/style/MediaList.h
@@ -6,16 +6,17 @@
 
 /* base class for representation of media lists */
 
 #ifndef mozilla_dom_MediaList_h
 #define mozilla_dom_MediaList_h
 
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/ErrorResult.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "mozilla/ServoUtils.h"
 
 #include "nsWrapperCache.h"
 
 class nsIDocument;
 class nsPresContext;
 class nsMediaQueryResultCacheKey;
 
@@ -27,66 +28,77 @@ namespace dom {
 // XXX This class doesn't use the branch dispatch approach that we use
 //     elsewhere for stylo, but instead just relies on virtual call.
 //     That's because this class should not be critical to performance,
 //     and using branch dispatch would make it much more complicated.
 //     Performance critical path should hold a subclass of this class
 //     directly. We may want to determine in the future whether the
 //     above is correct.
 
-class MediaList : public nsISupports
-                , public nsWrapperCache
+class MediaList final : public nsISupports
+                      , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaList)
 
+  // Needed for CSSOM, but please don't use it outside of that :)
+  explicit MediaList(already_AddRefed<RawServoMediaList> aRawList)
+    : mRawList(aRawList)
+  { }
+
   static already_AddRefed<MediaList> Create(const nsAString& aMedia,
                                             CallerType aCallerType =
                                               CallerType::NonSystem);
 
-  virtual already_AddRefed<MediaList> Clone() = 0;
+  already_AddRefed<MediaList> Clone();
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
   nsISupports* GetParentObject() const { return nullptr; }
 
-  virtual void GetText(nsAString& aMediaText) = 0;
-  virtual void SetText(const nsAString& aMediaText) = 0;
-  virtual bool Matches(nsPresContext* aPresContext) const = 0;
+  void GetText(nsAString& aMediaText);
+  void SetText(const nsAString& aMediaText);
+  bool Matches(nsPresContext* aPresContext) const;
 
   void SetStyleSheet(StyleSheet* aSheet);
 
   // WebIDL
   void Stringify(nsAString& aString)
   {
     GetMediaText(aString);
   }
   void GetMediaText(nsAString& aMediaText);
   void SetMediaText(const nsAString& aMediaText);
-  virtual uint32_t Length() = 0;
-  virtual void IndexedGetter(uint32_t aIndex, bool& aFound,
-                             nsAString& aReturn) = 0;
+  uint32_t Length();
+  void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aReturn);
   void Item(uint32_t aIndex, nsAString& aResult);
   void DeleteMedium(const nsAString& aMedium, ErrorResult& aRv);
   void AppendMedium(const nsAString& aMedium, ErrorResult& aRv);
 
 protected:
-  virtual nsresult Delete(const nsAString& aOldMedium) = 0;
-  virtual nsresult Append(const nsAString& aNewMedium) = 0;
+  MediaList(const nsAString& aMedia, CallerType);
+  MediaList();
+
+  void SetTextInternal(const nsAString& aMediaText, CallerType);
 
-  virtual ~MediaList() {
+  nsresult Delete(const nsAString& aOldMedium);
+  nsresult Append(const nsAString& aNewMedium);
+
+  ~MediaList()
+  {
     MOZ_ASSERT(!mStyleSheet, "Backpointer should have been cleared");
   }
 
   // not refcounted; sheet will let us know when it goes away
   // mStyleSheet is the sheet that needs to be dirtied when this
   // medialist changes
   StyleSheet* mStyleSheet = nullptr;
 
 private:
   template<typename Func>
   inline nsresult DoMediaChange(Func aCallback);
+  RefPtr<RawServoMediaList> mRawList;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_MediaList_h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -57,24 +57,24 @@
 #include "mozilla/Keyframe.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ServoElementSnapshot.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/SizeOfState.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/SystemGroup.h"
-#include "mozilla/ServoMediaList.h"
 #include "mozilla/ServoTraversalStatistics.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/RWLock.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/dom/HTMLTableCellElement.h"
 #include "mozilla/dom/HTMLBodyElement.h"
+#include "mozilla/dom/MediaList.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/URLExtraData.h"
 #include "mozilla/dom/CSSMozDocumentRule.h"
 
 #if defined(MOZ_MEMORY)
 # include "mozmemory.h"
 #endif
 
@@ -2603,17 +2603,17 @@ LoadImportSheet(css::Loader* aLoader,
                 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!");
   MOZ_ASSERT(aURL, "Invalid URLs shouldn't be loaded!");
 
-  RefPtr<dom::MediaList> media = new ServoMediaList(Move(aMediaList));
+  RefPtr<dom::MediaList> media = new MediaList(Move(aMediaList));
   nsCOMPtr<nsIURI> uri = aURL->GetURI();
   nsresult rv = uri ? NS_OK : NS_ERROR_FAILURE;
 
   StyleSheet* previousFirstChild = aParent->GetFirstChild();
   if (NS_SUCCEEDED(rv)) {
     rv = aLoader->LoadChildSheet(aParent, aParentLoadData, uri, media, aReusableSheets);
   }
 
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -53,31 +53,31 @@ headers = [
     "gfxFontConstants.h",
     "gfxFontFeatures.h",
     "nsThemeConstants.h",
     "mozilla/css/Loader.h",
     "mozilla/css/SheetLoadData.h",
     "mozilla/dom/AnimationEffectReadOnlyBinding.h",
     "mozilla/dom/HTMLSlotElement.h",
     "mozilla/dom/KeyframeEffectBinding.h",
+    "mozilla/dom/MediaList.h",
     "mozilla/dom/ShadowRoot.h",
     "mozilla/AnimationPropertySegment.h",
     "mozilla/ComputedTiming.h",
     "mozilla/ComputedTimingFunction.h",
     "mozilla/Keyframe.h",
     "mozilla/ServoElementSnapshot.h",
     "mozilla/ServoElementSnapshotTable.h",
     "mozilla/css/ErrorReporter.h",
     "mozilla/dom/Element.h",
     "mozilla/dom/ChildIterator.h",
     "mozilla/dom/NameSpaceConstants.h",
     "mozilla/LookAndFeel.h",
     "mozilla/StaticPrefs.h",
     "mozilla/ServoBindings.h",
-    "mozilla/ServoMediaList.h",
     "mozilla/ComputedStyle.h",
     "mozilla/ServoDeclarationBlock.h",
     "mozilla/ServoTraversalStatistics.h",
     "mozilla/SizeOfState.h",
     "nsContentUtils.h",
     "nsNameSpaceManager.h",
     "nsMediaFeatures.h",
     "nsXBLBinding.h",
@@ -288,17 +288,16 @@ whitelist-types = [
     "nsCSSValueTriplet_heap",
     "nsCursorImage",
     "nsFont",
     "nsAtom",
     "nsDynamicAtom",
     "nsMargin",
     "nsMediaFeature",
     "nsMediaFeatures",
-    "nsMediaList",
     "nsRect",
     "nsRestyleHint",
     "nsresult",
     "nsSimpleContentList",
     "nsSize",
     "nsStyleBackground",
     "nsStyleBorder",
     "nsStyleColor",
@@ -359,17 +358,17 @@ whitelist-types = [
     "ThemeWidgetType",
     "mozilla::UniquePtr",
     "mozilla::DefaultDelete",
     "mozilla::Side",
     "mozilla::binding_danger::AssertAndSuppressCleanupPolicy",
     "mozilla::ParsingMode",
     "mozilla::InheritTarget",
     "mozilla::ServoDeclarationBlock",
-    "mozilla::ServoMediaList",
+    "mozilla::dom::MediaList",
     "mozilla::StyleRuleInclusion",
     "nsStyleTransformMatrix::MatrixTransformOperator",
 ]
 opaque-types = [
     "std::pair__PCCP",
     "std::namespace::atomic___base", "std::atomic__My_base",
     "std::atomic",
     "std::atomic___base",
deleted file mode 100644
--- a/layout/style/ServoMediaList.cpp
+++ /dev/null
@@ -1,102 +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/. */
-
-/* representation of media lists for servo backend */
-
-#include "mozilla/ServoMediaList.h"
-
-#include "mozilla/ServoBindings.h"
-#include "mozilla/ServoStyleSet.h"
-
-namespace mozilla {
-
-already_AddRefed<dom::MediaList>
-ServoMediaList::Clone()
-{
-  RefPtr<ServoMediaList> clone =
-    new ServoMediaList(Servo_MediaList_DeepClone(mRawList).Consume());
-  return clone.forget();
-}
-
-ServoMediaList::ServoMediaList()
-  : mRawList(Servo_MediaList_Create().Consume())
-{
-}
-
-ServoMediaList::ServoMediaList(const nsAString& aMedia,
-                               dom::CallerType aCallerType)
-  : ServoMediaList()
-{
-  SetTextInternal(aMedia, aCallerType);
-}
-
-void
-ServoMediaList::GetText(nsAString& aMediaText)
-{
-  Servo_MediaList_GetText(mRawList, &aMediaText);
-}
-
-void
-ServoMediaList::SetText(const nsAString& aMediaText)
-{
-  SetTextInternal(aMediaText, dom::CallerType::NonSystem);
-}
-
-void
-ServoMediaList::SetTextInternal(const nsAString& aMediaText,
-                                dom::CallerType aCallerType)
-{
-  NS_ConvertUTF16toUTF8 mediaText(aMediaText);
-  Servo_MediaList_SetText(mRawList, &mediaText, aCallerType);
-}
-
-uint32_t
-ServoMediaList::Length()
-{
-  return Servo_MediaList_GetLength(mRawList);
-}
-
-void
-ServoMediaList::IndexedGetter(uint32_t aIndex, bool& aFound,
-                              nsAString& aReturn)
-{
-  aFound = Servo_MediaList_GetMediumAt(mRawList, aIndex, &aReturn);
-  if (!aFound) {
-    SetDOMStringToNull(aReturn);
-  }
-}
-
-nsresult
-ServoMediaList::Append(const nsAString& aNewMedium)
-{
-  if (aNewMedium.IsEmpty()) {
-    return NS_ERROR_DOM_NOT_FOUND_ERR;
-  }
-  NS_ConvertUTF16toUTF8 newMedium(aNewMedium);
-  Servo_MediaList_AppendMedium(mRawList, &newMedium);
-  return NS_OK;
-}
-
-nsresult
-ServoMediaList::Delete(const nsAString& aOldMedium)
-{
-  NS_ConvertUTF16toUTF8 oldMedium(aOldMedium);
-  if (Servo_MediaList_DeleteMedium(mRawList, &oldMedium)) {
-    return NS_OK;
-  }
-  return NS_ERROR_DOM_NOT_FOUND_ERR;
-}
-
-bool
-ServoMediaList::Matches(nsPresContext* aPresContext) const
-{
-  const RawServoStyleSet* rawSet =
-    aPresContext->StyleSet()->RawSet();
-  MOZ_ASSERT(rawSet, "The RawServoStyleSet should be valid!");
-  return Servo_MediaList_Matches(mRawList, rawSet);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/layout/style/ServoMediaList.h
+++ /dev/null
@@ -1,51 +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/. */
-
-/* representation of media lists for servo backend */
-
-#ifndef mozilla_ServoMediaList_h
-#define mozilla_ServoMediaList_h
-
-#include "mozilla/dom/MediaList.h"
-#include "mozilla/ServoBindingTypes.h"
-
-namespace mozilla {
-
-class ServoMediaList final : public dom::MediaList
-{
-public:
-  explicit ServoMediaList(already_AddRefed<RawServoMediaList> aRawList)
-    : mRawList(aRawList) {}
-  ServoMediaList(const nsAString& aMedia, dom::CallerType);
-  ServoMediaList();
-
-  already_AddRefed<dom::MediaList> Clone() final;
-
-  void GetText(nsAString& aMediaText) final;
-  void SetText(const nsAString& aMediaText) final;
-
-  uint32_t Length() final;
-  void IndexedGetter(uint32_t aIndex, bool& aFound,
-                     nsAString& aReturn) final;
-
-  bool Matches(nsPresContext*) const final;
-
-  RawServoMediaList& RawList() { return *mRawList; }
-
-protected:
-  nsresult Delete(const nsAString& aOldMedium) final;
-  nsresult Append(const nsAString& aNewMedium) final;
-  void SetTextInternal(const nsAString& aMediaText, dom::CallerType);
-
-  ~ServoMediaList() {}
-
-private:
-  RefPtr<RawServoMediaList> mRawList;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_ServoMediaList_h
--- a/layout/style/ServoMediaRule.cpp
+++ b/layout/style/ServoMediaRule.cpp
@@ -4,17 +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/. */
 
 /* representation of CSSMediaRule for stylo */
 
 #include "mozilla/ServoMediaRule.h"
 
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoMediaList.h"
+#include "mozilla/dom/MediaList.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 ServoMediaRule::ServoMediaRule(RefPtr<RawServoMediaRule> aRawRule,
                                uint32_t aLine, uint32_t aColumn)
   : CSSMediaRule(Servo_MediaRule_GetRules(aRawRule).Consume(), aLine, aColumn)
@@ -89,18 +89,17 @@ ServoMediaRule::GetCssText(nsAString& aC
 {
   Servo_MediaRule_GetCssText(mRawRule, &aCssText);
 }
 
 /* virtual */ dom::MediaList*
 ServoMediaRule::Media()
 {
   if (!mMediaList) {
-    mMediaList =
-      new ServoMediaList(Servo_MediaRule_GetMedia(mRawRule).Consume());
+    mMediaList = new MediaList(Servo_MediaRule_GetMedia(mRawRule).Consume());
     mMediaList->SetStyleSheet(GetStyleSheet());
   }
   return mMediaList;
 }
 
 /* virtual */ size_t
 ServoMediaRule::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
--- a/layout/style/ServoMediaRule.h
+++ b/layout/style/ServoMediaRule.h
@@ -9,18 +9,16 @@
 #ifndef mozilla_ServoMediaRule_h
 #define mozilla_ServoMediaRule_h
 
 #include "mozilla/dom/CSSMediaRule.h"
 #include "mozilla/ServoBindingTypes.h"
 
 namespace mozilla {
 
-class ServoMediaList;
-
 class ServoMediaRule final : public dom::CSSMediaRule
 {
 public:
   ServoMediaRule(RefPtr<RawServoMediaRule> aRawRule,
                  uint32_t aLine, uint32_t aColumn);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoMediaRule, dom::CSSMediaRule)
@@ -41,14 +39,14 @@ public:
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     const override;
 
 private:
   virtual ~ServoMediaRule();
 
   RefPtr<RawServoMediaRule> mRawRule;
-  RefPtr<ServoMediaList> mMediaList;
+  RefPtr<dom::MediaList> mMediaList;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoMediaRule_h
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #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/StaticPrefs.h"
 #include "mozilla/css/GroupRule.h"
 #include "mozilla/dom/CSSRuleList.h"
 #include "mozilla/dom/MediaList.h"
 #include "nsIStyleSheetLinkingElement.h"
 #include "ErrorReporter.h"
 #include "Loader.h"
 
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -90,17 +90,16 @@ EXPORTS.mozilla += [
     'ServoDocumentRule.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
     'ServoFontFaceRule.h',
     'ServoFontFeatureValuesRule.h',
     'ServoImportRule.h',
     'ServoKeyframeRule.h',
     'ServoKeyframesRule.h',
-    'ServoMediaList.h',
     'ServoMediaRule.h',
     'ServoNamespaceRule.h',
     'ServoPageRule.h',
     'ServoSpecifiedValues.h',
     'ServoStyleRule.h',
     'ServoStyleSet.h',
     'ServoStyleSetInlines.h',
     'ServoStyleSheet.h',
@@ -211,17 +210,16 @@ UNIFIED_SOURCES += [
     'ServoDeclarationBlock.cpp',
     'ServoDocumentRule.cpp',
     'ServoElementSnapshot.cpp',
     'ServoFontFaceRule.cpp',
     'ServoFontFeatureValuesRule.cpp',
     'ServoImportRule.cpp',
     'ServoKeyframeRule.cpp',
     'ServoKeyframesRule.cpp',
-    'ServoMediaList.cpp',
     'ServoMediaRule.cpp',
     'ServoNamespaceRule.cpp',
     'ServoPageRule.cpp',
     'ServoSpecifiedValues.cpp',
     'ServoStyleRule.cpp',
     'ServoStyleSet.cpp',
     'ServoStyleSheet.cpp',
     'ServoSupportsRule.cpp',
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -89,25 +89,25 @@ impl StylesheetInDocument for GeckoStyle
         self.contents().origin
     }
 
     fn quirks_mode(&self, _guard: &SharedRwLockReadGuard) -> QuirksMode {
         self.contents().quirks_mode
     }
 
     fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
-        use gecko_bindings::structs::ServoMediaList;
+        use gecko_bindings::structs::mozilla::dom::MediaList as DomMediaList;
         use std::mem;
 
         unsafe {
-            let servo_media_list = self.raw()._base.mMedia.mRawPtr as *const ServoMediaList;
-            if servo_media_list.is_null() {
+            let dom_media_list = self.raw()._base.mMedia.mRawPtr as *const DomMediaList;
+            if dom_media_list.is_null() {
                 return None;
             }
-            let raw_list = &*(*servo_media_list).mRawList.mRawPtr;
+            let raw_list = &*(*dom_media_list).mRawList.mRawPtr;
             let list = Locked::<MediaList>::as_arc(mem::transmute(&raw_list));
             Some(list.read_with(guard))
         }
     }
 
     // All the stylesheets Servo knows about are enabled, because that state is
     // handled externally by Gecko.
     fn enabled(&self) -> bool {