Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 99e91ca46f457eb937168e7783ac51dab8db5cd8
https://github.com/WebKit/WebKit/commit/99e91ca46f457eb937168e7783ac51dab8db5cd8
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-02 (Fri, 02 Oct 2026)
Changed paths:
A
LayoutTests/fast/text/overflow-wrap-anywhere-punctuation-non-zero-item-start-expected.txt
A
LayoutTests/fast/text/overflow-wrap-anywhere-punctuation-non-zero-item-start.html
M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp
Log Message:
-----------
overflow-wrap: anywhere keeps extra characters with line-start prohibited
punctuation when the text item doesn't start at offset 0
https://bugs.webkit.org/show_bug.cgi?id=325910
rdar://188884467
Reviewed by Alan Baradlay.
firstCharacterBreakRespectingLineStartProhibitions() advanced the break position
with U16_FWD_1 using an item-relative index into the text box content. When the
text item does not start at offset 0, U16_FWD_1 read the wrong code unit. A
surrogate pair at that wrong spot made the break position advance by 2 instead
of 1, so the line kept characters that should have wrapped (e.g. "a,b" instead
of "a,"). It could also break the line in the middle of a surrogate pair.
Fix this by advancing with an absolute position into the content and converting
it back to an item-relative break position.
Test: fast/text/overflow-wrap-anywhere-punctuation-non-zero-item-start.html
*
LayoutTests/fast/text/overflow-wrap-anywhere-punctuation-non-zero-item-start-expected.txt:
Added.
*
LayoutTests/fast/text/overflow-wrap-anywhere-punctuation-non-zero-item-start.html:
Added.
* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::firstCharacterBreakRespectingLineStartProhibitions):
Canonical link: https://commits.webkit.org/322554@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications