summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/DOM/HTMLStyleElement.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-29 17:43:30 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-29 17:45:42 +0200
commita4fccc02ecb1a956edd98fc25e335bb7e4905bb1 (patch)
treef7a4568271e795a396621263f18e1666776fd267 /Libraries/LibHTML/DOM/HTMLStyleElement.cpp
parent7912592f89420248f41133026118d9c26b2b0cfb (diff)
downloadserenity-a4fccc02ecb1a956edd98fc25e335bb7e4905bb1.zip
LibHTML: Add a simple <style> element for inline CSS
Diffstat (limited to 'Libraries/LibHTML/DOM/HTMLStyleElement.cpp')
-rw-r--r--Libraries/LibHTML/DOM/HTMLStyleElement.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp b/Libraries/LibHTML/DOM/HTMLStyleElement.cpp
new file mode 100644
index 0000000000..d527b58dcf
--- /dev/null
+++ b/Libraries/LibHTML/DOM/HTMLStyleElement.cpp
@@ -0,0 +1,28 @@
+#include <LibHTML/DOM/Document.h>
+#include <LibHTML/DOM/HTMLStyleElement.h>
+#include <LibHTML/Parser/CSSParser.h>
+
+HTMLStyleElement::HTMLStyleElement(Document& document, const String& tag_name)
+ : HTMLElement(document, tag_name)
+{
+}
+
+HTMLStyleElement::~HTMLStyleElement()
+{
+}
+
+void HTMLStyleElement::inserted_into(Node& new_parent)
+{
+ m_stylesheet = parse_css(text_content());
+ if (m_stylesheet)
+ document().add_sheet(*m_stylesheet);
+ HTMLElement::inserted_into(new_parent);
+}
+
+void HTMLStyleElement::removed_from(Node& old_parent)
+{
+ if (m_stylesheet) {
+ // FIXME: Remove the sheet from the document
+ }
+ return HTMLElement::removed_from(old_parent);
+}