Skip to content

Commit ed84fbc

Browse files
committed
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.
1 parent 702cee3 commit ed84fbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+94
-75
lines changed

Userland/Libraries/LibWeb/Layout/BlockContainer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Painting::PaintableWithLines const* BlockContainer::paint_box() const
8585
return static_cast<Painting::PaintableWithLines const*>(Box::paint_box());
8686
}
8787

88-
OwnPtr<Painting::Paintable> BlockContainer::create_paintable() const
88+
RefPtr<Painting::Paintable> BlockContainer::create_paintable() const
8989
{
9090
return Painting::PaintableWithLines::create(*this);
9191
}

Userland/Libraries/LibWeb/Layout/BlockContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BlockContainer : public Box {
3131

3232
Painting::PaintableWithLines const* paint_box() const;
3333

34-
virtual OwnPtr<Painting::Paintable> create_paintable() const override;
34+
virtual RefPtr<Painting::Paintable> create_paintable() const override;
3535

3636
private:
3737
virtual bool is_block_container() const final { return true; }

Userland/Libraries/LibWeb/Layout/Box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ bool Box::is_body() const
8686
return dom_node() && dom_node() == document().body();
8787
}
8888

89-
OwnPtr<Painting::Paintable> Box::create_paintable() const
89+
RefPtr<Painting::Paintable> Box::create_paintable() const
9090
{
9191
return Painting::PaintableBox::create(*this);
9292
}

Userland/Libraries/LibWeb/Layout/Box.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Box : public NodeWithStyleAndBoxModelMetrics {
4141

4242
virtual void did_set_rect() { }
4343

44-
virtual OwnPtr<Painting::Paintable> create_paintable() const override;
44+
virtual RefPtr<Painting::Paintable> create_paintable() const override;
4545

4646
protected:
4747
Box(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);

Userland/Libraries/LibWeb/Layout/ButtonBox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void ButtonBox::handle_associated_label_mousemove(Badge<Label>, bool is_inside_n
106106
set_needs_display();
107107
}
108108

109-
OwnPtr<Painting::Paintable> ButtonBox::create_paintable() const
109+
RefPtr<Painting::Paintable> ButtonBox::create_paintable() const
110110
{
111111
return Painting::ButtonPaintable::create(*this);
112112
}

Userland/Libraries/LibWeb/Layout/ButtonBox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ButtonBox : public LabelableNode {
2323

2424
bool being_pressed() const { return m_being_pressed; }
2525

26-
virtual OwnPtr<Painting::Paintable> create_paintable() const override;
26+
virtual RefPtr<Painting::Paintable> create_paintable() const override;
2727

2828
private:
2929
virtual bool wants_mouse_events() const override { return true; }

Userland/Libraries/LibWeb/Layout/CanvasBox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void CanvasBox::prepare_for_replaced_layout()
2525
set_intrinsic_height(dom_node().height());
2626
}
2727

28-
OwnPtr<Painting::Paintable> CanvasBox::create_paintable() const
28+
RefPtr<Painting::Paintable> CanvasBox::create_paintable() const
2929
{
3030
return Painting::CanvasPaintable::create(*this);
3131
}

Userland/Libraries/LibWeb/Layout/CanvasBox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CanvasBox : public ReplacedBox {
2020

2121
const HTML::HTMLCanvasElement& dom_node() const { return static_cast<const HTML::HTMLCanvasElement&>(ReplacedBox::dom_node()); }
2222

23-
virtual OwnPtr<Painting::Paintable> create_paintable() const override;
23+
virtual RefPtr<Painting::Paintable> create_paintable() const override;
2424
};
2525

2626
}

Userland/Libraries/LibWeb/Layout/CheckBox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void CheckBox::handle_associated_label_mousemove(Badge<Label>, bool is_inside_no
108108
set_needs_display();
109109
}
110110

111-
OwnPtr<Painting::Paintable> CheckBox::create_paintable() const
111+
RefPtr<Painting::Paintable> CheckBox::create_paintable() const
112112
{
113113
return Painting::CheckBoxPaintable::create(*this);
114114
}

Userland/Libraries/LibWeb/Layout/CheckBox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CheckBox : public LabelableNode {
2121

2222
bool being_pressed() const { return m_being_pressed; }
2323

24-
virtual OwnPtr<Painting::Paintable> create_paintable() const override;
24+
virtual RefPtr<Painting::Paintable> create_paintable() const override;
2525

2626
private:
2727
virtual bool wants_mouse_events() const override { return true; }

0 commit comments

Comments
 (0)