-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consecutive calls to
-insertTextAlternatives:
should not cause dict…
…ation underlines to disappear https://bugs.webkit.org/show_bug.cgi?id=270370 rdar://107087527 Reviewed by Abrar Rahman Protyasha. Add support for preserving dictation underlines when UIKit calls into `-insertTextAlternatives:`, while finalizing dictation results. Currently, UIKit only calls into `-insertText:` with the best alternative for the dictated text, which loses all information about dictation alternatives (along with the blue dotted underlines). While there's public API on `UITextInput` to `-insertDictationResults:` which we _could_ implement, the suggestions will eventually be shown by UIKit when tapping on a dictation alternative range via `-alternativesForSelectedText`, which means that we would need to convert `UIDictationPhrase` objects into `BETextAlternatives` — something that's not possible without introducing new API surface in BrowserEngineKit. Instead, UIKit will be inserting text alternatives in the form of `BETextAlternatives` (or `NSTextAlternatives` in the case where BrowserEngineKit integration is disabled), which we'll honor by adding dictation alternative document markers. Test: TextAlternatives.InsertDictationResultsAsAlternatives * Source/WebCore/editing/Editor.cpp: (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Prevent dictation markers from being removed as a result of inserting plain text, while finalizing dictation results. * Source/WebCore/page/EditorClient.h: (WebCore::EditorClient::shouldRemoveDictationAlternativesAfterEditing const): * Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h: * Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::shouldRemoveDictationAlternativesAfterEditing const): * Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm: * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::shouldRemoveDictationAlternativesAfterEditing const): * Tools/TestWebKitAPI/Tests/ios/TextAlternatives.mm: (TestWebKitAPI::TEST): * Tools/TestWebKitAPI/cocoa/TestWKWebView.h: * Tools/TestWebKitAPI/cocoa/TestWKWebView.mm: Add an API test to exercise this change. (-[WKWebView insertText:alternatives:]): Canonical link: https://commits.webkit.org/275579@main
- Loading branch information
Showing
9 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters