summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-25 22:05:42 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-25 22:05:42 +0100
commitefac8625703e9b059af0f32422d0d274f99ae475 (patch)
tree208fcd049aa33854071aef4772af4f519f8f56b3
parentfb11741f20c42e5d831dbd66bd5f2017a444f2f6 (diff)
downloadserenity-efac8625703e9b059af0f32422d0d274f99ae475.zip
LibWeb: Parse <style> element text content when inserted into document
1% progression on ACID3. :^)
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
index 9728a91c75..e9472b6745 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
@@ -27,6 +27,12 @@ void HTMLStyleElement::children_changed()
HTMLElement::children_changed();
}
+void HTMLStyleElement::inserted()
+{
+ update_a_style_block();
+ return HTMLElement::inserted();
+}
+
void HTMLStyleElement::removed_from(Node* old_parent)
{
update_a_style_block();
@@ -93,7 +99,7 @@ static void create_a_css_style_sheet(DOM::Document& document, String type, DOM::
// NOTE: This is basically done by children_changed() today:
// The element's children changed steps run.
//
-// NOTE: This is basically done by removed_from() today:
+// NOTE: This is basically done by inserted() and removed_from() today:
// The element is not on the stack of open elements of an HTML parser or XML parser, and it becomes connected or disconnected.
//
// https://html.spec.whatwg.org/multipage/semantics.html#update-a-style-block
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h
index c1a79ba45d..56261eaf01 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h
@@ -19,6 +19,7 @@ public:
virtual ~HTMLStyleElement() override;
virtual void children_changed() override;
+ virtual void inserted() override;
virtual void removed_from(Node*) override;
void update_a_style_block();