Changeset 261812 in webkit
- Timestamp:
- May 18, 2020 8:23:09 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r261809 r261812 1 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Unexpected capitalization of next word after repositioning caret 4 https://bugs.webkit.org/show_bug.cgi?id=211969 5 <rdar://problem/62605526> 6 7 Reviewed by Alex Christensen. 8 9 Add a new layout test to verify that the keyboard does not automatically shift (i.e. autocapitalize) when 10 changing selection quickly inside a text field. 11 12 * editing/selection/ios/changing-selection-does-not-trigger-autocapitalization-expected.txt: Added. 13 * editing/selection/ios/changing-selection-does-not-trigger-autocapitalization.html: Added. 14 * resources/ui-helper.js: 15 (window.UIHelper.keyboardIsAutomaticallyShifted): 16 1 17 2020-05-18 Diego Pino Garcia <dpino@igalia.com> 2 18 -
trunk/LayoutTests/resources/ui-helper.js
r261056 r261812 306 306 return new Promise((resolve) => { 307 307 testRunner.runUIScript(`uiController.toggleCapsLock(() => uiController.uiScriptComplete());`, resolve); 308 }); 309 } 310 311 static keyboardIsAutomaticallyShifted() 312 { 313 return new Promise(resolve => { 314 testRunner.runUIScript(`uiController.keyboardIsAutomaticallyShifted`, result => resolve(result === "true")); 308 315 }); 309 316 } -
trunk/Source/WebKit/ChangeLog
r261811 r261812 1 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Unexpected capitalization of next word after repositioning caret 4 https://bugs.webkit.org/show_bug.cgi?id=211969 5 <rdar://problem/62605526> 6 7 Reviewed by Alex Christensen. 8 9 The changes in r242551 refactored synchronous autocorrection context request logic such that it uses 10 `waitForAndDispatchImmediately` instead of `sendSync`, in order to make it interruptible by unbounded sync IPC 11 sent from the web process. If the UI process receives sync IPC, it will immediately cancel the autocorrection 12 context request (returning an empty context), before proceeding to handle the incoming sync IPC. 13 14 In a more recent version of iOS, other changes around spellchecking have caused the synchronous message 15 `WebPageProxy::checkTextOfParagraph` to be sent from the web process in such a way that it now frequently 16 coincides with the synchronous autocorrection context request being sent from the UI process. The result is that 17 we now frequently end up cancelling autocorrection requests early by responding with empty contexts. This 18 manifests in the keyboard sometimes losing information about its autocapitalization context and believing that 19 it is in an empty text field, which reverts to default autocorrection suggestions and autocapitalizes the 20 software keyboard. 21 22 To fix this, instead of using the `InterruptWaitingIfSyncMessageArrives` option when waiting for the IPC 23 response, add and use a new flag that allows us to process an incoming sync IPC message if we're waiting for 24 the sync message response. We use this new IPC flag when waiting synchronously for HandleAutocorrectionContext. 25 26 Test: editing/selection/ios/changing-selection-does-not-trigger-autocapitalization.html 27 28 * Platform/IPC/Connection.cpp: 29 (IPC::Connection::processIncomingMessage): 30 31 If the new IPC flag is set and the incoming message is synchronous, allow it to immediately dispatch the sync 32 message by enqueueing it and then waking up `m_waitForMessageCondition` so that it can process the message. 33 34 * Platform/IPC/Connection.h: 35 * Platform/spi/ios/UIKitSPI.h: 36 * UIProcess/ios/WKContentViewInteraction.mm: 37 (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): 38 39 Use `DispatchIncomingSyncMessagesWhileWaiting` instead of `InterruptWaitingIfSyncMessageArrives`. 40 1 41 2020-05-18 Lauro Moura <lmoura@igalia.com> 2 42 -
trunk/Source/WebKit/Platform/IPC/Connection.cpp
r261254 r261812 755 755 } 756 756 757 if (m_waitingForMessage->waitForOptions.contains(WaitForOption::DispatchIncomingSyncMessagesWhileWaiting) && message->isSyncMessage() && SyncMessageState::singleton().processIncomingMessage(*this, message)) { 758 m_waitForMessageCondition.notifyOne(); 759 return; 760 } 761 757 762 if (m_waitingForMessage->waitForOptions.contains(WaitForOption::InterruptWaitingIfSyncMessageArrives) && message->isSyncMessage()) { 758 763 m_waitingForMessage->messageWaitingInterrupted = true; -
trunk/Source/WebKit/Platform/IPC/Connection.h
r261254 r261812 75 75 // Use this to make waitForMessage be interrupted immediately by any incoming sync messages. 76 76 InterruptWaitingIfSyncMessageArrives = 1 << 0, 77 DispatchIncomingSyncMessagesWhileWaiting = 1 << 1, 77 78 }; 78 79 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r261658 r261812 322 322 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags withInputManagerHint:(NSString *)hint; 323 323 - (BOOL)autocorrectSpellingEnabled; 324 - (BOOL)isAutoShifted; 324 325 - (void)deleteFromInput; 325 326 - (void)deleteFromInputWithFlags:(NSUInteger)flags; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r261776 r261812 4239 4239 4240 4240 if (useSyncRequest) { 4241 _page->process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::HandleAutocorrectionContext>(_page->webPageID(), 1_s, IPC::WaitForOption:: InterruptWaitingIfSyncMessageArrives);4241 _page->process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::HandleAutocorrectionContext>(_page->webPageID(), 1_s, IPC::WaitForOption::DispatchIncomingSyncMessagesWhileWaiting); 4242 4242 [self _cancelPendingAutocorrectionContextHandler]; 4243 4243 } -
trunk/Tools/ChangeLog
r261800 r261812 1 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Unexpected capitalization of next word after repositioning caret 4 https://bugs.webkit.org/show_bug.cgi?id=211969 5 <rdar://problem/62605526> 6 7 Reviewed by Alex Christensen. 8 9 Add a new UIScriptController hook to query whether or not the software keyboard is in shifted state. 10 11 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 12 * TestRunnerShared/UIScriptContext/UIScriptController.h: 13 (WTR::UIScriptController::keyboardIsAutomaticallyShifted const): 14 * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: 15 16 Adjust a couple of API tests that copy and paste back-to-back, so that they wait for the copy to finish before 17 attempting to paste. 18 19 * WebKitTestRunner/ios/UIScriptControllerIOS.h: 20 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 21 (WTR::UIScriptControllerIOS::keyboardIsAutomaticallyShifted const): 22 1 23 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> 2 24 -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r260402 r261812 80 80 void toggleCapsLock(object callback); 81 81 void setContinuousSpellCheckingEnabled(boolean enabled); 82 83 readonly attribute boolean keyboardIsAutomaticallyShifted; 82 84 83 85 void rawKeyDown(DOMString key); -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r260402 r261812 164 164 virtual void toggleCapsLock(JSValueRef callback) { notImplemented(); } 165 165 virtual void setContinuousSpellCheckingEnabled(bool) { notImplemented(); } 166 virtual bool keyboardIsAutomaticallyShifted() const 167 { 168 notImplemented(); 169 return false; 170 } 166 171 167 172 virtual void rawKeyDown(JSStringRef) { notImplemented(); } -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm
r261638 r261812 1155 1155 } 1156 1156 [webView selectAll:nil]; 1157 [webView _ executeEditCommand:@"Copy" argument:nil completion:nil];1157 [webView _synchronouslyExecuteEditCommand:@"Copy" argument:nil]; 1158 1158 [webView evaluateJavaScript:@"getSelection().collapseToEnd()" completionHandler:nil]; 1159 1159 { … … 1197 1197 } 1198 1198 [webView selectAll:nil]; 1199 [webView _ executeEditCommand:@"Copy" argument:nil completion:nil];1199 [webView _synchronouslyExecuteEditCommand:@"Copy" argument:nil]; 1200 1200 [webView evaluateJavaScript:@"getSelection().collapseToEnd()" completionHandler:nil]; 1201 1201 { -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
r260402 r261812 137 137 void setKeyboardInputModeIdentifier(JSStringRef) override; 138 138 void toggleCapsLock(JSValueRef) override; 139 bool keyboardIsAutomaticallyShifted() const override; 139 140 JSObjectRef attachmentInfo(JSStringRef) override; 140 141 UIView *platformContentView() const override; -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r261658 r261812 1206 1206 } 1207 1207 1208 bool UIScriptControllerIOS::keyboardIsAutomaticallyShifted() const 1209 { 1210 return UIKeyboardImpl.activeInstance.isAutoShifted; 1211 } 1212 1208 1213 JSObjectRef UIScriptControllerIOS::attachmentInfo(JSStringRef jsAttachmentIdentifier) 1209 1214 {
Note: See TracChangeset
for help on using the changeset viewer.