Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: ac57d4f365e1de0dfe1e90fed2b22c67e10cdac8 https://github.com/WebKit/WebKit/commit/ac57d4f365e1de0dfe1e90fed2b22c67e10cdac8 Author: Wenson Hsieh <wenson_hs...@apple.com> Date: 2024-04-05 (Fri, 05 Apr 2024)
Changed paths: A LayoutTests/editing/input/ios/autocorrection-replaces-space-with-period-expected.txt A LayoutTests/editing/input/ios/autocorrection-replaces-space-with-period.html M Source/WebCore/editing/TextIterator.cpp Log Message: ----------- REGRESSION (275503@main): Double space in Mail compose on iOS doesn’t insert period https://bugs.webkit.org/show_bug.cgi?id=272237 rdar://125852636 Reviewed by Abrar Protyasha and Ryosuke Niwa. With the changes in 275503@main, we now use `WebCore::findPlainText` to discover the nearby text to replace, in the case where the replacement range isn't just the last word. While `findPlainText` (and the underlying `SearchBuffer` machinery) is intended to ignore non-breaking spaces for the purposes of finding matches, this only works when `UCONFIG_NO_COLLATION` is disabled; otherwise, searching for the target text `" "` against a single non-breaking space `"0xA0"` will fail to find any matches. This subsequently causes autocorrection replacement to fail, in the case where UIKit tries to replace a space after a sentence with a period, when the user inserts two space characters in a row, since we fail to match the non-breaking space character right after the word. To fix this, we align the two find behaviors by moving the `UCONFIG_NO_COLLATION`-specific logic to handle `nbsp`: ``` inline void SearchBuffer::append(UChar c, bool isStart) { … m_buffer[m_cursor] = c == noBreakSpace ? ' ' : foldQuoteMark(c); } ``` ...into `foldQuoteMark`, renaming that helper function to `foldQuoteMarkAndReplaceNoBreakSpace`, and finally deploying `foldQuoteMarkAndReplaceNoBreakSpace` in the `!UCONFIG_NO_COLLATION` codepath as well. Test: editing/input/ios/autocorrection-replaces-space-with-period.html * LayoutTests/editing/input/ios/autocorrection-replaces-space-with-period-expected.txt: Added. * LayoutTests/editing/input/ios/autocorrection-replaces-space-with-period.html: Added. * Source/WebCore/editing/TextIterator.cpp: (WebCore::foldQuoteMarkAndReplaceNoBreakSpace): (WebCore::SearchBuffer::append): (WebCore::foldQuoteMark): Deleted. Canonical link: https://commits.webkit.org/277151@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes