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.
32 lines
979 B
C++
32 lines
979 B
C++
/*
|
|
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Optional.h>
|
|
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
|
#include <LibWeb/SVG/SVGTextPositioningElement.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
class SVGTextBox final : public SVGGraphicsBox {
|
|
GC_CELL(SVGTextBox, SVGGraphicsBox);
|
|
GC_DECLARE_ALLOCATOR(SVGTextBox);
|
|
|
|
public:
|
|
SVGTextBox(DOM::Document&, SVG::SVGTextPositioningElement&, CSS::ComputedProperties const&);
|
|
virtual ~SVGTextBox() override = default;
|
|
|
|
SVG::SVGTextPositioningElement& dom_node() { return static_cast<SVG::SVGTextPositioningElement&>(SVGGraphicsBox::dom_node()); }
|
|
SVG::SVGTextPositioningElement const& dom_node() const { return static_cast<SVG::SVGTextPositioningElement const&>(SVGGraphicsBox::dom_node()); }
|
|
|
|
virtual RefPtr<Painting::Paintable> create_paintable() const override;
|
|
|
|
private:
|
|
CSSPixelPoint viewbox_origin() const;
|
|
};
|
|
|
|
}
|