Previously cleared text reappears when typing in Korean after tapping ⨯ in Google search field#38393
Closed
whsieh wants to merge 1 commit intoWebKit:mainfrom
Conversation
… ⨯ in Google search field https://bugs.webkit.org/show_bug.cgi?id=285175 rdar://131897908 Reviewed by NOBODY (OOPS!). When using Korean keyboards to search on Google (typing in a `textarea` element) on Google on iOS, if you: (1) Type some Korean text (stopping in the middle of a composed word). (2) Tap the ⨯ button, which programmatically clears the text field. (3) Continue typing on Korean. ...text that was previously typed and then cleared during (2) will reappear. This happens because there's no mechanism to invalidate and update the keyboard's text entry context when text content changes programmatically, so the stored input context ends up being reinserted. To fix this, we add a heuristic to respond to programmatic changes in text content that cause the value of focused text form controls to become empty, and `-invalidateTextEntryContextForTextInput:` in the UI process. While we could potentially apply this treatment to *all* programmatic value changes, this poses a more significant web compat and performance risk. * LayoutTests/editing/input/ios/invalidate-text-entry-context-when-clearing-text-area-expected.txt: Added. * LayoutTests/editing/input/ios/invalidate-text-entry-context-when-clearing-text-area.html: Added. Add a layout test to exercise this change, by teaching the test runner to count the number of times `-[_UIKeyboardStateManager updateForChangedSelection]` is invoked and verifying that clearing the text in a `textarea` calls into this method. * LayoutTests/resources/ui-helper.js: (window.UIHelper.async keyboardUpdateForChangedSelectionCount): (window.UIHelper): * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setValue): Call the new client hook below, when the value is set to the empty string from bindings. * Source/WebCore/html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::setValueCommon): * Source/WebCore/page/ChromeClient.h: (WebCore::ChromeClient::didProgrammaticallyClearTextFormControl): Add a client hook to notify `WebPage` when a text form control's text value is cleared. * Source/WebKit/UIProcess/PageClient.h: * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/WebPageProxy.messages.in: * Source/WebKit/UIProcess/ios/PageClientImplIOS.h: * Source/WebKit/UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didProgrammaticallyClearFocusedElement): * Source/WebKit/UIProcess/ios/WKContentViewInteraction.h: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _updateInputContextAfterBlurringAndRefocusingElement]): (-[WKContentView _didProgrammaticallyClearFocusedElement:]): (-[WKContentView _internalInvalidateTextEntryContext]): * Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didProgrammaticallyClearFocusedElement): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::didProgrammaticallyClearTextFormControl): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::contextForElement const): Make this method const, so that we can pass in the form control element below. * Source/WebKit/WebProcess/WebPage/WebPage.h: (WebKit::WebPage::didProgrammaticallyClearTextFormControl): * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didProgrammaticallyClearTextFormControl): Notify the UI process when the focused form control value is cleared. The IPC message is sent on the next runloop, so that we'll still invalidate the text entry context in the case where a focused element is blurred and immediately refocused. * Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * Tools/TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::keyboardUpdateForChangedSelectionCount const): * Tools/WebKitTestRunner/TestController.h: * Tools/WebKitTestRunner/ios/TestControllerIOS.mm: (-[NSObject swizzled_updateForChangedSelection]): (WTR::TestController::platformInitialize): (WTR::TestController::keyboardUpdateForChangedSelectionCount const): * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h: * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptControllerIOS::keyboardUpdateForChangedSelectionCount const): Add test infrastructure to keep track of the number of times `-updateForChangedSelection` is invoked; also expose a new script controller hook to request this count from layout tests.
Collaborator
|
EWS run on current version of this PR (hash e03c81a) Details |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
e03c81a
e03c81a
🧪 ios-wk2🧪 api-mac🧪 ios-wk2-wpt🧪 mac-wk1🧪 api-ios🧪 mac-wk2🧪 mac-wk2-stress🧪 mac-intel-wk2