mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
LibWeb: Ensure inline CSS loaded from HTML is ElementInline
This commit changes inline CSS loaded from style attributes of HTML elements to be loaded as CSS::ElementInlineCSSStyleDeclaration instead of CSS::CSSStyleDeclaration, fixing a crash when the style of that element is changed from JavaScript.
This commit is contained in:
parent
afcd053b68
commit
0fdfdbed9f
3 changed files with 14 additions and 2 deletions
|
@ -44,6 +44,7 @@ protected:
|
|||
explicit CSSStyleDeclaration(Vector<StyleProperty>&&, HashMap<String, StyleProperty>&&);
|
||||
|
||||
private:
|
||||
friend class ElementInlineCSSStyleDeclaration;
|
||||
friend class Bindings::CSSStyleDeclarationWrapper;
|
||||
|
||||
Vector<StyleProperty> m_properties;
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
class ElementInlineCSSStyleDeclaration final : public CSSStyleDeclaration {
|
||||
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, CSSStyleDeclaration& declaration) { return adopt_ref(*new ElementInlineCSSStyleDeclaration(element, declaration)); }
|
||||
virtual ~ElementInlineCSSStyleDeclaration() override;
|
||||
|
||||
DOM::Element* element() { return m_element.ptr(); }
|
||||
|
@ -60,6 +62,7 @@ public:
|
|||
|
||||
private:
|
||||
explicit ElementInlineCSSStyleDeclaration(DOM::Element&);
|
||||
explicit ElementInlineCSSStyleDeclaration(DOM::Element&, CSSStyleDeclaration&);
|
||||
|
||||
WeakPtr<DOM::Element> m_element;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue