Skip to content

Commit 1d2f1f7

Browse files
Expose way to set values of classified form controls as {Legacy WebKit, WebKit} SPI
https://bugs.webkit.org/show_bug.cgi?id=174394 <rdar://problem/33183504> Patch by Frederik Riedel <[email protected]> on 2017-09-25 Reviewed by Ryosuke Niwa. Source/WebCore: * WebCore.xcodeproj/project.pbxproj: * editing/ios/AutofillElements.cpp: Added. (WebCore::isAutofillableElement): Returns true if the element is of type text or email. (WebCore::nextAutofillableElement): Returns the next focusable element that is autofillable. (WebCore::previousAutofillableElement): Returns the previous focusable element that is autofillable. (WebCore::AutofillElements::computeAutofillElements): Computes the autofill elements (username & password) for a given input element. (WebCore::AutofillElements::autofill): Fills the credentials into the pair of username/password elements. * editing/ios/AutofillElements.h: Added. Source/WebKit: * Platform/spi/ios/UIKitSPI.h: * Shared/AssistedNodeInformation.cpp: (WebKit::AssistedNodeInformation::encode const): Encodes additional node information, including if the node is part of a login screen. (WebKit::AssistedNodeInformation::decode): Decodes the additional assisted node information. * Shared/AssistedNodeInformation.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView acceptsAutofilledLoginCredentials]): Determines if the WKContentView shows a login screen. (-[WKContentView representingPageUrl]): Returns the URL of the currently displayed web page. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView insertTextSuggestion:]): Inserts the login credentials into the Web View. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAssistingNode): Transfer the additional assistednode information (acceptsAutofilledLoginCredentials and representingPageUrl). (WebKit::WebPageProxy::acceptsAutofilledLoginCredentials): Returns if the Web View shows a login screen. (WebKit::WebPageProxy::representingPageUrl): Returns the Web View's URL. (WebKit::WebPageProxy::autofillLoginCredentials): Insert the credentials into the Web View. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getAssistedNodeInformation): Transports the information if the currently highlighted node accepts autofilled login credentials. (WebKit::WebPage::autofillLoginCredentials): Fills the login credentials into the WebPage. Source/WebKitLegacy/mac: * DOM/DOMHTMLInputElement.h: * DOM/DOMHTMLInputElement.mm: (-[DOMHTMLInputElement acceptsAutofilledLoginCredentials]): Determines if this HTMLInputElement is part of a login screen. (-[DOMHTMLInputElement representingPageUrl]): Returns the webpage's URL that is currently displayed in the Web View. (-[DOMHTMLInputElement insertTextSuggestion:]): Inserts login credentials into the Web View. Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm: Added. (-[WKWebView _privateTextInput]): Testing helpers. (TestWebKitAPI::TEST): Added test cases to test AutoFill for web views. * TestWebKitAPI/ios/UIKitSPI.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@222487 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent ea69cfa commit 1d2f1f7

22 files changed

+587
-1
lines changed

Source/WebCore/ChangeLog

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2017-09-25 Frederik Riedel <[email protected]>
2+
3+
Expose way to set values of classified form controls as {Legacy WebKit, WebKit} SPI
4+
https://bugs.webkit.org/show_bug.cgi?id=174394
5+
<rdar://problem/33183504>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
* WebCore.xcodeproj/project.pbxproj:
10+
* editing/ios/AutofillElements.cpp: Added.
11+
(WebCore::isAutofillableElement): Returns true if the element is of type text or email.
12+
(WebCore::nextAutofillableElement): Returns the next focusable element that is autofillable.
13+
(WebCore::previousAutofillableElement): Returns the previous focusable element that is autofillable.
14+
(WebCore::AutofillElements::computeAutofillElements): Computes the autofill elements (username & password)
15+
for a given input element.
16+
(WebCore::AutofillElements::autofill): Fills the credentials into the pair of username/password elements.
17+
* editing/ios/AutofillElements.h: Added.
18+
119
2017-09-25 Devin Rousso <[email protected]>
220

321
Web Inspector: move Console.addInspectedNode to DOM.setInspectedNode

Source/WebCore/WebCore.xcodeproj/project.pbxproj

+9
Original file line numberDiff line numberDiff line change
@@ -2297,6 +2297,8 @@
22972297
5162C7F411F77EFB00612EFE /* SchemeRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */; };
22982298
5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 5162C7F311F77EFB00612EFE /* SchemeRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
22992299
5166D3CD1E8ED48F00AD62E3 /* StorageType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5166D3CC1E8ED41100AD62E3 /* StorageType.h */; settings = {ATTRIBUTES = (Private, ); }; };
2300+
51699EE31F608CD500D57D06 /* AutofillElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51699EE11F608CD500D57D06 /* AutofillElements.cpp */; };
2301+
51699EE41F608CD500D57D06 /* AutofillElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 51699EE21F608CD500D57D06 /* AutofillElements.h */; settings = {ATTRIBUTES = (Private, ); }; };
23002302
516BB7940CE91E6800512F79 /* JSTreeWalkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */; };
23012303
516C62201950D48700337E75 /* GamepadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516C621D1950D48700337E75 /* GamepadEvent.cpp */; };
23022304
516C62211950D48700337E75 /* GamepadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 516C621E1950D48700337E75 /* GamepadEvent.h */; };
@@ -10197,6 +10199,8 @@
1019710199
51645B531B9F889B00F789CE /* IDBVersionChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBVersionChangeEvent.h; sourceTree = "<group>"; };
1019810200
51645B541B9F88E800F789CE /* IDBCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursor.cpp; sourceTree = "<group>"; };
1019910201
5166D3CC1E8ED41100AD62E3 /* StorageType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageType.h; sourceTree = "<group>"; };
10202+
51699EE11F608CD500D57D06 /* AutofillElements.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AutofillElements.cpp; sourceTree = "<group>"; };
10203+
51699EE21F608CD500D57D06 /* AutofillElements.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutofillElements.h; sourceTree = "<group>"; };
1020010204
516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTreeWalkerCustom.cpp; sourceTree = "<group>"; };
1020110205
516C621D1950D48700337E75 /* GamepadEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadEvent.cpp; sourceTree = "<group>"; };
1020210206
516C621E1950D48700337E75 /* GamepadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadEvent.h; sourceTree = "<group>"; };
@@ -18389,6 +18393,8 @@
1838918393
443292C10EBA6D7300E62016 /* ios */ = {
1839018394
isa = PBXGroup;
1839118395
children = (
18396+
51699EE11F608CD500D57D06 /* AutofillElements.cpp */,
18397+
51699EE21F608CD500D57D06 /* AutofillElements.h */,
1839218398
D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */,
1839318399
D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */,
1839418400
FED13D390CEA934600D89466 /* EditorIOS.mm */,
@@ -27161,6 +27167,7 @@
2716127167
A5A7AA43132F0ECC00D3A3C2 /* AutocapitalizeTypes.h in Headers */,
2716227168
7C1843FE1C8B7283002EB973 /* Autofill.h in Headers */,
2716327169
7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */,
27170+
51699EE41F608CD500D57D06 /* AutofillElements.h in Headers */,
2716427171
C9D467051E60C465008195FB /* AutoplayEvent.h in Headers */,
2716527172
45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */,
2716627173
A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */,
@@ -27830,6 +27837,7 @@
2783027837
84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */,
2783127838
4129C9971F59B963009D7403 /* FetchBodySource.h in Headers */,
2783227839
41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */,
27840+
416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */,
2783327841
41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */,
2783427842
7CE1914D1F2A9AFB00272F78 /* FetchReferrerPolicy.h in Headers */,
2783527843
7CE1915A1F2A9B3400272F78 /* FetchRequestCache.h in Headers */,
@@ -31325,6 +31333,7 @@
3132531333
A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */,
3132631334
7C1843FD1C8B7283002EB973 /* Autofill.cpp in Sources */,
3132731335
7C1E97271A9F9834007BF0FB /* AutoFillButtonElement.cpp in Sources */,
31336+
51699EE31F608CD500D57D06 /* AutofillElements.cpp in Sources */,
3132831337
45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */,
3132931338
A8CFF0500A154F09000A4234 /* AutoTableLayout.cpp in Sources */,
3133031339
CDECA89A1EDF447D00DCB08B /* AVAssetTrackUtilities.mm in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* Copyright (C) 2017 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#include "config.h"
27+
#include "AutofillElements.h"
28+
29+
#include "FocusController.h"
30+
#include "Page.h"
31+
32+
namespace WebCore {
33+
34+
static inline bool isAutofillableElement(Element& node)
35+
{
36+
if (!is<HTMLInputElement>(node))
37+
return false;
38+
39+
auto inputElement = &downcast<HTMLInputElement>(node);
40+
return inputElement->isTextField() || inputElement->isEmailField();
41+
}
42+
43+
static inline RefPtr<HTMLInputElement> nextAutofillableElement(Node* startNode, FocusController& focusController)
44+
{
45+
if (!is<Element>(startNode))
46+
return nullptr;
47+
48+
RefPtr<Element> nextElement = downcast<Element>(startNode);
49+
do {
50+
nextElement = focusController.nextFocusableElement(*nextElement.get());
51+
} while (nextElement && !isAutofillableElement(*nextElement.get()));
52+
53+
if (!nextElement)
54+
return nullptr;
55+
56+
return &downcast<HTMLInputElement>(*nextElement);
57+
}
58+
59+
static inline RefPtr<HTMLInputElement> previousAutofillableElement(Node* startNode, FocusController& focusController)
60+
{
61+
if (!is<Element>(startNode))
62+
return nullptr;
63+
64+
RefPtr<Element> previousElement = downcast<Element>(startNode);
65+
do {
66+
previousElement = focusController.previousFocusableElement(*previousElement.get());
67+
} while (previousElement && !isAutofillableElement(*previousElement.get()));
68+
69+
if (!previousElement)
70+
return nullptr;
71+
72+
return &downcast<HTMLInputElement>(*previousElement);
73+
}
74+
75+
AutofillElements::AutofillElements(RefPtr<HTMLInputElement>&& username, RefPtr<HTMLInputElement>&& password)
76+
: m_username(username)
77+
, m_password(password)
78+
{
79+
}
80+
81+
std::optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HTMLInputElement> start)
82+
{
83+
if (!start->document().page())
84+
return std::nullopt;
85+
FocusController& focusController = start->document().page()->focusController();
86+
if (start->isPasswordField()) {
87+
RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController);
88+
RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
89+
bool hasDuplicatePasswordElements = (nextElement && nextElement->isPasswordField()) || (previousElement && previousElement->isPasswordField());
90+
if (hasDuplicatePasswordElements)
91+
return std::nullopt;
92+
93+
if (previousElement && is<HTMLInputElement>(*previousElement)) {
94+
if (previousElement->isTextField())
95+
return AutofillElements(WTFMove(previousElement), WTFMove(start));
96+
}
97+
} else {
98+
RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
99+
if (nextElement && is<HTMLInputElement>(*nextElement)) {
100+
if (nextElement->isPasswordField()) {
101+
RefPtr<HTMLInputElement> elementAfternextElement = nextAutofillableElement(nextElement.get(), focusController);
102+
bool hasDuplicatePasswordElements = elementAfternextElement && elementAfternextElement->isPasswordField();
103+
if (hasDuplicatePasswordElements)
104+
return std::nullopt;
105+
106+
return AutofillElements(WTFMove(start), WTFMove(nextElement));
107+
}
108+
}
109+
}
110+
111+
if (start->isPasswordField()) {
112+
RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController);
113+
RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
114+
if (!previousElement && !nextElement)
115+
return AutofillElements(nullptr, start.ptr());
116+
}
117+
return std::nullopt;
118+
}
119+
120+
void AutofillElements::autofill(String username, String password)
121+
{
122+
if (m_username) {
123+
m_username->setValueForUser(username);
124+
m_username->setAutoFilled();
125+
}
126+
if (m_password) {
127+
m_password->setValueForUser(password);
128+
m_password->setAutoFilled();
129+
}
130+
}
131+
132+
} // namespace WebCore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (C) 2017 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#include "HTMLInputElement.h"
27+
28+
namespace WebCore {
29+
30+
class AutofillElements {
31+
WTF_MAKE_FAST_ALLOCATED;
32+
public:
33+
WEBCORE_EXPORT static std::optional<AutofillElements> computeAutofillElements(Ref<HTMLInputElement>);
34+
WEBCORE_EXPORT void autofill(String, String);
35+
private:
36+
AutofillElements(RefPtr<HTMLInputElement>&&, RefPtr<HTMLInputElement>&&);
37+
RefPtr<HTMLInputElement> m_username;
38+
RefPtr<HTMLInputElement> m_password;
39+
};
40+
} // namespace WebCore

Source/WebKit/ChangeLog

+41
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
2017-09-25 Frederik Riedel <[email protected]>
2+
3+
Expose way to set values of classified form controls as {Legacy WebKit, WebKit} SPI
4+
https://bugs.webkit.org/show_bug.cgi?id=174394
5+
<rdar://problem/33183504>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
* Platform/spi/ios/UIKitSPI.h:
10+
* Shared/AssistedNodeInformation.cpp:
11+
(WebKit::AssistedNodeInformation::encode const):
12+
Encodes additional node information, including if the node is part of a login screen.
13+
(WebKit::AssistedNodeInformation::decode):
14+
Decodes the additional assisted node information.
15+
* Shared/AssistedNodeInformation.h:
16+
* UIProcess/WebPageProxy.h:
17+
* UIProcess/ios/WKContentView.mm:
18+
(-[WKContentView acceptsAutofilledLoginCredentials]):
19+
Determines if the WKContentView shows a login screen.
20+
(-[WKContentView representingPageUrl]):
21+
Returns the URL of the currently displayed web page.
22+
* UIProcess/ios/WKContentViewInteraction.mm:
23+
(-[WKContentView insertTextSuggestion:]):
24+
Inserts the login credentials into the Web View.
25+
* UIProcess/ios/WebPageProxyIOS.mm:
26+
(WebKit::WebPageProxy::startAssistingNode):
27+
Transfer the additional assistednode information (acceptsAutofilledLoginCredentials and representingPageUrl).
28+
(WebKit::WebPageProxy::acceptsAutofilledLoginCredentials):
29+
Returns if the Web View shows a login screen.
30+
(WebKit::WebPageProxy::representingPageUrl):
31+
Returns the Web View's URL.
32+
(WebKit::WebPageProxy::autofillLoginCredentials):
33+
Insert the credentials into the Web View.
34+
* WebProcess/WebPage/WebPage.h:
35+
* WebProcess/WebPage/WebPage.messages.in:
36+
* WebProcess/WebPage/ios/WebPageIOS.mm:
37+
(WebKit::WebPage::getAssistedNodeInformation): Transports the information if the currently
38+
highlighted node accepts autofilled login credentials.
39+
(WebKit::WebPage::autofillLoginCredentials): Fills the login credentials into the
40+
WebPage.
41+
142
2017-09-25 Youenn Fablet <[email protected]>
243

344
WebRTC video does not resume receiving when switching back to Safari 11 on iOS

Source/WebKit/Platform/spi/ios/UIKitSPI.h

+11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@
4343
#import <UIKit/UIInterface_Private.h>
4444
#import <UIKit/UIKeyboardImpl.h>
4545
#import <UIKit/UIKeyboardIntl.h>
46+
#if __has_include(<UIKit/UIKeyboardLoginCredentialsSuggestion.h>)
47+
#import <UIKit/UIKeyboardLoginCredentialsSuggestion.h>
48+
#else
49+
#import <UIKit/UITextInput_Private.h>
50+
@interface UIKeyboardLoginCredentialsSuggestion : UITextSuggestion
51+
52+
@property (nonatomic, assign) NSString *username;
53+
@property (nonatomic, assign) NSString *password;
54+
55+
@end
56+
#endif
4657
#import <UIKit/UIKeyboard_Private.h>
4758
#import <UIKit/UILongPressGestureRecognizer_Private.h>
4859
#import <UIKit/UIPeripheralHost.h>

Source/WebKit/Shared/AssistedNodeInformation.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ void AssistedNodeInformation::encode(IPC::Encoder& encoder) const
8686
encoder << value;
8787
encoder << valueAsNumber;
8888
encoder << title;
89+
encoder << acceptsAutofilledLoginCredentials;
90+
encoder << representingPageURL;
8991
encoder.encodeEnum(autofillFieldName);
9092
}
9193

@@ -160,6 +162,12 @@ bool AssistedNodeInformation::decode(IPC::Decoder& decoder, AssistedNodeInformat
160162
if (!decoder.decode(result.title))
161163
return false;
162164

165+
if (!decoder.decode(result.acceptsAutofilledLoginCredentials))
166+
return false;
167+
168+
if (!decoder.decode(result.representingPageURL))
169+
return false;
170+
163171
if (!decoder.decodeEnum(result.autofillFieldName))
164172
return false;
165173

Source/WebKit/Shared/AssistedNodeInformation.h

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <WebCore/AutocapitalizeTypes.h>
3030
#include <WebCore/Autofill.h>
3131
#include <WebCore/IntRect.h>
32+
#include <WebCore/URL.h>
3233
#include <wtf/text/WTFString.h>
3334

3435
namespace WebKit {
@@ -109,6 +110,8 @@ struct AssistedNodeInformation {
109110
String value;
110111
double valueAsNumber { 0 };
111112
String title;
113+
bool acceptsAutofilledLoginCredentials { false };
114+
WebCore::URL representingPageURL;
112115
WebCore::AutofillFieldName autofillFieldName { WebCore::AutofillFieldName::None };
113116

114117
void encode(IPC::Encoder&) const;

Source/WebKit/UIProcess/WebPageProxy.h

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include <WebCore/SearchPopupMenu.h>
8080
#include <WebCore/TextChecking.h>
8181
#include <WebCore/TextGranularity.h>
82+
#include <WebCore/URL.h>
8283
#include <WebCore/UserInterfaceLayoutDirection.h>
8384
#include <memory>
8485
#include <wtf/HashMap.h>
@@ -559,6 +560,9 @@ class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
559560
void setIsScrollingOrZooming(bool);
560561
void requestRectsForGranularityWithSelectionOffset(WebCore::TextGranularity, uint32_t offset, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
561562
void requestRectsAtSelectionOffsetWithText(int32_t offset, const String&, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
563+
bool acceptsAutofilledLoginCredentials();
564+
WebCore::URL representingPageURL();
565+
void autofillLoginCredentials(const String& username, const String& password);
562566
#if ENABLE(DATA_INTERACTION)
563567
void didPerformDataInteractionControllerOperation(bool handled);
564568
void didHandleStartDataInteractionRequest(bool started);
@@ -1988,6 +1992,8 @@ class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
19881992
bool m_hasDeferredStartAssistingNode { false };
19891993
std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
19901994
bool m_forceAlwaysUserScalable { false };
1995+
bool m_acceptsAutofilledLoginCredentials { false };
1996+
WebCore::URL m_representingPageURL;
19911997
#endif
19921998

19931999
#if ENABLE(POINTER_LOCK)

Source/WebKit/UIProcess/ios/WKContentView.mm

+10
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,16 @@ - (WebPageProxy*)page
258258
return _page.get();
259259
}
260260

261+
- (BOOL)acceptsAutofilledLoginCredentials
262+
{
263+
return _page->acceptsAutofilledLoginCredentials();
264+
}
265+
266+
- (NSURL *)representingPageURL
267+
{
268+
return _page->representingPageURL();
269+
}
270+
261271
- (void)willMoveToWindow:(UIWindow *)newWindow
262272
{
263273
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];

0 commit comments

Comments
 (0)