/src/serenity/Userland/Libraries/LibWeb/SVG/SVGTSpanElement.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, MacDue <macdue@dueutil.tech> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/SVGTSpanElementPrototype.h> |
8 | | #include <LibWeb/Layout/SVGTextBox.h> |
9 | | #include <LibWeb/SVG/SVGTSpanElement.h> |
10 | | #include <LibWeb/SVG/SVGTextElement.h> |
11 | | |
12 | | namespace Web::SVG { |
13 | | |
14 | | JS_DEFINE_ALLOCATOR(SVGTSpanElement); |
15 | | |
16 | | SVGTSpanElement::SVGTSpanElement(DOM::Document& document, DOM::QualifiedName qualified_name) |
17 | 0 | : SVGTextPositioningElement(document, move(qualified_name)) |
18 | 0 | { |
19 | 0 | } |
20 | | |
21 | | void SVGTSpanElement::initialize(JS::Realm& realm) |
22 | 0 | { |
23 | 0 | Base::initialize(realm); |
24 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTSpanElement); |
25 | 0 | } |
26 | | |
27 | | JS::GCPtr<Layout::Node> SVGTSpanElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) |
28 | 0 | { |
29 | | // Text must be within an SVG <text> element. |
30 | 0 | if (shadow_including_first_ancestor_of_type<SVGTextElement>()) |
31 | 0 | return heap().allocate_without_realm<Layout::SVGTextBox>(document(), *this, move(style)); |
32 | 0 | return {}; |
33 | 0 | } |
34 | | |
35 | | } |