[webkit-changes] [WebKit/WebKit] 6566fb: [Fast text codepath] CharactersTreatedAsSpace is o...

Myles C. Maxfield noreply at github.com
Thu Aug 31 21:12:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6566fb8f9216aae136892c5f32e6e50367de2969
      https://github.com/WebKit/WebKit/commit/6566fb8f9216aae136892c5f32e6e50367de2969
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M LayoutTests/platform/ios/tables/layering/paint-test-layering-1-expected.txt
    M LayoutTests/platform/ios/tables/layering/paint-test-layering-2-expected.txt
    M LayoutTests/platform/ios/tables/mozilla/bugs/bug4427-expected.txt
    M LayoutTests/platform/ios/tables/mozilla_expected_failures/other/test4-expected.txt
    M Source/WebCore/platform/graphics/WidthIterator.cpp

  Log Message:
  -----------
  [Fast text codepath] CharactersTreatedAsSpace is overly prescriptive
https://bugs.webkit.org/show_bug.cgi?id=260843
rdar://114607926

Reviewed by Cameron McCormack.

When we lay out web content, we make multiple passes over the text,
chopping it up multiple different ways. Because of this, we have an
invariant that the width of a space can't change depending on the
bounds of how we're chopping up the text. Kerning can affect the
width of a space, so we enforce the invariant by having a postprocess
that we perform after shaping to retroactively go back and adjust
the width of any glyphs associated with space characters, to reset
their widths. This is called "CharactersTreatedAsSpace."

However, CharactersTreatedAsSpace actually does something else, too:
it also adjusts the width of the character directly before the space
to be whatever it was before shaping. However, this is kind of
bogus - it's totally valid for shaping to adjust the width of
whichever character happens to be before the space.

Now that we're trying to make the fast text codepath handle complex
character clusters, we're hitting the case more often where shaping
is adjusting the non-space glyphs to be correct, but then our
postprocess is coming along and messing them up. This patch removes
that logic, just for the glyphs before the space characters. The
logic about trying to reset the space characters' width is still
there.

* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::OriginalAdvancesForCharacterTreatedAsSpace::OriginalAdvancesForCharacterTreatedAsSpace):
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::advanceInternal):

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




More information about the webkit-changes mailing list