mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWeb: Split SVGTextContentElement into spec defined subclasses
As part of this move properties/methods to the correct subclass
(position related properties go under SVGTextPositioningElement).
SVG text element hierarchy:
SVGTextContentElement
^- SVGTextPositioningElement
^- SVGTextElement
^- SVGTSpanElement
^- SVGTextPathElement (TODO)
^- SVGTRefElement (TODO)
This commit is contained in:
@@ -47,26 +47,6 @@ Optional<TextAnchor> SVGTextContentElement::text_anchor() const
|
||||
}
|
||||
}
|
||||
|
||||
void SVGTextContentElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
{
|
||||
SVGGraphicsElement::attribute_changed(name, value);
|
||||
|
||||
if (name == SVG::AttributeNames::x) {
|
||||
m_x = AttributeParser::parse_coordinate(value).value_or(m_x);
|
||||
} else if (name == SVG::AttributeNames::y) {
|
||||
m_y = AttributeParser::parse_coordinate(value).value_or(m_y);
|
||||
} else if (name == SVG::AttributeNames::dx) {
|
||||
m_dx = AttributeParser::parse_coordinate(value).value_or(m_dx);
|
||||
} else if (name == SVG::AttributeNames::dy) {
|
||||
m_dy = AttributeParser::parse_coordinate(value).value_or(m_dy);
|
||||
}
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGTextContentElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::SVGTextBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars
|
||||
WebIDL::ExceptionOr<int> SVGTextContentElement::get_number_of_chars() const
|
||||
{
|
||||
@@ -74,9 +54,4 @@ WebIDL::ExceptionOr<int> SVGTextContentElement::get_number_of_chars() const
|
||||
return static_cast<int>(chars.size());
|
||||
}
|
||||
|
||||
Gfx::FloatPoint SVGTextContentElement::get_offset() const
|
||||
{
|
||||
return { m_x + m_dx, m_y + m_dy };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user