[Webkit-unassigned] [Bug 174394] Expose way to set values of classified form controls as {Legacy WebKit, WebKit} SPI

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 29 14:03:19 PDT 2017


Ryosuke Niwa <rniwa at webkit.org> changed:

           What    |Removed                     |Added
 Attachment #319277|review?                     |review-
              Flags|                            |

--- Comment #29 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 319277
  --> https://bugs.webkit.org/attachment.cgi?id=319277

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

Okay, this code is a lot better. You might still want to refactor it as a separate class. It's fine if you didn't but please address other review comments.

> Source/WebCore/editing/Editor.h:281
> +    WEBCORE_EXPORT static bool isAutofillable(RefPtr<Element>);
> +    WEBCORE_EXPORT static std::optional<AutofillElements> computeAutofillElements(RefPtr<Element>);
> +    WEBCORE_EXPORT static void autofillElements(String, String, AutofillElements);
> +#endif

Hm... now that I'm looking at this, it might be better to have a class named AutofillElements and make these functions members of that class.

> Source/WebCore/editing/ios/EditorIOS.mm:490
> +static inline RefPtr<Element> nextAutofillableElement(Node* startNode, Page& page, bool isForward)

I think it's better to have two functions one called nextAutofillableElement and previousAutofillableElement instead of taking isForward argument given how small the actual code is.

> Source/WebCore/editing/ios/EditorIOS.mm:495
> +    Element* nextElement = downcast<Element>(startNode);

Use RefPtr instead.

> Source/WebCore/editing/ios/EditorIOS.mm:539
> +                autofillElements.password = &inputElement;

We don't have username in this case?

> Source/WebCore/editing/ios/EditorIOS.mm:544
> +    return autofillElements;

We should return nullopt here instead.

> Source/WebCore/editing/ios/EditorIOS.mm:551
> +bool Editor::isAutofillable(RefPtr<Element> start)
> +{
> +    std::optional<AutofillElements> autofillElements = Editor::computeAutofillElements(start);
> +    return (autofillElements->username && autofillElements->password) || autofillElements->password;
> +}

This function is not needed once computeAutofillElements returns nullopt in the case neither username nor password is set.
The caller of this function can just check !Editor::computeAutofillElements(start) then.

> Source/WebCore/html/HTMLInputElement.cpp:900
> +bool HTMLInputElement::isAutofillableElement()
> +{
> +    return isTextField() || isEmailField();
> +}
> +

We're not using this function. Please remove.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170829/7b57dc08/attachment-0001.html>

More information about the webkit-unassigned mailing list