diff --git a/Libraries/LibWeb/CSS/CSSImportRule.cpp b/Libraries/LibWeb/CSS/CSSImportRule.cpp index ec99bdfe1f3..49f61e89b56 100644 --- a/Libraries/LibWeb/CSS/CSSImportRule.cpp +++ b/Libraries/LibWeb/CSS/CSSImportRule.cpp @@ -174,6 +174,15 @@ void CSSImportRule::set_style_sheet(GC::Ref style_sheet) m_document->invalidate_style(DOM::StyleInvalidationReason::CSSImportRule); } +// https://drafts.csswg.org/cssom/#dom-cssimportrule-media +GC::Ptr CSSImportRule::media() const +{ + // The media attribute must return the value of the media attribute of the associated CSS style sheet. + if (!m_style_sheet) + return nullptr; + return m_style_sheet->media(); +} + Optional CSSImportRule::supports_text() const { if (!m_supports) diff --git a/Libraries/LibWeb/CSS/CSSImportRule.h b/Libraries/LibWeb/CSS/CSSImportRule.h index 8b51b5a11e5..a3712ed3bfa 100644 --- a/Libraries/LibWeb/CSS/CSSImportRule.h +++ b/Libraries/LibWeb/CSS/CSSImportRule.h @@ -31,6 +31,7 @@ public: CSSStyleSheet* loaded_style_sheet() { return m_style_sheet; } CSSStyleSheet const* loaded_style_sheet() const { return m_style_sheet; } + GC::Ptr media() const; CSSStyleSheet* style_sheet_for_bindings() { return m_style_sheet; } Optional supports_text() const; diff --git a/Libraries/LibWeb/CSS/CSSImportRule.idl b/Libraries/LibWeb/CSS/CSSImportRule.idl index d6f7446e4af..2256427abd2 100644 --- a/Libraries/LibWeb/CSS/CSSImportRule.idl +++ b/Libraries/LibWeb/CSS/CSSImportRule.idl @@ -6,7 +6,7 @@ [Exposed=Window] interface CSSImportRule : CSSRule { readonly attribute USVString href; - // FIXME: [SameObject, PutForwards=mediaText] readonly attribute MediaList media; + [SameObject, PutForwards=mediaText] readonly attribute MediaList media; [SameObject, ImplementedAs=style_sheet_for_bindings] readonly attribute CSSStyleSheet? styleSheet; [FIXME] readonly attribute CSSOMString? layerName; readonly attribute CSSOMString? supportsText;