LibWeb: Port SVGFormattingContext to UTF-16

This commit is contained in:
Timothy Flynn 2025-08-05 07:11:58 -04:00 committed by Jelle Raaijmakers
commit 04d32deb52
Notes: github-actions[bot] 2025-08-05 13:14:54 +00:00
3 changed files with 7 additions and 10 deletions

View file

@ -40,16 +40,15 @@ Optional<TextAnchor> SVGTextContentElement::text_anchor() const
}
}
ByteString SVGTextContentElement::text_contents() const
Utf16String SVGTextContentElement::text_contents() const
{
return child_text_content().to_byte_string().trim_whitespace();
return child_text_content().trim_ascii_whitespace();
}
// https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars
WebIDL::ExceptionOr<WebIDL::Long> SVGTextContentElement::get_number_of_chars() const
{
auto length_in_code_units = AK::utf16_code_unit_length_from_utf8(text_contents());
return static_cast<WebIDL::Long>(length_in_code_units);
return static_cast<WebIDL::Long>(text_contents().length_in_code_units());
}
GC::Ref<Geometry::DOMPoint> SVGTextContentElement::get_start_position_of_char(WebIDL::UnsignedLong charnum)