From 10d4f2fc1eadf7beaf5caee66312d38e9a29599c Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Fri, 1 Oct 2021 00:13:56 +0100 Subject: [PATCH] LibWeb: Implement HTMLStyleElement.sheet --- Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp | 7 +++++++ Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl | 3 +++ 3 files changed, 12 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index 4ff31bd113..ed853c2a07 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -144,4 +144,11 @@ void HTMLStyleElement::update_a_style_block() sheet.release_nonnull()); } +// https://drafts.csswg.org/cssom/#dom-linkstyle-sheet +RefPtr HTMLStyleElement::sheet() const +{ + // The sheet attribute must return the associated CSS style sheet for the node or null if there is no associated CSS style sheet. + return m_associated_css_style_sheet; +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h index 9643e33ad3..a96393093d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h @@ -23,6 +23,8 @@ public: void update_a_style_block(); + RefPtr sheet() const; + private: // https://drafts.csswg.org/cssom/#associated-css-style-sheet RefPtr m_associated_css_style_sheet; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl index a5ab2934f3..bab3c4d8ab 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl @@ -4,4 +4,7 @@ interface HTMLStyleElement : HTMLElement { [Reflect] attribute DOMString type; + // FIXME: This should come from a LinkStyle mixin + readonly attribute CSSStyleSheet? sheet; + };