diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-29 16:01:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-29 16:35:46 +0200 |
commit | 427beb97b51be36e29797a76419405589b9f4cdd (patch) | |
tree | 63162361f45c9225387102a423679c313c283244 /Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h | |
parent | 3efa6cedec027647a2e4d6fcb1408102a6b3a98c (diff) | |
download | serenity-427beb97b51be36e29797a76419405589b9f4cdd.zip |
LibWeb: Streamline how inline CSS style declarations are constructed
When parsing the "style" attribute on elements, we'd previously ask the
CSS parser for a PropertyOwningCSSStyleDeclaration. Then we'd create a
new ElementCSSInlineStyleDeclaration and transfer the properties from
the first object to the second object.
This patch teaches the parser to make ElementCSSInlineStyleDeclaration
objects directly.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h index 2383fca7cd..fcf5ff116a 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h @@ -86,16 +86,14 @@ private: class ElementInlineCSSStyleDeclaration final : public PropertyOwningCSSStyleDeclaration { public: - static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element& element) { return adopt_ref(*new ElementInlineCSSStyleDeclaration(element)); } - static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create_and_take_properties_from(DOM::Element& element, PropertyOwningCSSStyleDeclaration& declaration) { return adopt_ref(*new ElementInlineCSSStyleDeclaration(element, declaration)); } + static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties) { return adopt_ref(*new ElementInlineCSSStyleDeclaration(element, move(properties), move(custom_properties))); } virtual ~ElementInlineCSSStyleDeclaration() override = default; DOM::Element* element() { return m_element.ptr(); } const DOM::Element* element() const { return m_element.ptr(); } private: - explicit ElementInlineCSSStyleDeclaration(DOM::Element&); - explicit ElementInlineCSSStyleDeclaration(DOM::Element&, PropertyOwningCSSStyleDeclaration&); + explicit ElementInlineCSSStyleDeclaration(DOM::Element&, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties); WeakPtr<DOM::Element> m_element; }; |