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.
32 lines
877 B
C++
32 lines
877 B
C++
/*
|
|
* Copyright (c) 2024, Kostya Farber <kostya.farber@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
|
|
|
namespace Web::Painting {
|
|
|
|
class FieldSetPaintable final : public PaintableBox {
|
|
public:
|
|
static NonnullRefPtr<FieldSetPaintable> create(Layout::FieldSetBox const&);
|
|
virtual StringView class_name() const override { return "FieldSetPaintable"sv; }
|
|
|
|
virtual void paint(DisplayListRecordingContext&, PaintPhase) const override;
|
|
virtual void paint_background(DisplayListRecordingContext&) const override;
|
|
|
|
private:
|
|
explicit FieldSetPaintable(Layout::FieldSetBox const&);
|
|
|
|
Layout::FieldSetBox& layout_box();
|
|
Layout::FieldSetBox const& layout_box() const;
|
|
|
|
CSSPixels effective_border_top() const;
|
|
CSSPixelRect visual_border_box_rect() const;
|
|
};
|
|
|
|
}
|