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.
34 lines
976 B
C++
34 lines
976 B
C++
/*
|
|
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
|
#include <LibWeb/SVG/SVGElement.h>
|
|
#include <LibWeb/SVG/SVGMaskElement.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
class SVGMaskBox : public SVGGraphicsBox {
|
|
GC_CELL(SVGMaskBox, SVGGraphicsBox);
|
|
GC_DECLARE_ALLOCATOR(SVGMaskBox);
|
|
|
|
public:
|
|
SVGMaskBox(DOM::Document&, SVG::SVGMaskElement&, GC::Ref<CSS::ComputedProperties>);
|
|
virtual ~SVGMaskBox() override = default;
|
|
|
|
virtual bool is_svg_mask_box() const override { return true; }
|
|
|
|
SVG::SVGMaskElement& dom_node() { return as<SVG::SVGMaskElement>(SVGGraphicsBox::dom_node()); }
|
|
SVG::SVGMaskElement const& dom_node() const { return as<SVG::SVGMaskElement>(SVGGraphicsBox::dom_node()); }
|
|
|
|
virtual RefPtr<Painting::Paintable> create_paintable() const override;
|
|
};
|
|
|
|
template<>
|
|
inline bool Node::fast_is<SVGMaskBox>() const { return is_svg_mask_box(); }
|
|
|
|
}
|