diff --git a/layout/style/MediaList.h b/layout/style/MediaList.h index c31fd887f146..99370dbd9a55 100644 --- a/layout/style/MediaList.h +++ b/layout/style/MediaList.h @@ -41,11 +41,18 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaList) /** - * Creates a MediaList backed by the StyleBackendType of the document. + * Creates a MediaList backed by the given StyleBackendType. */ static already_AddRefed Create(StyleBackendType, const nsAString& aMedia); + /** + * Creates a MediaList backed by the given StyleBackendType. + */ + static already_AddRefed Create(StyleBackendType aBackendType) { + return Create(aBackendType, nsString()); + } + /** * Creates a MediaList backed by the StyleBackendType of the document. */ diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index dadb6b14f4b1..9cea71c88043 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -14,7 +14,6 @@ #include "mozilla/CSSStyleSheet.h" #include "mozAutoDocUpdate.h" -#include "nsMediaList.h" #include "NullPrincipal.h" namespace mozilla { @@ -692,7 +691,7 @@ dom::MediaList* StyleSheet::Media() { if (!mMedia) { - mMedia = new nsMediaList(); + mMedia = dom::MediaList::Create(mType); mMedia->SetStyleSheet(this); }