NEW297455
CSS dominant-baseline property should be inherited per SVG2 / CSS Inline 3
https://bugs.webkit.org/show_bug.cgi?id=297455
Summary CSS dominant-baseline property should be inherited per SVG2 / CSS Inline 3
Stephen Thomas
Reported 2025-08-15 07:17:12 PDT
If a <text> element is given a y-position and the dominant baseline is set to middle, the y-attribute value is used to place the bottom of the text rather than its middle. Reproduction: https://codepen.io/sathomas/pen/EaVowqb
Attachments
testcase (4.99 KB, text/html)
2026-04-06 02:32 PDT, Karl Dubost
no flags
Radar WebKit Bug Importer
Comment 1 2025-08-22 07:18:24 PDT
Karl Dubost
Comment 2 2026-04-05 23:44:16 PDT
all the tests in SVG mentioning dominant-baseline are passing. https://wpt.fyi/results/svg?label=master&label=experimental&aligned&q=dominant-baseline But this is working. <text x="50" y="100" dominant-baseline="middle">Hello</text> So the issue is elsewhere. in SVG2 https://w3c.github.io/svgwg/svg2-draft/text.html#DominantBaselineProperty ========== This property is defined in the CSS Line Layout Module 3 specification. See 'dominant-baseline'. [css-inline-3] SVG 2 introduces some changes to the definition of this property. In particular: * The 'reset-size' value is no longer supported. Any change in font-size resets the dominant baseline table. * The 'use-script' and 'no-change' values are no longer supported. * The property is now inherited. (Behavior is effectively unchanged.) SVG uses the value of the dominant-baseline property to align glyphs relative to the ‘x’ and ‘y’ attributes. For the text-orientation value sideways, the auto value for dominant-baseline is alphabetic; however, for backwards compatibility, the glyphs should be aligned to the ‘x’ and ‘y’ attributes using the value central. ==== The issue is that tspan is not inheriting from text. That's the issue, but the spec says it should.
Karl Dubost
Comment 3 2026-04-05 23:46:28 PDT
I also open Bug 311552 remove use-script, no-change, reset-size from dominant-baseline per spec
Karl Dubost
Comment 4 2026-04-06 01:14:04 PDT
Fixing this test, create a regression that needs to be addressed first which has a kind of baseline baked-in for get*PositionOfChar --- /Users/karlcow/code/OpenSource/WebKitBuild/Debug/layout-test-results/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-expected.txt +++ /Users/karlcow/code/OpenSource/WebKitBuild/Debug/layout-test-results/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-actual.txt @@ -1,6 +1,6 @@ Test Test Test Test -PASS textPath: get*PositionOfChar().y should not depend on dominant-baseline -PASS tspan: get*PositionOfChar().y should not depend on dominant-baseline +FAIL textPath: get*PositionOfChar().y should not depend on dominant-baseline assert_equals: expected 95.556640625 but got 80 +FAIL tspan: get*PositionOfChar().y should not depend on dominant-baseline assert_equals: expected 115.556640625 but got 100 I need to fix it first. in Bug 311553
Karl Dubost
Comment 5 2026-04-06 02:26:29 PDT
Karl Dubost
Comment 6 2026-04-06 02:31:27 PDT
This PR needs to be merged first https://github.com/WebKit/WebKit/pull/62106
Karl Dubost
Comment 7 2026-04-06 02:32:11 PDT
Created attachment 478934 [details] testcase The testcase 7 illustrates the issue.
Karl Dubost
Comment 8 2026-04-06 19:21:15 PDT
*** Bug 139258 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.