Add SPI to query for the current and last auto fill button type and pass user data...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Dec 2017 17:14:04 +0000 (17:14 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Dec 2017 17:14:04 +0000 (17:14 +0000)
commit15e6c477e3df89d7cfe4d08464bf9a900681540d
treef9a9fef76241d25406d31f0adba968bca654e4f5
parent378bbda5b88e3e8ee983051f186ed7686a61f7ac
Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
https://bugs.webkit.org/show_bug.cgi?id=180774
<rdar://problem/36033832>

Reviewed by Tim Horton.

Source/WebCore:

Expose a way for an embedding client to query for the auto fill button type of a specific
input element as it may not be feasible for a client to track such state themselves. For
similar reasons track and expose SPI to query for the last auto fill button type for a
specific field.

Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::setShowAutoFillButton):
Update the last auto fill button type.

* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.

* testing/Internals.cpp:
(WebCore::toAutoFillButtonType):
(WebCore::toInternalsAutoFillButtonType):
(WebCore::Internals::autoFillButtonType):
(WebCore::Internals::lastAutoFillButtonType):
* testing/Internals.h:
* testing/Internals.idl:
Add functions for testing.

Source/WebKit:

Have WKFocusedElementInfo own the optional user data object associated with the focused
element as opposed to having WKFormInputSession own it. This allows the Injected Bundle's
_webView:focusShouldStartInputSession: delegate callback to make use of this user data
to determine whether focus should start a new input session.

* UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession initWithContentView:focusedElementInfo:]):
(-[WKFormInputSession userObject]):
(-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
(-[WKFocusedElementInfo userObject]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
(-[WKFormInputSession initWithContentView:focusedElementInfo:userObject:]): Deleted.
(-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:]): Deleted.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(toWKAutoFillButtonType):
(-[WKWebProcessPlugInNodeHandle htmlInputElementAutoFillButtonType]):
(-[WKWebProcessPlugInNodeHandle htmlInputElementLastAutoFillButtonType]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(toWKAutoFillButtonType):
(WKBundleNodeHandleGetHTMLInputElementAutoFillButtonType):
(WKBundleNodeHandleGetHTMLInputElementLastAutoFillButtonType):
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::htmlInputElementAutoFillButtonType const):
(WebKit::InjectedBundleNodeHandle::htmlInputElementLastAutoFillButtonType const):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:

LayoutTests:

Adds a test to ensure that we can query for the current auto fill button type and last auto fill button
type of an HTML input element.

* fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt: Added.
* fast/forms/auto-fill-button/last-auto-fill-button-type.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@226048 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm
Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h