LibWeb: Make Paintable tree ref-counted

The Paintable tree and its supplemental painting data structures were
GC allocated because that was the easiest way to manage it and avoid
leaks introduced by ref cycles. This included the Paintable subclasses
themselves plus StackingContext, ChromeWidget, Scrollbar, ResizeHandle,
and scroll-frame state.

We are now trying to reduce GC allocation churn on layout and painting
updates, so keeping this short-lived rendering tree outside the JS heap
is a better fit. Move Paintable to RefCountedTreeNode, make painting
helpers ref-counted or weakly reference Paintables, and update the
layout and event-handler call sites to use RefPtr/WeakPtr ownership.
This commit is contained in:
Aliaksandr Kalenik
2026-05-07 13:38:05 +02:00
committed by Alexander Kalenik
parent 8bc3f5950f
commit 568b7ce7ea
Notes: github-actions[bot] 2026-05-07 13:04:49 +00:00
135 changed files with 682 additions and 698 deletions

View File

@@ -2376,7 +2376,7 @@ WebIDL::UnsignedLong HTMLInputElement::height() const
return 0;
// Return the rendered height of the image, in CSS pixels, if the image is being rendered.
if (auto* paintable_box = this->paintable_box())
if (auto paintable_box = this->paintable_box())
return paintable_box->content_height().to_int();
// On setting [the width or height IDL attribute], they must act as if they reflected the respective content attributes of the same name.
@@ -2411,7 +2411,7 @@ WebIDL::UnsignedLong HTMLInputElement::width() const
return 0;
// Return the rendered width of the image, in CSS pixels, if the image is being rendered.
if (auto* paintable_box = this->paintable_box())
if (auto paintable_box = this->paintable_box())
return paintable_box->content_width().to_int();
// On setting [the width or height IDL attribute], they must act as if they reflected the respective content attributes of the same name.