WebKit Bugzilla
Attachment 372374 Details for
Bug 198922
: REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198922-20190618132944.patch (text/plain), 8.86 KB, created by
Daniel Bates
on 2019-06-18 13:29:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-06-18 13:29:44 PDT
Size:
8.86 KB
patch
obsolete
>Subversion Revision: 246325 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d5b27b44b27797f28ef29ac02303377b6030dc41..4a486fad1b7ec6ae9cdde96d33c11fb125f49717 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,29 @@ >+2019-06-18 Daniel Bates <dabates@apple.com> >+ >+ REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus >+ https://bugs.webkit.org/show_bug.cgi?id=198922 >+ <rdar://problem/50300056> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Actually dismiss the keyboard as intended in r240757. Do not wait for the round-trip >+ to the WebProcess to run through the -elementDidBlur steps in the UIProcess and hide >+ the keyboard when a person explicitly dismisses the keyboard via the Done button (iPhone) >+ or hide keyboard button (iPad). >+ >+ Note that r240757 revealed another bug in this code, <https://bugs.webkit.org/show_bug.cgi?id=198928>. >+ I am unclear of the implications of that bug, but it is clear for this bug that it >+ never makes sense to round-trip to the WebProcess when the keyboard is dismissed by >+ a user gesture. >+ >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): Invoke -_elementDidBlur >+ to blur the element in the UIProcess and hide the keyboard. >+ (-[WKContentView _elementDidBlur]): Prevent duplicate invocations of -didEndFormControlInteraction >+ and setIsShowingInputViewForFocusedElement messages by only doing these actions when >+ editablity changes. This covers the case where -_elementDidBlur may be invoked a second >+ time (the reply in the round-trip). In that case we don't need to do these actions. >+ > 2019-06-17 Daniel Bates <dabates@apple.com> > > [iOS] Pressing key while holding Command should not insert character >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index e0800608d96f01476b240e90d7c7009357c39273..1d68a030d5b7bc386c65e161373ee67fff45e97b 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -1223,8 +1223,10 @@ - (void)endEditingAndUpdateFocusAppearanceWithReason:(EndEditingReason)reason > if (!_webView._retainingActiveFocusedState) { > // We need to complete the editing operation before we blur the element. > [self _endEditing]; >- if ((reason == EndEditingReasonAccessoryDone && !currentUserInterfaceIdiomIsPad()) || _keyboardDidRequestDismissal) >+ if ((reason == EndEditingReasonAccessoryDone && !currentUserInterfaceIdiomIsPad()) || _keyboardDidRequestDismissal) { > _page->blurFocusedElement(); >+ [self _elementDidBlur]; >+ } > } > > [self _cancelInteraction]; >@@ -5269,12 +5271,13 @@ - (void)_elementDidBlur > [self removeFocusedFormControlOverlay]; > #endif > >- // The custom fixed position rect behavior is affected by -isFocusingElement, so if that changes we need to recompute rects. >- if (editableChanged) >+ if (editableChanged) { >+ // The custom fixed position rect behavior is affected by -isFocusingElement, so if that changes we need to recompute rects. > [_webView _scheduleVisibleContentRectUpdate]; > >- [_webView didEndFormControlInteraction]; >- _page->setIsShowingInputViewForFocusedElement(false); >+ [_webView didEndFormControlInteraction]; >+ _page->setIsShowingInputViewForFocusedElement(false); >+ } > > if (!_isChangingFocus) > _didAccessoryTabInitiateFocus = NO; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2c663e2815d8b77b45b6753e3c43390968caff99..d634ed99197f3a53d7238f3be179456be54e7fe5 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-18 Daniel Bates <dabates@apple.com> >+ >+ REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus >+ https://bugs.webkit.org/show_bug.cgi?id=198922 >+ <rdar://problem/50300056> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field-expected.txt: Added. >+ * fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field.html: Added. >+ * resources/ui-helper.js: >+ (window.UIHelper.dismissFormAccessoryView.return.new.Promise): >+ (window.UIHelper.dismissFormAccessoryView): >+ > 2019-06-17 Daniel Bates <dabates@apple.com> > > [iOS] Pressing key while holding Command should not insert character >diff --git a/LayoutTests/fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field-expected.txt b/LayoutTests/fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..906fc2538b441a9b260bae61628f8f96c0e293f9 >--- /dev/null >+++ b/LayoutTests/fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field-expected.txt >@@ -0,0 +1,13 @@ >+This test focuses the text field in the iframe, taps outside the iframe and then presses the Done button. The keyboard should hide. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+dispatched blur to main frame >+dispatched focus to <input> >+dispatched focus to main frame >+PASS dismissed form accessory >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field.html b/LayoutTests/fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9d5d90aec96fb6bdb907673bd081d65bfcf6ec8b >--- /dev/null >+++ b/LayoutTests/fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field.html >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta name="viewport" content="width=device-width"> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+</head> >+<body> >+<iframe id="frame" srcdoc="<style>body { margin: 0; padding: 0 }</style><input placeholder='Tap here'><script>window.parent.runTest()</script>"></iframe> >+<script> >+window.jsTestIsAsync = true; >+ >+description("This test focuses the text field in the iframe, taps outside the iframe and then presses the Done button. The keyboard should hide.") >+ >+async function runTest() >+{ >+ let frame = document.getElementById("frame"); >+ let inputElementInFrame = frame.contentDocument.querySelector("input"); >+ >+ // 1. Add listeners >+ window.addEventListener("focus", () => debug("dispatched focus to main frame"), { once: true }); >+ window.addEventListener("blur", () => debug("dispatched blur to main frame"), { once: true }); >+ inputElementInFrame.addEventListener("focus", () => debug("dispatched focus to <input>"), { once: true }); >+ inputElementInFrame.addEventListener("blur", () => debug("dispatched blur to <input>"), { once: true }); >+ >+ if (!window.testRunner) >+ return; >+ >+ // 2. Focus the <input> in the <iframe>. >+ let x = frame.offsetLeft + inputElementInFrame.offsetLeft + Math.floor(inputElementInFrame.offsetWidth / 2); >+ let y = frame.offsetTop + inputElementInFrame.offsetTop + Math.floor(inputElementInFrame.offsetHeight / 2); >+ await UIHelper.activateAndWaitForInputSessionAt(x, y); >+ >+ // 3. Tap somewhere in the main frame, then press the Done button. >+ await UIHelper.activateAt(0, 0); >+ await UIHelper.dismissFormAccessoryView(); // Press the Done button; ends the input session. >+ await UIHelper.waitForKeyboardToHide(); >+ >+ testPassed("dismissed form accessory"); >+ document.body.removeChild(document.getElementById("frame")); >+ finishJSTest(); >+} >+</script> >+</body> >+</html> >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 6aa67550eb1f22b13688e13bd48f2869b94e4215..5226b870dbdebfd7e3cabe2072cf96c746393298 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -351,6 +351,20 @@ window.UIHelper = class UIHelper { > }); > } > >+ static dismissFormAccessoryView() >+ { >+ if (!this.isWebKit2() || !this.isIOSFamily()) >+ return Promise.resolve(); >+ >+ return new Promise(resolve => { >+ testRunner.runUIScript(` >+ (function() { >+ uiController.dismissFormAccessoryView(); >+ uiController.uiScriptComplete(); >+ })()`, resolve); >+ }); >+ } >+ > static isShowingKeyboard() > { > return new Promise(resolve => {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198922
:
372253
|
372262
|
372268
|
372374
|
372386