mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-14 10:59:24 +02:00
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.
36 lines
972 B
C++
36 lines
972 B
C++
/*
|
|
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Layout/SVGBox.h>
|
|
#include <LibWeb/SVG/SVGClipPathElement.h>
|
|
#include <LibWeb/SVG/SVGElement.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
class SVGClipBox final : public SVGBox {
|
|
GC_CELL(SVGClipBox, SVGBox);
|
|
GC_DECLARE_ALLOCATOR(SVGClipBox);
|
|
|
|
public:
|
|
SVGClipBox(DOM::Document&, SVG::SVGClipPathElement&, GC::Ref<CSS::ComputedProperties>);
|
|
virtual ~SVGClipBox() override = default;
|
|
|
|
SVG::SVGClipPathElement& dom_node() { return as<SVG::SVGClipPathElement>(SVGBox::dom_node()); }
|
|
SVG::SVGClipPathElement const& dom_node() const { return as<SVG::SVGClipPathElement>(SVGBox::dom_node()); }
|
|
|
|
virtual RefPtr<Painting::Paintable> create_paintable() const override;
|
|
|
|
private:
|
|
virtual bool is_svg_clip_box() const final { return true; }
|
|
};
|
|
|
|
template<>
|
|
inline bool Node::fast_is<SVGClipBox>() const { return is_svg_clip_box(); }
|
|
|
|
}
|