Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ab6b57b42f14fa9e1c0a42cedf4eae86e56ae652
      
https://github.com/WebKit/WebKit/commit/ab6b57b42f14fa9e1c0a42cedf4eae86e56ae652
  Author: Brent Fulgham <[email protected]>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/text/combining-mark-spacing-paint-offset-expected.txt
    A LayoutTests/fast/text/combining-mark-spacing-paint-offset.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-002-expected.html
    A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-002-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-002.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-002-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-002.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/reference/letter-spacing-combining-mark-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/reference/letter-spacing-combining-mark-002-ref.html
    A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/tools/generate-mark-anchor-font.py
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/reference/word-spacing-combining-mark-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/reference/word-spacing-combining-mark-002-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-002-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-002.html
    A LayoutTests/imported/w3c/web-platform-tests/fonts/mark-anchor-test.ttf
    M LayoutTests/platform/glib/TestExpectations
    M
LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/platform/graphics/ComplexTextController.cpp
    M Source/WebCore/platform/graphics/FontCascade.h
    M Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp

  Log Message:
  -----------
  [Cocoa] Keep accents and other combining marks on their base letter when 
spacing is applied
https://bugs.webkit.org/show_bug.cgi?id=322753
rdar://186013305

Reviewed by Vitor Roriz.

Accents, strike-through, and other "combining marks" are drawn as their own 
glyphs,
positioned relative to the letter they attach to. Any CSS feature that widens 
the
attachment target (letter) moves the point the mark is measured from. If that 
movement is
not accounted for when positioning the combining mark, we get incorrect 
painting.

This issue is specific to CoreText, which only guarantees the sum of a 
cluster's base
advances and glyph origins. The spacing adjustments in 
`adjustGlyphsAndAdvances(...)`
modify the cluster's base
advance, the combining marks need to account for that difference
or they paint outside of the intended cluster.

We previously fixed this for `space-width` in Bug 321246, but did not address 
synthetic
bold, letter-spacing, expansion, word-spacing, etc.

This change addresses these remaining features that can interact with advances.

Several new tests were added to cover these scenarios. The word-spacing reftest 
does not
pass and is marked as ImageOnlyFailure until we fix that unrelated code. 
Word-spacing is
applied as a leading margin that offsets the word separator's own run rather 
than as
advance after the separator's glyph, so a mark anchored to a space is displaced 
by the
full word-spacing. That is independent of this change and is tracked in 
webkit.org/b/322760.

The synthetic-bold reftest also fails on GTK and WPE, where Skia synthesizes 
bold by
emboldening the glyph outline rather than by drawing twice at an offset. There 
the mark's
horizontal placement is
correct and the mark's bar has the same ink height as the reference's,
but it paints 0.185px higher, so the cluster does not match. That is a 
sub-pixel difference
in the port's emboldening, not the mark displacement this change is about and 
it is
marked ImageOnlyFailure for glib ports.

New WPT tests and API tests are included to cover this behavior.

Tests: fast/text/combining-mark-spacing-paint-offset.html
       
imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001.html
       
imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-001.html
       
imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-001.html

* LayoutTests/TestExpectations:
* LayoutTests/fast/text/combining-mark-spacing-paint-offset-expected.txt: Added.
* LayoutTests/fast/text/combining-mark-spacing-paint-offset.html: Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-001.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-002-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-002-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-combining-mark-002.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-001.html:
 Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-002-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/letter-spacing-combining-mark-002.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/reference/letter-spacing-combining-mark-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/letter-spacing/reference/letter-spacing-combining-mark-002-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/tools/generate-mark-anchor-font.py:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/reference/word-spacing-combining-mark-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/reference/word-spacing-combining-mark-002-ref.html:
 Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-001.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-002-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-text/word-spacing/word-spacing-combining-mark-002.html:
 Added.
* LayoutTests/imported/w3c/web-platform-tests/fonts/mark-anchor-test.ttf: Added.
* LayoutTests/platform/glib/TestExpectations: Add expectation for the GTK/WPE 
difference.
* LayoutTests/platform/mac/TestExpectations: Add expectation for GoldenGate 
failure.
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::enclosingGlyphBoundsForTextRun):
* Source/WebCore/platform/graphics/FontCascade.h:
*
Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
(TestWebKitAPI::makeMarkOnBaseRun):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
LetterSpacingDoesNotSlideAFollowingMark)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
WordSpacingDoesNotSlideAFollowingMark)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
ExpansionDoesNotSlideAFollowingMark)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
LeftExpansionDoesNotSlideAFollowingMark)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
SyntheticBoldDoesNotSlideAFollowingMark)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
TabWidthDoesNotSlideAFollowingMark)):
(TestWebKitAPI::makeMarkOnBaseRunRTL):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
LetterSpacingDoesNotSlideAMarkInRTL)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
WordSpacingDoesNotSlideAMarkInRTL)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest,
TabWidthDoesNotSlideAMarkInRTL)):
(TestWebKitAPI::TEST_F(ComplexTextControllerTest, 
SyntheticBoldDoesNotSlideAMarkInRTL)):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DI8s0h8JW2&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIwOTU3QG1haW4=&emid=eb488642-0598-4d6a-bbeb-e84a9f77db43&c=11



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

Reply via email to