Changeset 246570 in webkit


Ignore:
Timestamp:
Jun 18, 2019 2:50:20 PM (5 years ago)
Author:
dbates@webkit.org
Message:

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 Wenson Hsieh.

Source/WebKit:

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.

LayoutTests:

Add a test to ensure that pressing Done hides the keyboard after tapping outside the focused
element's frame.

  • 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): Added.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246567 r246570  
     12019-06-18  Daniel Bates  <dabates@apple.com>
     2
     3        REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus
     4        https://bugs.webkit.org/show_bug.cgi?id=198922
     5        <rdar://problem/50300056>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Add a test to ensure that pressing Done hides the keyboard after tapping outside the focused
     10        element's frame.
     11
     12        * fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field-expected.txt: Added.
     13        * fast/events/ios/should-be-able-to-dismiss-form-accessory-after-tapping-outside-iframe-with-focused-field.html: Added.
     14        * resources/ui-helper.js:
     15        (window.UIHelper.dismissFormAccessoryView): Added.
     16
    1172019-06-18  Alexey Shvayka  <shvaikalesh@gmail.com>
    218
  • trunk/LayoutTests/resources/ui-helper.js

    r246004 r246570  
    352352    }
    353353
     354    static dismissFormAccessoryView()
     355    {
     356        if (!this.isWebKit2() || !this.isIOSFamily())
     357            return Promise.resolve();
     358
     359        return new Promise(resolve => {
     360            testRunner.runUIScript(`
     361                (function() {
     362                    uiController.dismissFormAccessoryView();
     363                    uiController.uiScriptComplete();
     364                })()`, resolve);
     365        });
     366    }
     367
    354368    static isShowingKeyboard()
    355369    {
  • trunk/Source/WebKit/ChangeLog

    r246569 r246570  
     12019-06-18  Daniel Bates  <dabates@apple.com>
     2
     3        REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus
     4        https://bugs.webkit.org/show_bug.cgi?id=198922
     5        <rdar://problem/50300056>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Actually dismiss the keyboard as intended in r240757. Do not wait for the round-trip
     10        to the WebProcess to run through the -elementDidBlur steps in the UIProcess and hide
     11        the keyboard when a person explicitly dismisses the keyboard via the Done button (iPhone)
     12        or hide keyboard button (iPad).
     13
     14        Note that r240757 revealed another bug in this code, <https://bugs.webkit.org/show_bug.cgi?id=198928>.
     15        I am unclear of the implications of that bug, but it is clear for this bug that it
     16        never makes sense to round-trip to the WebProcess when the keyboard is dismissed by
     17        a user gesture.
     18
     19        * UIProcess/ios/WKContentViewInteraction.mm:
     20        (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): Invoke -_elementDidBlur
     21        to blur the element in the UIProcess and hide the keyboard.
     22        (-[WKContentView _elementDidBlur]): Prevent duplicate invocations of -didEndFormControlInteraction
     23        and setIsShowingInputViewForFocusedElement messages by only doing these actions when
     24        editablity changes. This covers the case where -_elementDidBlur may be invoked a second
     25        time (the reply in the round-trip). In that case we don't need to do these actions.
     26
    1272019-06-18  Alex Christensen  <achristensen@webkit.org>
    228
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r246564 r246570  
    12271227        // We need to complete the editing operation before we blur the element.
    12281228        [self _endEditing];
    1229         if ((reason == EndEditingReasonAccessoryDone && !currentUserInterfaceIdiomIsPad()) || _keyboardDidRequestDismissal)
     1229        if ((reason == EndEditingReasonAccessoryDone && !currentUserInterfaceIdiomIsPad()) || _keyboardDidRequestDismissal) {
    12301230            _page->blurFocusedElement();
     1231            // Don't wait for WebPageProxy::blurFocusedElement() to round-trip back to us to hide the keyboard
     1232            // because we know that the user explicitly requested us to do so.
     1233            [self _elementDidBlur];
     1234        }
    12311235    }
    12321236
     
    52835287#endif
    52845288
    5285     // The custom fixed position rect behavior is affected by -isFocusingElement, so if that changes we need to recompute rects.
    5286     if (editableChanged)
     5289    if (editableChanged) {
     5290        // The custom fixed position rect behavior is affected by -isFocusingElement, so if that changes we need to recompute rects.
    52875291        [_webView _scheduleVisibleContentRectUpdate];
    52885292
    5289     [_webView didEndFormControlInteraction];
    5290     _page->setIsShowingInputViewForFocusedElement(false);
     5293        [_webView didEndFormControlInteraction];
     5294        _page->setIsShowingInputViewForFocusedElement(false);
     5295    }
    52915296
    52925297    if (!_isChangingFocus)
Note: See TracChangeset for help on using the changeset viewer.