Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6edbf3f983bd75b1ca65ebecdf0c812b404b48d5
https://github.com/WebKit/WebKit/commit/6edbf3f983bd75b1ca65ebecdf0c812b404b48d5
Author: Karl Dubost <[email protected]>
Date: 2026-06-12 (Fri, 12 Jun 2026)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs-expected.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs-ref.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing-expected.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing-ref.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs-expected.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs-ref.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs.svg
M Source/WebCore/rendering/svg/SVGTextChunk.cpp
M Source/WebCore/rendering/svg/SVGTextChunk.h
M Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp
M Source/WebCore/rendering/svg/SVGTextChunkBuilder.h
Log Message:
-----------
Differential text-alignment while stretching
https://bugs.webkit.org/show_bug.cgi?id=61855
rdar://94161279
Reviewed by Nikolas Zimmermann.
When an SVG <text> or <tspan> carries a list-valued x or y attribute,
WebKit splits its content into one chunk per listed value. Each
SVGTextChunk independently carried the element's textLength and applied
lengthAdjust="spacingAndGlyphs" on its own, so every
glyph was scaled to
fill the full target length — the glyphs piled up on top of each other
and rendered as a horizontal black bar.
Firefox and Chrome render it correctly.
SVG 2 §11.10 scopes textLength to "this element": "the adjustments on
all character data within this element are controlled by the value of
'textLength' on this element exclusively". Apply
lengthAdjust="spacingAndGlyphs" once across the group of chunks that
share an owning text content element: compute one scale and one pivot
over the group, write a single transform to every box in every chunk,
and skip per-chunk textLength application for the group. Single-chunk
elements (the common case) keep the existing fast path unchanged.
Three related cases remain unhandled and are pinned with FIXME + WPT:
* lengthAdjust="spacing" with list-valued x/y,
* nested <tspan textLength> inside <text textLength>,
* and the inline-size / forced-line-break guards that per §11.10 disable
textLength
entirely.
Tests:
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs-expected.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs-ref.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing-expected.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing-ref.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs-expected.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs-ref.svg
imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs.svg
* LayoutTests/TestExpectations:
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs-expected.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs-ref.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-x-spacingAndGlyphs.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing-expected.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing-ref.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacing.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs-expected.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs-ref.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textLength-list-y-spacingAndGlyphs.svg:
Added.
* Source/WebCore/rendering/svg/SVGTextChunk.cpp:
(WebCore::SVGTextChunk::SVGTextChunk):
(WebCore::SVGTextChunk::layout const):
* Source/WebCore/rendering/svg/SVGTextChunk.h:
* Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp:
(WebCore::SVGTextChunkBuilder::layoutTextChunks):
(WebCore::SVGTextChunkBuilder::applyElementLevelTextLength):
* Source/WebCore/rendering/svg/SVGTextChunkBuilder.h:
Canonical link:
https://flagged.apple.com:443/proxy?t2=DZ2I2G5xu4&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE1MTQ2QG1haW4=&emid=165d050f-9f67-4c28-a21b-8deb5e5b26ef&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications