⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 199040 in webkit


Ignore:
Timestamp:
Apr 4, 2016, 9:22:54 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[iOS] Allow clients in the bundle to know whether a field was focused by user interaction
​https://bugs.webkit.org/show_bug.cgi?id=156118

Patch by Chelsea Pugh <​cpugh@apple.com> on 2016-04-04
Reviewed by Dan Bernstein.

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Add delegate method that takes userIsInteracting bool so that bundle clients get this information.
  • WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: Call API with userIsInteracting property if delegate implements it, otherwise call existing API if

userIsInteracting is true, as we previously did in WebKit::WebPage::elementDidFocus. Move FIXME from WebKit::WebPage::elementDidFocus to here, since we are checking userIsInteracting.

  • WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:

(API::InjectedBundle::FormClient::willBeginInputSession): Add userIsInteracting bool to arguments so we can use it for call to the new API as well as preserving behavior of the old API.

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::elementDidFocus): Remove check if user is interacting and call willBeginInputSession unconditionally. Move FIXME to where we check
userIsInteracting. Pass m_userIsInteracting to willBeginInputSession so we can use it there.

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r199033 r199040  
     12016-04-04  Chelsea Pugh  <cpugh@apple.com>
     2
     3        [iOS] Allow clients in the bundle to know whether a field was focused by user interaction       
     4        https://bugs.webkit.org/show_bug.cgi?id=156118
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Add delegate method that takes userIsInteracting bool so that bundle clients get this information.
     9        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: Call API with userIsInteracting property if delegate implements it, otherwise call existing API if
     10        userIsInteracting is true, as we previously did in WebKit::WebPage::elementDidFocus. Move FIXME from WebKit::WebPage::elementDidFocus to here, since we are checking userIsInteracting.
     11        * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
     12        (API::InjectedBundle::FormClient::willBeginInputSession): Add userIsInteracting bool to arguments so we can use it for call to the new API as well as preserving behavior of the old API.
     13        * WebProcess/WebPage/ios/WebPageIOS.mm:
     14        (WebKit::WebPage::elementDidFocus): Remove check if user is interacting and call willBeginInputSession unconditionally. Move FIXME to where we check
     15        userIsInteracting. Pass m_userIsInteracting to willBeginInputSession so we can use it there.
     16
    1172016-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
    218
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h

    r183038 r199040  
    4545// The return value is exposed in the UI process via the userObject property of the _WKFormInputSession object.
    4646- (NSObject <NSSecureCoding> *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller willBeginInputSessionForElement:(WKWebProcessPlugInNodeHandle *)node inFrame:(WKWebProcessPlugInFrame *)frame;
     47- (NSObject <NSSecureCoding> *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller willBeginInputSessionForElement:(WKWebProcessPlugInNodeHandle *)node inFrame:(WKWebProcessPlugInFrame *)frame userIsInteracting:(BOOL)userIsInteracting WK_AVAILABLE(NA, WK_IOS_TBA);
    4748
    4849- (BOOL)_webProcessPlugInBrowserContextControllerShouldNotifyOnFormChanges:(WKWebProcessPlugInBrowserContextController *)controller;
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm

    r197563 r199040  
    516516        }
    517517
    518         void willBeginInputSession(WebPage*, Element* element, WebFrame* frame, RefPtr<API::Object>& userData) override
    519         {
    520             auto formDelegate = m_controller->_formDelegate.get();
    521 
    522             if (![formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willBeginInputSessionForElement:inFrame:)])
    523                 return;
    524 
    525             NSObject <NSSecureCoding> *userObject = [formDelegate _webProcessPlugInBrowserContextController:m_controller willBeginInputSessionForElement:wrapper(*WebKit::InjectedBundleNodeHandle::getOrCreate(element)) inFrame:wrapper(*frame)];
    526             encodeUserObject(userObject, userData);
     518        void willBeginInputSession(WebPage*, Element* element, WebFrame* frame, RefPtr<API::Object>& userData, bool userIsInteracting) override
     519        {
     520            auto formDelegate = m_controller->_formDelegate.get();
     521
     522            if ([formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willBeginInputSessionForElement:inFrame:userIsInteracting:)]) {
     523                NSObject<NSSecureCoding> *userObject = [formDelegate _webProcessPlugInBrowserContextController:m_controller willBeginInputSessionForElement:wrapper(*WebKit::InjectedBundleNodeHandle::getOrCreate(element)) inFrame:wrapper(*frame) userIsInteracting:userIsInteracting];
     524                encodeUserObject(userObject, userData);
     525            } else if (userIsInteracting && [formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willBeginInputSessionForElement:inFrame:)]) {
     526                // FIXME: We check userIsInteracting so that we don't begin an input session for a
     527                // programmatic focus that doesn't cause the keyboard to appear. But this misses the case of
     528                // a programmatic focus happening while the keyboard is already shown. Once we have a way to
     529                // know the keyboard state in the Web Process, we should refine the condition.
     530                NSObject<NSSecureCoding> *userObject = [formDelegate _webProcessPlugInBrowserContextController:m_controller willBeginInputSessionForElement:wrapper(*WebKit::InjectedBundleNodeHandle::getOrCreate(element)) inFrame:wrapper(*frame)];
     531                encodeUserObject(userObject, userData);
     532            }
    527533        }
    528534
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/APIInjectedBundleFormClient.h

    r167360 r199040  
    7373    virtual void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>&) { }
    7474    virtual bool shouldNotifyOnFormChanges(WebKit::WebPage*) { return false; }
    75     virtual void willBeginInputSession(WebKit::WebPage*, WebCore::Element*, WebKit::WebFrame*, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
     75    virtual void willBeginInputSession(WebKit::WebPage*, WebCore::Element*, WebKit::WebFrame*, RefPtr<API::Object>& userData, bool userIsInteracting) { UNUSED_PARAM(userData); }
    7676};
    7777
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r198929 r199040  
    25492549        RefPtr<API::Object> userData;
    25502550
    2551         // FIXME: We check m_userIsInteracting so that we don't begin an input session for a
    2552         // programmatic focus that doesn't cause the keyboard to appear. But this misses the case of
    2553         // a programmatic focus happening while the keyboard is already shown. Once we have a way to
    2554         // know the keyboard state in the Web Process, we should refine the condition.
    2555         if (m_userIsInteracting)
    2556             m_formClient->willBeginInputSession(this, downcast<Element>(node), WebFrame::fromCoreFrame(*node->document().frame()), userData);
     2551        m_formClient->willBeginInputSession(this, downcast<Element>(node), WebFrame::fromCoreFrame(*node->document().frame()), userData, m_userIsInteracting);
    25572552
    25582553        send(Messages::WebPageProxy::StartAssistingNode(information, m_userIsInteracting, m_hasPendingBlurNotification, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
Note: See TracChangeset for help on using the changeset viewer.