mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-24 02:09:28 +00:00
LibHTML: Add a simple <style> element for inline CSS
This commit is contained in:
28
Libraries/LibHTML/DOM/HTMLStyleElement.cpp
Normal file
28
Libraries/LibHTML/DOM/HTMLStyleElement.cpp
Normal file
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user