Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 48ca57667b1e698e816ed42c69fc1e8eaaab05c1
      
https://github.com/WebKit/WebKit/commit/48ca57667b1e698e816ed42c69fc1e8eaaab05c1
  Author: Karl Dubost <[email protected]>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-shift-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-shift.html
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-expected.txt
    M Source/WebCore/rendering/svg/SVGTextFragment.h
    M Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
    M Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp
    M Source/WebCore/rendering/svg/SVGTextQuery.cpp

  Log Message:
  -----------
  SVG getStartPositionOfChar/getEndPositionOfChar should not include 
dominant-baseline shift in returned position
https://bugs.webkit.org/show_bug.cgi?id=311553
rdar://174145885

Reviewed by Nikolas Zimmermann.

This fix is a prerequisite for https://webkit.org/b/=297455

getStartPositionOfChar and getEndPositionOfChar were returning positions
that included the visual baseline shift from dominant-baseline. They
should return positions based on the y attribute value instead.

Store the baseline shift in a new SVGTextFragment.baselineShift field
and subtract it in the query APIs only. All other consumers of
fragment.y (painting, hit testing, bounding boxes) are unchanged.

Test: 
imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-shift.html

* 
LayoutTests/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-shift-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-dominant-baseline-shift.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/text/scripted/getstartpositionofchar-expected.txt:
* Source/WebCore/rendering/svg/SVGTextFragment.h:
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
* Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:
(WebCore::SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBaseline 
const):
* Source/WebCore/rendering/svg/SVGTextQuery.cpp:
(WebCore::SVGTextQuery::startPositionOfCharacterCallback const):
(WebCore::SVGTextQuery::endPositionOfCharacterCallback const):

Canonical link: https://commits.webkit.org/311450@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to