[webkit-reviews] review denied: [Bug 174394] Expose way to set values of classified form controls as {Legacy WebKit, WebKit} SPI : [Attachment 319277] Patch

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


Ryosuke Niwa <rniwa at webkit.org> has denied Frederik Riedel <riedel at apple.com>'s
request for review:
Bug 174394: Expose way to set values of classified form controls as {Legacy
WebKit, WebKit} SPI
https://bugs.webkit.org/show_bug.cgi?id=174394

Attachment 319277: Patch

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




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

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
> +#if PLATFORM(IOS)
> +    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.


More information about the webkit-reviews mailing list