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