diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-29 17:43:30 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-29 17:45:42 +0200 |
commit | a4fccc02ecb1a956edd98fc25e335bb7e4905bb1 (patch) | |
tree | f7a4568271e795a396621263f18e1666776fd267 /Libraries/LibHTML/DOM/HTMLStyleElement.cpp | |
parent | 7912592f89420248f41133026118d9c26b2b0cfb (diff) | |
download | serenity-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.cpp | 28 |
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); +} |