1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:47:47 +00:00

LibWeb: Make Paintable ref-counted

This will allow us to use a protective NonnullRefPtr to keep paintables
alive while running arbitrary JavaScript in response to events.
This commit is contained in:
Andreas Kling 2022-03-10 22:38:08 +01:00
parent 702cee3d7c
commit ed84fbce47
58 changed files with 94 additions and 75 deletions

View file

@ -54,10 +54,11 @@ public:
const DOM::Node* dom_node() const { return m_dom_node; }
DOM::Node* dom_node() { return m_dom_node; }
Painting::Paintable* paintable() { return m_paintable; }
Painting::Paintable const* paintable() const { return m_paintable; }
void set_paintable(OwnPtr<Painting::Paintable>);
void set_paintable(RefPtr<Painting::Paintable>);
virtual OwnPtr<Painting::Paintable> create_paintable() const;
virtual RefPtr<Painting::Paintable> create_paintable() const;
DOM::Document& document() { return m_document; }
const DOM::Document& document() const { return m_document; }
@ -224,7 +225,7 @@ private:
NonnullRefPtr<DOM::Document> m_document;
RefPtr<DOM::Node> m_dom_node;
OwnPtr<Painting::Paintable> m_paintable;
RefPtr<Painting::Paintable> m_paintable;
bool m_inline { false };
bool m_has_style { false };