summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-09 19:56:08 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-09 19:56:08 +0100
commit0e758b4da8ff9808ecb860974ac1ed470a3a8679 (patch)
tree016e41465d239da01919553d4ddfbfa20687ad77 /Userland/Libraries/LibWeb
parent45f717cfad03ae286cb31a25b5868e4230dbeb2e (diff)
downloadserenity-0e758b4da8ff9808ecb860974ac1ed470a3a8679.zip
LibWeb: Add the StyleSheet.href attribute
This is only ever null at the moment, as we only set it on <style> elements to begin with.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleSheet.h6
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleSheet.idl2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp6
3 files changed, 10 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleSheet.h b/Userland/Libraries/LibWeb/CSS/StyleSheet.h
index dc809624c4..7c921a3f35 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleSheet.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleSheet.h
@@ -26,6 +26,11 @@ public:
DOM::Element* owner_node() { return m_owner_node; }
void set_owner_node(DOM::Element*);
+ String href() const { return m_location; }
+
+ String location() const { return m_location; }
+ void set_location(String location) { m_location = move(location); }
+
String title() const { return m_title; }
void set_title(String title) { m_title = move(title); }
@@ -51,6 +56,7 @@ private:
WeakPtr<CSSStyleSheet> m_parent_style_sheet;
+ String m_location;
String m_title;
String m_type_string;
String m_media_string;
diff --git a/Userland/Libraries/LibWeb/CSS/StyleSheet.idl b/Userland/Libraries/LibWeb/CSS/StyleSheet.idl
index bf7ca4c25a..700cbff601 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleSheet.idl
+++ b/Userland/Libraries/LibWeb/CSS/StyleSheet.idl
@@ -7,7 +7,7 @@ interface StyleSheet {
readonly attribute Element? ownerNode;
readonly attribute CSSOMString type;
- // readonly attribute USVString? href;
+ readonly attribute USVString? href;
readonly attribute CSSStyleSheet? parentStyleSheet;
readonly attribute DOMString? title;
// [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
index e9472b6745..2b1d24c55f 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
@@ -74,7 +74,7 @@ static void add_a_css_style_sheet(DOM::Document& document, NonnullRefPtr<CSS::CS
}
// https://www.w3.org/TR/cssom/#create-a-css-style-sheet
-static void create_a_css_style_sheet(DOM::Document& document, String type, DOM::Element* owner_node, String media, String title, bool alternate, bool origin_clean, void* location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, NonnullRefPtr<CSS::CSSStyleSheet> sheet)
+static void create_a_css_style_sheet(DOM::Document& document, String type, DOM::Element* owner_node, String media, String title, bool alternate, bool origin_clean, String location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, NonnullRefPtr<CSS::CSSStyleSheet> sheet)
{
// 1. Create a new CSS style sheet object and set its properties as specified.
// FIXME: We receive `sheet` from the caller already. This is weird.
@@ -87,7 +87,7 @@ static void create_a_css_style_sheet(DOM::Document& document, String type, DOM::
sheet->set_title(move(title));
sheet->set_alternate(alternate);
sheet->set_origin_clean(origin_clean);
- (void)location;
+ sheet->set_location(move(location));
// 2. Then run the add a CSS style sheet steps for the newly created CSS style sheet.
add_a_css_style_sheet(document, move(sheet));
@@ -144,7 +144,7 @@ void HTMLStyleElement::update_a_style_block()
in_a_document_tree() ? attribute(HTML::AttributeNames::title) : String::empty(),
false,
true,
- nullptr,
+ {},
nullptr,
nullptr,
sheet.release_nonnull());