2023-07-22 21:34:51 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2024-04-27 03:09:58 +03:00
|
|
|
#include <LibWeb/Bindings/SVGTSpanElementPrototype.h>
|
2023-07-22 21:34:51 +03:00
|
|
|
#include <LibWeb/Layout/SVGTextBox.h>
|
|
|
|
#include <LibWeb/SVG/SVGTSpanElement.h>
|
|
|
|
#include <LibWeb/SVG/SVGTextElement.h>
|
|
|
|
|
|
|
|
namespace Web::SVG {
|
|
|
|
|
2023-11-19 21:47:52 +03:00
|
|
|
JS_DEFINE_ALLOCATOR(SVGTSpanElement);
|
|
|
|
|
2023-07-22 21:34:51 +03:00
|
|
|
SVGTSpanElement::SVGTSpanElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
|
|
|
: SVGTextPositioningElement(document, move(qualified_name))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-08-07 09:41:28 +03:00
|
|
|
void SVGTSpanElement::initialize(JS::Realm& realm)
|
2023-07-22 21:34:51 +03:00
|
|
|
{
|
2023-08-07 09:41:28 +03:00
|
|
|
Base::initialize(realm);
|
2024-03-16 15:13:08 +03:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTSpanElement);
|
2023-07-22 21:34:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
JS::GCPtr<Layout::Node> SVGTSpanElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
|
|
|
{
|
|
|
|
// Text must be within an SVG <text> element.
|
|
|
|
if (shadow_including_first_ancestor_of_type<SVGTextElement>())
|
|
|
|
return heap().allocate_without_realm<Layout::SVGTextBox>(document(), *this, move(style));
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|