A focused node should not be assisted when handling touch events synchronously
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 21:48:50 +0000 (21:48 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 21:48:50 +0000 (21:48 +0000)
commit872d8621e6dd8e1929af1a2e981285e36680317c
treedaad8fec1e70cd978fe857ff54788a75cc2c8cfa
parentc130128bf0c29d8f29a50153cdff24ba9c19d1f2
A focused node should not be assisted when handling touch events synchronously
https://bugs.webkit.org/show_bug.cgi?id=147836
.:

Reviewed by Enrica Casucci.

Added manual tests for keyboard assistance behavior due to receiving touch events on iOS.

* ManualTests/ios/focused-input-should-assist-on-touch.html: Checks that a currently focused
        input can still be assisted due to a touch event.
* ManualTests/ios/keyboard-should-not-show-on-touch-event.html: Checks that handling a touch
        event does not automatically cause us to assist the currently focused node.

Source/WebCore:

<rdar://problem/22204108>

Reviewed by Enrica Casucci.

Makes interaction with touch handlers no longer assist the currently focused element in the
general case. Added plumbing to reassist a currently focused node when dispatching touch events,
so that an input that programmatically focuses itself and prevents default on a touch event will
be properly assisted when it has been programmatically focused (either through Javascript or the
autofocus attribute) prior to receiving the touch event. This patch also removes the now
unnecessary special-casing of the Gmail settings app that currently makes the keyboard deploy
upon autofocus.

* dom/Element.cpp:
(WebCore::Element::focus): Notifies the chrome client that the element has refocused before
    returning early.
* page/ChromeClient.h: Refocusing an element does nothing by default.
* platform/RuntimeApplicationChecksIOS.h: Removed special casing for Gmail Add Account.
* platform/RuntimeApplicationChecksIOS.mm: See above.
(WebCore::applicationIsGmailAddAccountOnIOS): See above.

Source/WebKit2:

<rdar://problem/22204108>

Reviewed by Enrica Casucci.

Makes interaction with touch handlers no longer assist the currently focused element in the
general case. Added plumbing to reassist a currently focused node when dispatching touch events,
so that an input that programmatically focuses itself and prevents default on a touch event will
be properly assisted when it has been programmatically focused (either through Javascript or the
autofocus attribute) prior to receiving the touch event. This patch also removes the now
unnecessary special-casing of the Gmail settings app that currently makes the keyboard deploy
upon autofocus.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): Removed
    special case to avoid the early return for Gmail Add Account.
* WebProcess/WebCoreSupport/WebChromeClient.h: Added a handler for refocusing an element.
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::elementDidRefocus): Makes refocusing an element trigger input
    assistance on iOS.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::dispatchTouchEvent): Removes logic to focus the currently focused element upon
    receiving a touch event.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188405 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
ChangeLog
ManualTests/ios/focused-input-should-assist-on-touch.html [new file with mode: 0644]
ManualTests/ios/keyboard-should-not-show-on-touch-event.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/page/ChromeClient.h
Source/WebCore/platform/RuntimeApplicationChecksIOS.h
Source/WebCore/platform/RuntimeApplicationChecksIOS.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp