mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 02:22:51 +00:00
LibWeb: Layout SVG <text> elements during layout (not while painting)
Previously, all SVG <text> elements were zero-sized boxes, that were only actually positioned and sized during painting. This led to a number of problems, the most visible of which being that text could not be scaled based on the viewBox. Which this patch, <text> elements get a correctly sized layout box, that can be hit-tested and respects the SVG viewBox. To share code with SVGGeometryElement's the PathData (from the prior commit) has been split into a computed path and computed transforms. The computed path is specific to geometry elements, but the computed transforms are shared between all SVG graphics elements.
This commit is contained in:
parent
dc9cb449b1
commit
c93d367d95
Notes:
sideshowbarker
2024-07-16 20:51:53 +09:00
Author: https://github.com/MacDue
Commit: c93d367d95
Pull-request: https://github.com/SerenityOS/serenity/pull/21681
Reviewed-by: https://github.com/kalenikaliaksandr ✅
16 changed files with 209 additions and 173 deletions
|
@ -45,10 +45,15 @@ Optional<TextAnchor> SVGTextContentElement::text_anchor() const
|
|||
}
|
||||
}
|
||||
|
||||
DeprecatedString SVGTextContentElement::text_contents() const
|
||||
{
|
||||
return child_text_content().trim_whitespace();
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars
|
||||
WebIDL::ExceptionOr<int> SVGTextContentElement::get_number_of_chars() const
|
||||
{
|
||||
auto chars = TRY_OR_THROW_OOM(vm(), utf8_to_utf16(child_text_content()));
|
||||
auto chars = TRY_OR_THROW_OOM(vm(), utf8_to_utf16(text_contents()));
|
||||
return static_cast<int>(chars.size());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue