Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e7766cc21cd477f63f5ddd9d2d3d00654442438d
https://github.com/WebKit/WebKit/commit/e7766cc21cd477f63f5ddd9d2d3d00654442438d
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-08 (Thu, 08 Oct 2026)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-startoffset-expected.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-startoffset-ref.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-startoffset.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-subpaths-expected.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-subpaths-ref.svg
A
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-subpaths.svg
M
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/w3c-import.log
M
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedEnumeration-SVGTextPathElement-expected.txt
M LayoutTests/platform/mac/TestExpectations
M Source/WebCore/rendering/svg/RenderSVGTextPath.cpp
M Source/WebCore/rendering/svg/RenderSVGTextPath.h
M Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
M Source/WebCore/rendering/svg/SVGTextLayoutEngine.h
M Source/WebCore/svg/SVGTextPathElement.cpp
M Source/WebCore/svg/SVGTextPathElement.h
M Source/WebCore/svg/SVGTextPathElement.idl
M Source/WebCore/svg/svgattrs.in
Log Message:
-----------
[SVG2] Implement the side attribute for SVG <textPath> element
https://bugs.webkit.org/show_bug.cgi?id=311609
rdar://174710714
Reviewed by Said Abou-Hallawa.
SVG2 adds the 'side' attribute to <textPath> with values 'left' (default)
and 'right' [1]. Per the spec, side="right" lays the text out along the
reversed path, which renders it on the opposite side of the curve. WebKit
did not expose the attribute on the DOM or honor it during layout.
Expose 'side' as an SVGAnimatedEnumeration (SVGTextPathSideType, with the
TEXTPATH_SIDETYPE_LEFT/RIGHT constants), mirroring the existing 'method'
and 'spacing' enumerations, with 'left' as the lacuna value and invalid
values reset to the initial value 'left' via the shared parseBaseVal
helper (matching method/spacing). The SVG WG resolved to add the side
constants to the SVGTextPathElement IDL [3].
For rendering, walking the reversed path at arc length t is equivalent to
sampling the forward path at (pathLength - t) and rotating each glyph by
180 degrees, so no path-reversal primitive is needed (WebCore::Path has
none). SVGTextLayoutEngine carries a reversed flag set from the textPath
renderer and applies the mirrored sampling and angle flip in the path
layout loop; the existing baseline/orientation math composes correctly
because it operates on the reversed tangent angle.
[1]
https://w3c.github.io/svgwg/svg2-draft/single-page.html#text-TextPathAttributes
[2] https://github.com/w3c/svgwg/issues/1086
[3] https://www.w3.org/2026/04/23-svg-minutes.html
* Source/WebCore/rendering/svg/RenderSVGTextPath.cpp:
(WebCore::RenderSVGTextPath::isLayoutPathReversed const): Added; true when
side="right".
* Source/WebCore/rendering/svg/RenderSVGTextPath.h:
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::beginTextPathLayout): Set m_textPathReversed.
(WebCore::SVGTextLayoutEngine::endTextPathLayout): Reset it.
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath): Sample the mirrored
arc length and flip the glyph angle by 180 degrees when reversed.
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.h: Add m_textPathReversed.
* Source/WebCore/svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::SVGTextPathElement): Register the side
property.
(WebCore::SVGTextPathElement::attributeChanged): Parse the side attribute.
* Source/WebCore/svg/SVGTextPathElement.h:
(WebCore::SVGPropertyTraits<SVGTextPathSideType>::highestEnumValue):
(WebCore::SVGPropertyTraits<SVGTextPathSideType>::toString):
(WebCore::SVGPropertyTraits<SVGTextPathSideType>::fromString):
Add SVGTextPathSideType, its SVGPropertyTraits, the W3C-named constants,
the side() accessor and the m_side animated property.
* Source/WebCore/svg/SVGTextPathElement.idl: Add the side attribute and
TEXTPATH_SIDETYPE_* constants.
* Source/WebCore/svg/svgattrs.in: Add the 'side' attribute.
* LayoutTests/TestExpectations: Unskip now progression tests
* LayoutTests/platform/mac/TestExpectations: Mark textpath-side-001.svg as
flaky (blank snapshot on macOS, same symptom as webkit.org/b/278868).
*
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedEnumeration-SVGTextPathElement-expected.txt:
Progression
> Thanks Karl to increase coverage and for below new tests:
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-startoffset.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-startoffset-expected.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-startoffset-ref.svg:
Added.
Verify that with side="right" startOffset is measured from the end of the
original path.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-subpaths.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-subpaths-expected.svg:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-side-right-subpaths-ref.svg:
Added.
Verify that side="right" reverses both the order and the direction of subpaths.
* LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/w3c-import.log:
Canonical link: https://commits.webkit.org/323115@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications