1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:27:35 +00:00

LibWeb: Make the paint tree GC-allocated

This simplifies the ownership model between DOM/layout/paint nodes
immensely by deferring to the garbage collector for figuring out what's
live and what's not.
This commit is contained in:
Andreas Kling 2023-01-11 12:51:49 +01:00
parent 35ba13802d
commit 4d401bf796
64 changed files with 148 additions and 108 deletions

View file

@ -14,8 +14,10 @@
namespace Web::Painting {
class PaintableBox : public Paintable {
JS_CELL(PaintableBox, Paintable);
public:
static NonnullRefPtr<PaintableBox> create(Layout::Box const&);
static JS::NonnullGCPtr<PaintableBox> create(Layout::Box const&);
virtual ~PaintableBox();
virtual void paint(PaintContext&, PaintPhase) const override;
@ -162,11 +164,10 @@ private:
};
class PaintableWithLines : public PaintableBox {
JS_CELL(PaintableWithLines, PaintableBox);
public:
static NonnullRefPtr<PaintableWithLines> create(Layout::BlockContainer const& block_container)
{
return adopt_ref(*new PaintableWithLines(block_container));
}
static JS::NonnullGCPtr<PaintableWithLines> create(Layout::BlockContainer const&);
virtual ~PaintableWithLines() override;
Layout::BlockContainer const& layout_box() const;