mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +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:
parent
77e6dbab33
commit
0e12503586
14 changed files with 195 additions and 45 deletions
|
@ -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 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue