summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-16 18:55:53 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-16 19:00:42 +0100
commitcad4cc9a2aaefabcf92a81a410a3337b4bf7e408 (patch)
tree2591fe731601dbc4983e7a06569bee91654d6251 /Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h
parent6c8185151e564a79c696f24583aac4eafd3bcf04 (diff)
downloadserenity-cad4cc9a2aaefabcf92a81a410a3337b4bf7e408.zip
LibWeb: Invalidate element style after setting Element.style.foo
This makes us recompute style for the element so the change actually takes effect. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h')
-rw-r--r--Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h
index d96b94a687..70f226e968 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h
+++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h
@@ -50,21 +50,36 @@ public:
return adopt(*new CSSStyleDeclaration(move(properties)));
}
- ~CSSStyleDeclaration();
+ virtual ~CSSStyleDeclaration();
const Vector<StyleProperty>& properties() const { return m_properties; }
size_t length() const { return m_properties.size(); }
String item(size_t index) const;
+protected:
+ explicit CSSStyleDeclaration(Vector<StyleProperty>&&);
+
private:
friend class Bindings::CSSStyleDeclarationWrapper;
- explicit CSSStyleDeclaration(Vector<StyleProperty>&&);
-
Vector<StyleProperty> m_properties;
};
+class ElementInlineCSSStyleDeclaration final : public CSSStyleDeclaration {
+public:
+ static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element& element) { return adopt(*new ElementInlineCSSStyleDeclaration(element)); }
+ virtual ~ElementInlineCSSStyleDeclaration() override;
+
+ DOM::Element* element() { return m_element.ptr(); }
+ const DOM::Element* element() const { return m_element.ptr(); }
+
+private:
+ explicit ElementInlineCSSStyleDeclaration(DOM::Element&);
+
+ WeakPtr<DOM::Element> m_element;
+};
+
}
namespace Web::Bindings {