Bug 221429 - Allow Password AutoFill in more text field configurations
Summary: Allow Password AutoFill in more text field configurations
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ricky Mondello
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-04 14:18 PST by Ricky Mondello
Modified: 2021-02-05 15:32 PST (History)
6 users (show)

See Also:


Attachments
First attempt at a patch (7.30 KB, patch)
2021-02-04 14:22 PST, Ricky Mondello
no flags Details | Formatted Diff | Diff
Second try (8.85 KB, patch)
2021-02-05 10:50 PST, Ricky Mondello
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ricky Mondello 2021-02-04 14:18:07 PST
Allow Password AutoFill in more text field configurations
Comment 1 Ricky Mondello 2021-02-04 14:22:24 PST
Created attachment 419321 [details]
First attempt at a patch
Comment 2 Radar WebKit Bug Importer 2021-02-04 14:23:24 PST
<rdar://problem/73997299>
Comment 3 Wenson Hsieh 2021-02-04 15:17:37 PST
Comment on attachment 419321 [details]
First attempt at a patch

View in context: https://bugs.webkit.org/attachment.cgi?id=419321&action=review

Looks good! Just a couple of minor comments. We should also write an API test for this (similar to the existing ones in WKWebViewAutoFillTests).

> Source/WebCore/editing/cocoa/AutofillElements.cpp:99
> +        return AutofillElements(
> +            previousFieldIsTextField ? WTFMove(previousElement) : nullptr,
> +            WTFMove(start),
> +            hasSecondPasswordFieldToFill ? WTFMove(nextElement) : nullptr
> +        );

We could probably put this on one line, as `return {{ previousFieldIsTextField ? WTFMove(previousElement) : nullptr, WTFMove(start), hasSecondPasswordFieldToFill ? WTFMove(nextElement) : nullptr }};`

> Source/WebCore/editing/cocoa/AutofillElements.cpp:104
> +                RefPtr<HTMLInputElement> elementAfterNextElement = nextAutofillableElement(nextElement.get(), focusController);

Nit - `auto elementAfterNextElement = nextAutofillableElement(nextElement.get(), focusController);`

> Source/WebCore/editing/cocoa/AutofillElements.cpp:108
> +                return AutofillElements(WTFMove(start), WTFMove(nextElement),
> +                    hasSecondPasswordFieldToFill ? WTFMove(elementAfterNextElement) : nullptr);

Nit - I think this should could just be a single line as `return {{ WTFMove(start), WTFMove(nextElement), hasSecondPasswordFieldToFill ? WTFMove(elementAfterNextElement) : nullptr }};`
Comment 4 Wenson Hsieh 2021-02-04 17:32:43 PST
(In reply to Wenson Hsieh from comment #3)
> Comment on attachment 419321 [details]
> First attempt at a patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=419321&action=review
> 
> Looks good! Just a couple of minor comments. We should also write an API
> test for this (similar to the existing ones in WKWebViewAutoFillTests).

Actually, it looks like the existing test WKWebViewAutoFillTests.AccountCreationPage already exercises this scenario, and just needs to be rebaselined.

> 
> > Source/WebCore/editing/cocoa/AutofillElements.cpp:99
> > +        return AutofillElements(
> > +            previousFieldIsTextField ? WTFMove(previousElement) : nullptr,
> > +            WTFMove(start),
> > +            hasSecondPasswordFieldToFill ? WTFMove(nextElement) : nullptr
> > +        );
> 
> We could probably put this on one line, as `return {{
> previousFieldIsTextField ? WTFMove(previousElement) : nullptr,
> WTFMove(start), hasSecondPasswordFieldToFill ? WTFMove(nextElement) :
> nullptr }};`
> 
> > Source/WebCore/editing/cocoa/AutofillElements.cpp:104
> > +                RefPtr<HTMLInputElement> elementAfterNextElement = nextAutofillableElement(nextElement.get(), focusController);
> 
> Nit - `auto elementAfterNextElement =
> nextAutofillableElement(nextElement.get(), focusController);`
> 
> > Source/WebCore/editing/cocoa/AutofillElements.cpp:108
> > +                return AutofillElements(WTFMove(start), WTFMove(nextElement),
> > +                    hasSecondPasswordFieldToFill ? WTFMove(elementAfterNextElement) : nullptr);
> 
> Nit - I think this should could just be a single line as `return {{
> WTFMove(start), WTFMove(nextElement), hasSecondPasswordFieldToFill ?
> WTFMove(elementAfterNextElement) : nullptr }};`
Comment 5 Ricky Mondello 2021-02-05 10:50:15 PST
Created attachment 419433 [details]
Second try
Comment 6 Wenson Hsieh 2021-02-05 10:52:46 PST
Comment on attachment 419433 [details]
Second try

View in context: https://bugs.webkit.org/attachment.cgi?id=419433&action=review

r=mews

> Source/WebCore/editing/cocoa/AutofillElements.cpp:78
>      : m_username(username)
>      , m_password(password)
> +    , m_secondPassword(secondPassword)

(Not exactly new to this patch, but these could all be `WTFMove`d into the class members)
Comment 7 Wenson Hsieh 2021-02-05 11:00:28 PST
(In reply to Wenson Hsieh from comment #6)
> Comment on attachment 419433 [details]
> Second try
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=419433&action=review
> 
> r=mews
> 
> > Source/WebCore/editing/cocoa/AutofillElements.cpp:78
> >      : m_username(username)
> >      , m_password(password)
> > +    , m_secondPassword(secondPassword)
> 
> (Not exactly new to this patch, but these could all be `WTFMove`d into the
> class members)

Perhaps we can just do this as a followup.
Comment 8 Wenson Hsieh 2021-02-05 13:51:02 PST
Comment on attachment 419433 [details]
Second try

C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorDOMAgent.cpp(1761,99): error C2514: 'WTF::Optional': class template cannot be constructed (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-5.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorDOMAgent.cpp(1761,99): error C2451: conditional expression of type 'WTF::Optional' is illegal (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-5.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorDOMAgent.cpp(1762,36): error C2039: 'setLayoutContextType': is not a member of 'Inspector::Protocol::DOM::Node' (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-5.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorDOMAgent.cpp(1762,54): error C2663: 'WTF::Optional<T>::value': 3 overloads have no legal conversion for 'this' pointer (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-5.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]

Windows build failure does not appear to be related.
Comment 9 EWS 2021-02-05 15:32:44 PST
Committed r272448: <https://trac.webkit.org/changeset/272448>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419433 [details].