Title: [226048] trunk
Revision
226048
Author
[email protected]
Date
2017-12-18 09:14:04 -0800 (Mon, 18 Dec 2017)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226047 => 226048)


--- trunk/LayoutTests/ChangeLog	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/LayoutTests/ChangeLog	2017-12-18 17:14:04 UTC (rev 226048)
@@ -1,3 +1,17 @@
+2017-12-18  Daniel Bates  <[email protected]>
+
+        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.
+
+        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.
+
 2017-12-18  Ms2ger  <[email protected]>
 
         Rebaseline fast/dom/Window/window-lookup-precedence.html

Added: trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt (0 => 226048)


--- trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt	2017-12-18 17:14:04 UTC (rev 226048)
@@ -0,0 +1,25 @@
+This tests that querying for the last auto fill button type works. This test must be run in WebKitTestRunner or DumpRenderTree.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.autoFillButtonType(inputElement) is "None"
+internals.setShowAutoFillButton(inputElement, 'Credentials')
+PASS internals.autoFillButtonType(inputElement) is "Credentials"
+PASS internals.lastAutoFillButtonType(inputElement) is "None"
+internals.setShowAutoFillButton(inputElement, 'Contacts')
+PASS internals.autoFillButtonType(inputElement) is "Contacts"
+PASS internals.lastAutoFillButtonType(inputElement) is "Credentials"
+internals.setShowAutoFillButton(inputElement, 'StrongPassword')
+PASS internals.autoFillButtonType(inputElement) is "StrongPassword"
+PASS internals.lastAutoFillButtonType(inputElement) is "Contacts"
+internals.setShowAutoFillButton(inputElement, 'StrongConfirmationPassword')
+PASS internals.autoFillButtonType(inputElement) is "StrongConfirmationPassword"
+PASS internals.lastAutoFillButtonType(inputElement) is "StrongPassword"
+internals.setShowAutoFillButton(inputElement, 'None')
+PASS internals.autoFillButtonType(inputElement) is "None"
+PASS internals.lastAutoFillButtonType(inputElement) is "StrongConfirmationPassword"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html (0 => 226048)


--- trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html	2017-12-18 17:14:04 UTC (rev 226048)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<input type="text" id="input">
+<script>
+description("This tests that querying for the last auto fill button type works. This test must be run in WebKitTestRunner or DumpRenderTree.");
+
+if (!window.internals)
+    testFailed("Must be run in WebKitTestRunner or DumpRenderTree");
+else {
+    var inputElement = document.getElementById("input");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "None");
+    evalAndLog("internals.setShowAutoFillButton(inputElement, 'Credentials')");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "Credentials");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "None");
+    evalAndLog("internals.setShowAutoFillButton(inputElement, 'Contacts')");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "Contacts");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "Credentials");
+    evalAndLog("internals.setShowAutoFillButton(inputElement, 'StrongPassword')");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "StrongPassword");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "Contacts");
+    evalAndLog("internals.setShowAutoFillButton(inputElement, 'StrongConfirmationPassword')");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "StrongConfirmationPassword");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "StrongPassword");
+    evalAndLog("internals.setShowAutoFillButton(inputElement, 'None')");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "None");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "StrongConfirmationPassword");
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (226047 => 226048)


--- trunk/Source/WebCore/ChangeLog	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebCore/ChangeLog	2017-12-18 17:14:04 UTC (rev 226048)
@@ -1,3 +1,35 @@
+2017-12-18  Daniel Bates  <[email protected]>
+
+        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.
+
+        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.
+
 2017-12-17  John Wilander  <[email protected]>
 
         Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (226047 => 226048)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2017-12-18 17:14:04 UTC (rev 226048)
@@ -111,6 +111,7 @@
     , m_autocomplete(Uninitialized)
     , m_isAutoFilled(false)
     , m_autoFillButtonType(static_cast<uint8_t>(AutoFillButtonType::None))
+    , m_lastAutoFillButtonType(static_cast<uint8_t>(AutoFillButtonType::None))
     , m_isAutoFillAvailable(false)
 #if ENABLE(DATALIST_ELEMENT)
     , m_hasNonEmptyList(false)
@@ -1371,6 +1372,7 @@
     if (static_cast<uint8_t>(autoFillButtonType) == m_autoFillButtonType)
         return;
 
+    m_lastAutoFillButtonType = m_autoFillButtonType;
     m_autoFillButtonType = static_cast<uint8_t>(autoFillButtonType);
     m_inputType->updateAutoFillButton();
     updateInnerTextElementEditability();

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (226047 => 226048)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2017-12-18 17:14:04 UTC (rev 226048)
@@ -244,6 +244,7 @@
     bool isAutoFilled() const { return m_isAutoFilled; }
     WEBCORE_EXPORT void setAutoFilled(bool = true);
 
+    AutoFillButtonType lastAutoFillButtonType() const { return static_cast<AutoFillButtonType>(m_lastAutoFillButtonType); }
     AutoFillButtonType autoFillButtonType() const { return static_cast<AutoFillButtonType>(m_autoFillButtonType); }
     WEBCORE_EXPORT void setShowAutoFillButton(AutoFillButtonType);
 
@@ -462,7 +463,8 @@
     bool m_isActivatedSubmit : 1;
     unsigned m_autocomplete : 2; // AutoCompleteSetting
     bool m_isAutoFilled : 1;
-    unsigned m_autoFillButtonType : 3; // AutoFillButtonType;
+    unsigned m_autoFillButtonType : 3; // AutoFillButtonType
+    unsigned m_lastAutoFillButtonType : 3; // AutoFillButtonType
     bool m_isAutoFillAvailable : 1;
 #if ENABLE(DATALIST_ELEMENT)
     bool m_hasNonEmptyList : 1;

Modified: trunk/Source/WebCore/testing/Internals.cpp (226047 => 226048)


--- trunk/Source/WebCore/testing/Internals.cpp	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebCore/testing/Internals.cpp	2017-12-18 17:14:04 UTC (rev 226048)
@@ -1663,20 +1663,48 @@
         return AutoFillButtonType::Credentials;
     case Internals::AutoFillButtonType::Contacts:
         return AutoFillButtonType::Contacts;
+    case Internals::AutoFillButtonType::StrongConfirmationPassword:
+        return AutoFillButtonType::StrongConfirmationPassword;
     case Internals::AutoFillButtonType::StrongPassword:
         return AutoFillButtonType::StrongPassword;
-    case Internals::AutoFillButtonType::StrongConfirmationPassword:
-        return AutoFillButtonType::StrongConfirmationPassword;
     }
     ASSERT_NOT_REACHED();
     return AutoFillButtonType::None;
 }
 
+static Internals::AutoFillButtonType toInternalsAutoFillButtonType(AutoFillButtonType type)
+{
+    switch (type) {
+    case AutoFillButtonType::None:
+        return Internals::AutoFillButtonType::None;
+    case AutoFillButtonType::Credentials:
+        return Internals::AutoFillButtonType::Credentials;
+    case AutoFillButtonType::Contacts:
+        return Internals::AutoFillButtonType::Contacts;
+    case AutoFillButtonType::StrongConfirmationPassword:
+        return Internals::AutoFillButtonType::StrongConfirmationPassword;
+   case AutoFillButtonType::StrongPassword:
+        return Internals::AutoFillButtonType::StrongPassword;
+    }
+    ASSERT_NOT_REACHED();
+    return Internals::AutoFillButtonType::None;
+}
+
 void Internals::setShowAutoFillButton(HTMLInputElement& element, AutoFillButtonType type)
 {
     element.setShowAutoFillButton(toAutoFillButtonType(type));
 }
 
+auto Internals::autoFillButtonType(const HTMLInputElement& element) -> AutoFillButtonType
+{
+    return toInternalsAutoFillButtonType(element.autoFillButtonType());
+}
+
+auto Internals::lastAutoFillButtonType(const HTMLInputElement& element) -> AutoFillButtonType
+{
+    return toInternalsAutoFillButtonType(element.lastAutoFillButtonType());
+}
+
 ExceptionOr<void> Internals::scrollElementToRect(Element& element, int x, int y, int w, int h)
 {
     FrameView* frameView = element.document().view();

Modified: trunk/Source/WebCore/testing/Internals.h (226047 => 226048)


--- trunk/Source/WebCore/testing/Internals.h	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebCore/testing/Internals.h	2017-12-18 17:14:04 UTC (rev 226048)
@@ -236,6 +236,8 @@
     void setAutofilled(HTMLInputElement&, bool enabled);
     enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword, StrongConfirmationPassword };
     void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
+    AutoFillButtonType autoFillButtonType(const HTMLInputElement&);
+    AutoFillButtonType lastAutoFillButtonType(const HTMLInputElement&);
     ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h);
 
     ExceptionOr<String> autofillFieldName(Element&);

Modified: trunk/Source/WebCore/testing/Internals.idl (226047 => 226048)


--- trunk/Source/WebCore/testing/Internals.idl	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebCore/testing/Internals.idl	2017-12-18 17:14:04 UTC (rev 226048)
@@ -190,6 +190,8 @@
     void setEditingValue(HTMLInputElement inputElement, DOMString value);
     void setAutofilled(HTMLInputElement inputElement, boolean enabled);
     void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
+    AutoFillButtonType autoFillButtonType(HTMLInputElement inputElement);
+    AutoFillButtonType lastAutoFillButtonType(HTMLInputElement inputElement);
 
     [MayThrowException] Range? rangeOfString(DOMString text, Range? referenceRange, sequence<DOMString> findOptions);
     [MayThrowException] unsigned long countMatchesForText(DOMString text, sequence<DOMString> findOptions, DOMString markMatches);

Modified: trunk/Source/WebKit/ChangeLog (226047 => 226048)


--- trunk/Source/WebKit/ChangeLog	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/ChangeLog	2017-12-18 17:14:04 UTC (rev 226048)
@@ -1,3 +1,40 @@
+2017-12-18  Daniel Bates  <[email protected]>
+
+        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.
+
+        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:
+
 2017-12-18  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] Add WebKitWebView::web-process-terminated signal and deprecate web-process-crashed

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h (226047 => 226048)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h	2017-12-18 17:14:04 UTC (rev 226048)
@@ -75,6 +75,8 @@
  */
 @property (nonatomic, readonly, getter=isUserInitiated) BOOL userInitiated;
 
+@property (nonatomic, readonly) NSObject <NSSecureCoding> *userObject WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 @end
 
 #endif // WK_API_ENABLED

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (226047 => 226048)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2017-12-18 17:14:04 UTC (rev 226048)
@@ -254,12 +254,12 @@
 @protocol UISelectionInteractionAssistant;
 
 @interface WKFocusedElementInfo : NSObject <_WKFocusedElementInfo>
-- (instancetype)initWithAssistedNodeInformation:(const AssistedNodeInformation&)information isUserInitiated:(BOOL)isUserInitiated;
+- (instancetype)initWithAssistedNodeInformation:(const AssistedNodeInformation&)information isUserInitiated:(BOOL)isUserInitiated userObject:(NSObject <NSSecureCoding> *)userObject;
 @end
 
 @interface WKFormInputSession : NSObject <_WKFormInputSession>
 
-- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo userObject:(NSObject <NSSecureCoding> *)userObject;
+- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo;
 - (void)invalidate;
 
 @end
@@ -266,7 +266,6 @@
 
 @implementation WKFormInputSession {
     WKContentView *_contentView;
-    RetainPtr<NSObject <NSSecureCoding>> _userObject;
     RetainPtr<WKFocusedElementInfo> _focusedElementInfo;
     RetainPtr<UIView> _customInputView;
     RetainPtr<NSArray<UITextSuggestion *>> _suggestions;
@@ -274,7 +273,7 @@
     BOOL _forceSecureTextEntry;
 }
 
-- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo userObject:(NSObject <NSSecureCoding> *)userObject
+- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo
 {
     if (!(self = [super init]))
         return nil;
@@ -281,7 +280,6 @@
 
     _contentView = view;
     _focusedElementInfo = elementInfo;
-    _userObject = userObject;
 
     return self;
 }
@@ -293,7 +291,7 @@
 
 - (NSObject <NSSecureCoding> *)userObject
 {
-    return _userObject.get();
+    return [_focusedElementInfo userObject];
 }
 
 - (BOOL)isValid
@@ -383,9 +381,10 @@
     WKInputType _type;
     RetainPtr<NSString> _value;
     BOOL _isUserInitiated;
+    RetainPtr<NSObject <NSSecureCoding>> _userObject;
 }
 
-- (instancetype)initWithAssistedNodeInformation:(const AssistedNodeInformation&)information isUserInitiated:(BOOL)isUserInitiated
+- (instancetype)initWithAssistedNodeInformation:(const AssistedNodeInformation&)information isUserInitiated:(BOOL)isUserInitiated userObject:(NSObject <NSSecureCoding> *)userObject
 {
     if (!(self = [super init]))
         return nil;
@@ -448,6 +447,7 @@
     }
     _value = information.value;
     _isUserInitiated = isUserInitiated;
+    _userObject = userObject;
     return self;
 }
 
@@ -465,6 +465,11 @@
 {
     return _isUserInitiated;
 }
+
+- (NSObject <NSSecureCoding> *)userObject
+{
+    return _userObject.get();
+}
 @end
 
 @interface WKContentView (WKInteractionPrivate)
@@ -3846,7 +3851,7 @@
     _inputViewUpdateDeferrer = nullptr;
 
     id <_WKInputDelegate> inputDelegate = [_webView _inputDelegate];
-    RetainPtr<WKFocusedElementInfo> focusedElementInfo = adoptNS([[WKFocusedElementInfo alloc] initWithAssistedNodeInformation:information isUserInitiated:userIsInteracting]);
+    RetainPtr<WKFocusedElementInfo> focusedElementInfo = adoptNS([[WKFocusedElementInfo alloc] initWithAssistedNodeInformation:information isUserInitiated:userIsInteracting userObject:userObject]);
     BOOL shouldShowKeyboard;
 
     if ([inputDelegate respondsToSelector:@selector(_webView:focusShouldStartInputSession:)])
@@ -3903,7 +3908,7 @@
     [_inputPeripheral beginEditing];
 
     if ([inputDelegate respondsToSelector:@selector(_webView:didStartInputSession:)]) {
-        _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get() userObject:userObject]);
+        _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get()]);
         [inputDelegate _webView:_webView didStartInputSession:_formInputSession.get()];
     }
     

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm (226047 => 226048)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2017-12-18 17:14:04 UTC (rev 226048)
@@ -144,11 +144,40 @@
     return WebCore::AutoFillButtonType::None;
 }
 
+static _WKAutoFillButtonType toWKAutoFillButtonType(WebCore::AutoFillButtonType autoFillButtonType)
+{
+    switch (autoFillButtonType) {
+    case WebCore::AutoFillButtonType::None:
+        return _WKAutoFillButtonTypeNone;
+    case WebCore::AutoFillButtonType::Contacts:
+        return _WKAutoFillButtonTypeContacts;
+    case WebCore::AutoFillButtonType::Credentials:
+        return _WKAutoFillButtonTypeCredentials;
+    case WebCore::AutoFillButtonType::StrongConfirmationPassword:
+        return _WKAutoFillButtonTypeStrongConfirmationPassword;
+    case WebCore::AutoFillButtonType::StrongPassword:
+        return _WKAutoFillButtonTypeStrongPassword;
+    }
+    ASSERT_NOT_REACHED();
+    return _WKAutoFillButtonTypeNone;
+
+}
+
 - (void)setHTMLInputElementAutoFillButtonEnabledWithButtonType:(_WKAutoFillButtonType)autoFillButtonType
 {
     _nodeHandle->setHTMLInputElementAutoFillButtonEnabled(toAutoFillButtonType(autoFillButtonType));
 }
 
+- (_WKAutoFillButtonType)htmlInputElementAutoFillButtonType
+{
+    return toWKAutoFillButtonType(_nodeHandle->htmlInputElementAutoFillButtonType());
+}
+
+- (_WKAutoFillButtonType)htmlInputElementLastAutoFillButtonType
+{
+    return toWKAutoFillButtonType(_nodeHandle->htmlInputElementLastAutoFillButtonType());
+}
+
 - (BOOL)HTMLInputElementIsUserEdited
 {
     return _nodeHandle->htmlInputElementLastChangeWasUserEdit();

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h (226047 => 226048)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h	2017-12-18 17:14:04 UTC (rev 226048)
@@ -39,6 +39,8 @@
 
 - (BOOL)isHTMLInputElementAutoFillButtonEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 - (void)setHTMLInputElementAutoFillButtonEnabledWithButtonType:(_WKAutoFillButtonType)autoFillButtonType WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (_WKAutoFillButtonType)htmlInputElementAutoFillButtonType WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (_WKAutoFillButtonType)htmlInputElementLastAutoFillButtonType WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp (226047 => 226048)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2017-12-18 17:14:04 UTC (rev 226048)
@@ -55,6 +55,24 @@
     return WebCore::AutoFillButtonType::None;
 }
 
+static WKAutoFillButtonType toWKAutoFillButtonType(WebCore::AutoFillButtonType autoFillButtonType)
+{
+    switch (autoFillButtonType) {
+    case WebCore::AutoFillButtonType::None:
+        return kWKAutoFillButtonTypeNone;
+    case WebCore::AutoFillButtonType::Contacts:
+        return kWKAutoFillButtonTypeContacts;
+    case WebCore::AutoFillButtonType::Credentials:
+        return kWKAutoFillButtonTypeCredentials;
+    case WebCore::AutoFillButtonType::StrongConfirmationPassword:
+        return kWKAutoFillButtonTypeStrongConfirmationPassword;
+    case WebCore::AutoFillButtonType::StrongPassword:
+        return kWKAutoFillButtonTypeStrongPassword;
+    }
+    ASSERT_NOT_REACHED();
+    return kWKAutoFillButtonTypeNone;
+}
+
 WKTypeID WKBundleNodeHandleGetTypeID()
 {
     return toAPI(InjectedBundleNodeHandle::APIType);
@@ -124,6 +142,16 @@
     toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFillButtonEnabled(toAutoFillButtonType(autoFillButtonType));
 }
 
+WKAutoFillButtonType WKBundleNodeHandleGetHTMLInputElementAutoFillButtonType(WKBundleNodeHandleRef htmlInputElementHandleRef)
+{
+    return toWKAutoFillButtonType(toImpl(htmlInputElementHandleRef)->htmlInputElementAutoFillButtonType());
+}
+
+WKAutoFillButtonType WKBundleNodeHandleGetHTMLInputElementLastAutoFillButtonType(WKBundleNodeHandleRef htmlInputElementHandleRef)
+{
+    return toWKAutoFillButtonType(toImpl(htmlInputElementHandleRef)->htmlInputElementLastAutoFillButtonType());
+}
+
 bool WKBundleNodeHandleGetHTMLInputElementAutoFillAvailable(WKBundleNodeHandleRef htmlInputElementHandleRef)
 {
     return toImpl(htmlInputElementHandleRef)->isAutoFillAvailable();

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h (226047 => 226048)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2017-12-18 17:14:04 UTC (rev 226048)
@@ -66,6 +66,8 @@
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabledWithButtonType(WKBundleNodeHandleRef htmlInputElementHandle, WKAutoFillButtonType autoFillButtonType);
+WK_EXPORT WKAutoFillButtonType WKBundleNodeHandleGetHTMLInputElementAutoFillButtonType(WKBundleNodeHandleRef htmlInputElementHandle);
+WK_EXPORT WKAutoFillButtonType WKBundleNodeHandleGetHTMLInputElementLastAutoFillButtonType(WKBundleNodeHandleRef htmlInputElementHandle);
 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFillAvailable(WKBundleNodeHandleRef htmlInputElementHandle);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillAvailable(WKBundleNodeHandleRef htmlInputElementHandle, bool autoFillAvailable);
 WK_EXPORT WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandle);

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp (226047 => 226048)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp	2017-12-18 17:14:04 UTC (rev 226048)
@@ -271,6 +271,20 @@
     downcast<HTMLInputElement>(m_node.get()).setShowAutoFillButton(autoFillButtonType);
 }
 
+AutoFillButtonType InjectedBundleNodeHandle::htmlInputElementAutoFillButtonType() const
+{
+    if (!is<HTMLInputElement>(m_node))
+        return AutoFillButtonType::None;
+    return downcast<HTMLInputElement>(m_node.get()).autoFillButtonType();
+}
+
+AutoFillButtonType InjectedBundleNodeHandle::htmlInputElementLastAutoFillButtonType() const
+{
+    if (!is<HTMLInputElement>(m_node))
+        return AutoFillButtonType::None;
+    return downcast<HTMLInputElement>(m_node.get()).lastAutoFillButtonType();
+}
+
 bool InjectedBundleNodeHandle::isAutoFillAvailable() const
 {
     if (!is<HTMLInputElement>(m_node))

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h (226047 => 226048)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h	2017-12-18 17:00:21 UTC (rev 226047)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h	2017-12-18 17:14:04 UTC (rev 226048)
@@ -70,6 +70,8 @@
     void setHTMLInputElementAutoFilled(bool);
     bool isHTMLInputElementAutoFillButtonEnabled() const;
     void setHTMLInputElementAutoFillButtonEnabled(WebCore::AutoFillButtonType);
+    WebCore::AutoFillButtonType htmlInputElementAutoFillButtonType() const;
+    WebCore::AutoFillButtonType htmlInputElementLastAutoFillButtonType() const;
     bool isAutoFillAvailable() const;
     void setAutoFillAvailable(bool);
     WebCore::IntRect htmlInputElementAutoFillButtonBounds();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to