summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2021-10-01 00:13:56 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-01 00:17:24 +0100
commit10d4f2fc1eadf7beaf5caee66312d38e9a29599c (patch)
tree68ccc6f1950c2d65e0beb32f6cccb4994b897802 /Userland/Libraries/LibWeb/HTML
parent2c6c9b73c88bd2feea66df8766212c2e586ea9aa (diff)
downloadserenity-10d4f2fc1eadf7beaf5caee66312d38e9a29599c.zip
LibWeb: Implement HTMLStyleElement.sheet
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl3
3 files changed, 12 insertions, 0 deletions
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<CSS::CSSStyleSheet> 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<CSS::CSSStyleSheet> sheet() const;
+
private:
// https://drafts.csswg.org/cssom/#associated-css-style-sheet
RefPtr<CSS::CSSStyleSheet> 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;
+
};