mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:37:45 +00:00
LibWeb: Make the layout tree GC-allocated
This removes a set of complex reference cycles between DOM, layout tree and browsing context. It also makes lifetimes much easier to reason about, as the DOM and layout trees are now free to keep each other alive.
This commit is contained in:
parent
83c5ff57d8
commit
268b9c5d90
72 changed files with 258 additions and 207 deletions
|
@ -19,7 +19,7 @@ SVGClipPathElement::~SVGClipPathElement()
|
|||
{
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGClipPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGClipPathElement final : public SVGElement {
|
|||
public:
|
||||
virtual ~SVGClipPathElement();
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGClipPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -19,7 +19,7 @@ SVGDefsElement::~SVGDefsElement()
|
|||
{
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGDefsElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
JS::GCPtr<Layout::Node> SVGDefsElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGDefsElement final : public SVGGraphicsElement {
|
|||
public:
|
||||
virtual ~SVGDefsElement();
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGDefsElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -16,9 +16,9 @@ SVGGElement::SVGGElement(DOM::Document& document, DOM::QualifiedName qualified_n
|
|||
{
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> SVGGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
return adopt_ref(*new Layout::SVGGraphicsBox(document(), *this, move(style)));
|
||||
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGGElement final : public SVGGraphicsElement {
|
|||
public:
|
||||
virtual ~SVGGElement() override = default;
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGGElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -16,9 +16,9 @@ SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedNa
|
|||
set_prototype(&Bindings::cached_web_prototype(realm(), "SVGGeometryElement"));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
return adopt_ref(*new Layout::SVGGeometryBox(document(), *this, move(style)));
|
||||
return heap().allocate_without_realm<Layout::SVGGeometryBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
float SVGGeometryElement::get_total_length()
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGGeometryElement : public SVGGraphicsElement {
|
|||
WEB_PLATFORM_OBJECT(SVGGeometryElement, SVGGraphicsElement);
|
||||
|
||||
public:
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
virtual Gfx::Path& get_path() = 0;
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualifi
|
|||
set_prototype(&Bindings::cached_web_prototype(realm(), "SVGSVGElement"));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
return adopt_ref(*new Layout::SVGSVGBox(document(), *this, move(style)));
|
||||
return heap().allocate_without_realm<Layout::SVGSVGBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGSVGElement final : public SVGGraphicsElement {
|
|||
WEB_PLATFORM_OBJECT(SVGSVGElement, SVGGraphicsElement);
|
||||
|
||||
public:
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue