Repository navigation
Conversation
Collaborator
|
EWS run on previous version of this PR (hash a5477af) Details
|
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 08:23
a5477af to
cdc8c10
Compare
Collaborator
|
EWS run on previous version of this PR (hash cdc8c10) Details
|
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 09:14
cdc8c10 to
cf76b45
Compare
Collaborator
|
EWS run on previous version of this PR (hash cf76b45) Details
|
Collaborator
macOS Safer C++ Build #140315 (cf76b45)❌ Found 1 failing file with 6 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 12:41
cf76b45 to
9030a53
Compare
Collaborator
|
EWS run on previous version of this PR (hash 9030a53) Details
|
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 12:52
9030a53 to
225aa01
Compare
Collaborator
|
EWS run on previous version of this PR (hash 225aa01) Details
|
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 13:40
225aa01 to
63210d1
Compare
Collaborator
|
EWS run on previous version of this PR (hash 63210d1) Details
|
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 14:42
63210d1 to
e06249c
Compare
Collaborator
|
EWS run on previous version of this PR (hash e06249c) Details
|
https://bugs.webkit.org/show_bug.cgi?id=327817 rdar://problem/190204825 Reviewed by NOBODY (OOPS!). The old SVGTextLayoutEngine is built around assumptions of the legacy line layout. We can do better. This patch adds SVGTextLayoutAlgorithm which implements the text layout algorithm as described by the SVG 2 specification (https://w3c.github.io/svgwg/svg2-draft/text.html#TextLayoutAlgorithm). The code maps directly to spec language making it much more readable than the old code. It is also more correct. Following the spec steps fixes textLength with x/y lists and on text paths, and lengthAdjust="spacingAndGlyphs" and whitespace collapsing now match Chrome and Firefox. It also performs better. The old implementation measured text repeatedly, checked grapheme cluster boundaries for every character and used hash maps for temporary storage. The new one caches the measurements, skips the cluster checks for 8-bit text and uses index-based storage. On a microbenchmark with 10k text labels text changes are about 25% faster. Speedometer Charts-observable-plot improves by about 1% and React-Stockcharts-SVG by about 0.5%. The new path is behind the internal SVG2TextLayoutAlgorithmEnabled flag, off by default for now. * LayoutTests/svg/text/textLength-spacing-absolute-positions-expected.txt: Added. * LayoutTests/svg/text/textLength-spacing-absolute-positions.html: Added. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::setTextInternal): (WebCore::RenderSVGInlineText::styleDidChange): (WebCore::RenderSVGInlineText::updateScaledFont): Invalidate the cached text metrics. * Source/WebCore/rendering/svg/RenderSVGInlineText.h: * Source/WebCore/rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::shouldHandleSubtreeMutations const): (WebCore::RenderSVGText::subtreeTextDidChange): (WebCore::RenderSVGText::layout): Skip the layout attribute building with the new path. (WebCore::RenderSVGText::computePerCharacterLayoutInformation): (WebCore::RenderSVGText::usesSVGTextLayoutAlgorithm const): * Source/WebCore/rendering/svg/RenderSVGText.h: * Source/WebCore/rendering/svg/SVGTextLayoutAlgorithm.cpp: Added. * Source/WebCore/rendering/svg/SVGTextLayoutAlgorithm.h: Added. * Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath): * Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBaseline const): (WebCore::SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift const): Take the style instead of the renderer so layout boxes can use it. * Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h:
anttijk
force-pushed
the
eng/svg-text-layout-algorithm-land
branch
from
October 16, 2026 15:41
e06249c to
9bca990
Compare
Collaborator
|
EWS run on current version of this PR (hash 9bca990) Details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧪 jsc-wpe
9bca990
9bca990