Changeset 188405 in webkit


Ignore:
Timestamp:
Aug 13, 2015 2:48:50 PM (9 years ago)
Author:
Wenson Hsieh
Message:

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.

Location:
trunk
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r188342 r188405  
     12015-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        A focused node should not be assisted when handling touch events synchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=147836
     5
     6        Reviewed by Enrica Casucci.
     7
     8        Added manual tests for keyboard assistance behavior due to receiving touch events on iOS.
     9
     10        * ManualTests/ios/focused-input-should-assist-on-touch.html: Checks that a currently focused
     11                input can still be assisted due to a touch event.
     12        * ManualTests/ios/keyboard-should-not-show-on-touch-event.html: Checks that handling a touch
     13                event does not automatically cause us to assist the currently focused node.
     14
    1152015-08-12  Alex Christensen  <achristensen@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r188402 r188405  
     12015-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        A focused node should not be assisted when handling touch events synchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=147836
     5        <rdar://problem/22204108>
     6
     7        Reviewed by Enrica Casucci.
     8
     9        Makes interaction with touch handlers no longer assist the currently focused element in the
     10        general case. Added plumbing to reassist a currently focused node when dispatching touch events,
     11        so that an input that programmatically focuses itself and prevents default on a touch event will
     12        be properly assisted when it has been programmatically focused (either through Javascript or the
     13        autofocus attribute) prior to receiving the touch event. This patch also removes the now
     14        unnecessary special-casing of the Gmail settings app that currently makes the keyboard deploy
     15        upon autofocus.
     16
     17        * dom/Element.cpp:
     18        (WebCore::Element::focus): Notifies the chrome client that the element has refocused before
     19            returning early.
     20        * page/ChromeClient.h: Refocusing an element does nothing by default.
     21        * platform/RuntimeApplicationChecksIOS.h: Removed special casing for Gmail Add Account.
     22        * platform/RuntimeApplicationChecksIOS.mm: See above.
     23        (WebCore::applicationIsGmailAddAccountOnIOS): See above.
     24
    1252015-08-13  Brent Fulgham  <bfulgham@apple.com>
    226
  • trunk/Source/WebCore/dom/Element.cpp

    r186398 r188405  
    21182118        return;
    21192119
    2120     if (document().focusedElement() == this)
    2121         return;
     2120    if (document().focusedElement() == this) {
     2121        if (document().page())
     2122            document().page()->chrome().client().elementDidRefocus(this);
     2123
     2124        return;
     2125    }
    21222126
    21232127    // If the stylesheets have already been loaded we can reliably check isFocusable.
  • trunk/Source/WebCore/page/ChromeClient.h

    r188121 r188405  
    282282    virtual void elementDidFocus(const Node*) { };
    283283    virtual void elementDidBlur(const Node*) { };
     284    virtual void elementDidRefocus(const Node*) { };
    284285   
    285286    virtual bool shouldPaintEntireContents() const { return false; }
  • trunk/Source/WebCore/platform/RuntimeApplicationChecksIOS.h

    r188162 r188405  
    4444bool applicationIsWebProcess();
    4545bool applicationIsIBooksOnIOS();
    46 WEBCORE_EXPORT bool applicationIsGmailAddAccountOnIOS();
    4746
    4847} // namespace WebCore
  • trunk/Source/WebCore/platform/RuntimeApplicationChecksIOS.mm

    r188162 r188405  
    123123}
    124124
    125 bool applicationIsGmailAddAccountOnIOS()
    126 {
    127     static const bool isGmailAddAccountOnIOS = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.social.SLGoogleAuth.SLGoogleAuthService"];
    128     return isGmailAddAccountOnIOS;
    129 }
    130 
    131125} // namespace WebCore
    132126
  • trunk/Source/WebKit2/ChangeLog

    r188404 r188405  
     12015-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        A focused node should not be assisted when handling touch events synchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=147836
     5        <rdar://problem/22204108>
     6
     7        Reviewed by Enrica Casucci.
     8
     9        Makes interaction with touch handlers no longer assist the currently focused element in the
     10        general case. Added plumbing to reassist a currently focused node when dispatching touch events,
     11        so that an input that programmatically focuses itself and prevents default on a touch event will
     12        be properly assisted when it has been programmatically focused (either through Javascript or the
     13        autofocus attribute) prior to receiving the touch event. This patch also removes the now
     14        unnecessary special-casing of the Gmail settings app that currently makes the keyboard deploy
     15        upon autofocus.
     16
     17        * UIProcess/ios/WKContentViewInteraction.mm:
     18        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): Removed
     19            special case to avoid the early return for Gmail Add Account.
     20        * WebProcess/WebCoreSupport/WebChromeClient.h: Added a handler for refocusing an element.
     21        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
     22        (WebKit::WebChromeClient::elementDidRefocus): Makes refocusing an element trigger input
     23            assistance on iOS.
     24        * WebProcess/WebPage/WebPage.cpp:
     25        (WebKit::WebPage::dispatchTouchEvent): Removes logic to focus the currently focused element upon
     26            receiving a touch event.
     27
    1282015-08-13  Anders Carlsson  <andersca@apple.com>
    229
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r188349 r188405  
    30133013    // FIXME: This is a temporary workaround for <rdar://problem/22126518>. The real fix will involve refactoring
    30143014    // the way we assist programmatically focused nodes.
    3015     if (!applicationIsGmailAddAccountOnIOS() && !userIsInteracting && !_textSelectionAssistant)
     3015    if (!userIsInteracting && !_textSelectionAssistant)
    30163016        return;
    30173017
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r188121 r188405  
    244244    virtual void elementDidFocus(const WebCore::Node*) override;
    245245    virtual void elementDidBlur(const WebCore::Node*) override;
     246    virtual void elementDidRefocus(const WebCore::Node*) override;
    246247#endif
    247248
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm

    r185013 r188405  
    5353{
    5454    m_page->elementDidBlur(const_cast<WebCore::Node*>(node));
     55}
     56
     57void WebChromeClient::elementDidRefocus(const WebCore::Node* node)
     58{
     59    elementDidFocus(node);
    5560}
    5661
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r188030 r188405  
    21912191void WebPage::dispatchTouchEvent(const WebTouchEvent& touchEvent, bool& handled)
    21922192{
    2193     RefPtr<Frame> oldFocusedFrame = m_page->focusController().focusedFrame();
    2194     RefPtr<Element> oldFocusedElement = oldFocusedFrame ? oldFocusedFrame->document()->focusedElement() : nullptr;
    21952193    m_userIsInteracting = true;
    21962194
     
    21982196    CurrentEvent currentEvent(touchEvent);
    21992197    handled = handleTouchEvent(touchEvent, m_page.get());
    2200 
    2201     RefPtr<Frame> newFocusedFrame = m_page->focusController().focusedFrame();
    2202     RefPtr<Element> newFocusedElement = newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr;
    2203 
    2204     // If the focus has not changed, we need to notify the client anyway, since it might be
    2205     // necessary to start assisting the node.
    2206     // If the node has been focused by JavaScript without user interaction, the
    2207     // keyboard is not on screen.
    2208     if (newFocusedElement && newFocusedElement == oldFocusedElement)
    2209         elementDidFocus(newFocusedElement.get());
    22102198
    22112199    m_userIsInteracting = false;
Note: See TracChangeset for help on using the changeset viewer.