ladybird/Libraries/LibWeb/Layout/SVGPatternBox.h
Andreas Kling 7c06c3fd14 LibWeb: Make computed style data refcounted
Move ComputedProperties and CascadedProperties out of the GC. They no
longer contain strong references to GC-managed data.

Keep computed styles alive from DOM elements and animation updates with
RefPtr. Pass style into layout constructors by reference, since layout
only copies the values it needs while building nodes.

Use GC::Weak for cascade source links, so entries no longer keep the
style declaration or shadow root alive.
2026-06-06 23:29:48 +02:00

34 lines
967 B
C++

/*
* Copyright (c) 2026, Tim Ledbetter <tim.ledbetter@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Layout/SVGBox.h>
#include <LibWeb/SVG/SVGPatternElement.h>
namespace Web::Layout {
class SVGPatternBox final : public SVGBox {
GC_CELL(SVGPatternBox, SVGBox);
GC_DECLARE_ALLOCATOR(SVGPatternBox);
public:
SVGPatternBox(DOM::Document&, SVG::SVGPatternElement&, CSS::ComputedProperties const&);
virtual ~SVGPatternBox() override = default;
SVG::SVGPatternElement& dom_node() { return as<SVG::SVGPatternElement>(SVGBox::dom_node()); }
SVG::SVGPatternElement const& dom_node() const { return as<SVG::SVGPatternElement>(SVGBox::dom_node()); }
virtual RefPtr<Painting::Paintable> create_paintable() const override;
private:
virtual bool is_svg_pattern_box() const final { return true; }
};
template<>
inline bool Node::fast_is<SVGPatternBox>() const { return is_svg_pattern_box(); }
}