Coverage Report

Created: 2025-09-05 06:52

/src/serenity/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2023, Preston Taylor <95388976+PrestonLTaylor@users.noreply.github.com>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <LibWeb/SVG/SVGGraphicsElement.h>
10
#include <LibWeb/SVG/SVGViewport.h>
11
12
namespace Web::SVG {
13
14
class SVGSymbolElement final : public SVGGraphicsElement
15
    , public SVGViewport {
16
    WEB_PLATFORM_OBJECT(SVGSymbolElement, SVGGraphicsElement);
17
    JS_DECLARE_ALLOCATOR(SVGSymbolElement);
18
19
public:
20
0
    virtual ~SVGSymbolElement() override = default;
21
22
    void apply_presentational_hints(CSS::StyleProperties& style) const override;
23
24
0
    virtual Optional<ViewBox> view_box() const override { return m_view_box; }
25
    virtual Optional<PreserveAspectRatio> preserve_aspect_ratio() const override
26
0
    {
27
        // FIXME: Support the `preserveAspectRatio` attribute on <symbol>.
28
0
        return {};
29
0
    }
30
31
0
    JS::NonnullGCPtr<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
32
33
private:
34
    SVGSymbolElement(DOM::Document&, DOM::QualifiedName);
35
36
    virtual void initialize(JS::Realm&) override;
37
    virtual void visit_edges(Cell::Visitor&) override;
38
39
    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
40
41
    bool is_direct_child_of_use_shadow_tree() const;
42
43
    virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
44
45
    Optional<ViewBox> m_view_box;
46
47
    JS::GCPtr<SVGAnimatedRect> m_view_box_for_bindings;
48
};
49
50
}