Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 494a85cc8e3931ca3faffc009cb57656658bb3af
https://github.com/WebKit/WebKit/commit/494a85cc8e3931ca3faffc009cb57656658bb3af
Author: Wenson Hsieh <[email protected]>
Date: 2026-06-29 (Mon, 29 Jun 2026)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/PlatformCocoa.cmake
M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
M Source/WebKit/Shared/TextExtractionToStringConversion.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
Log Message:
-----------
[Text Extraction] `replacementStrings` should apply case- and
diacritic-insensitively
https://bugs.webkit.org/show_bug.cgi?id=317987
rdar://180636729
Reviewed by Abrar Rahman Protyasha.
Make several small adjustments to how client-specified `replacementStrings`
works:
- Make matching case-insensitive
- Make matching diacritic-insensitive
- Fold quotes when finding replacements
- Apply longer replacements before shorter ones (so that a shorter
replacement string that's
contained in another longer replacement string doesn't cause the longer
replacement string to
not apply).
Tests: TextExtractionTests.ReplacementStringsLongestMatchWins
TextExtractionTests.ReplacementStringsCaseAndQuoteInsensitive
TextExtractionTests.ReplacementStringsDiacriticInsensitive
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
* Source/WebCore/Headers.cmake:
* Source/WebCore/PlatformCocoa.cmake:
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::foldForReplacement):
(WebKit::foldTextForReplacement):
(WebKit::TextExtractionAggregator::applyReplacements):
* Source/WebKit/Shared/TextExtractionToStringConversion.h:
(WebKit::TextExtractionOptions::TextExtractionOptions):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(extractReplacementStrings):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, ReplacementStringsLongestMatchWins)):
(TestWebKitAPI::TEST(TextExtractionTests,
ReplacementStringsCaseAndQuoteInsensitive)):
(TestWebKitAPI::TEST(TextExtractionTests,
ReplacementStringsDiacriticInsensitive)):
Canonical link: https://commits.webkit.org/316028@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications