[Webkit-unassigned] [Bug 153116] Need ability to specify alternate image for AutoFill button in input fields

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 26 15:09:34 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=153116

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #269831|review?                     |review+
              Flags|                            |

--- Comment #20 from Darin Adler <darin at apple.com> ---
Comment on attachment 269831
  --> https://bugs.webkit.org/attachment.cgi?id=269831
Patch v3

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

Code is OK. Still one significant problem with it (no way to remove the auto-fill button), and a number of questionable points of style.

> Source/WebCore/html/HTMLTextFormControlElement.h:37
> +enum class AutoFillButtonType : uint8_t { Uninitialized, Credentials, Contacts };

I think that the first value is None, not Uninitialized. It means no auto-fill button at all, not “uninitialized”.

> Source/WebCore/html/TextFieldInputType.cpp:643
> +    AtomicString pseudoClassName = autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType);
> +    m_autoFillButton->setPseudo(pseudoClassName);

Would read better without a local variable as a single line.

> Source/WebCore/html/TextFieldInputType.cpp:654
> +            createAutoFillButton(element().autoFillButtonType());

Missing code to remove the auto-fill button if the type changes from contacts or credentials to none.

> Source/WebCore/html/TextFieldInputType.cpp:657
> +        AtomicString pseudoContactsAutoFillClassName = AtomicString("-webkit-contacts-auto-fill-button", AtomicString::ConstructFromLiteral);
> +        AtomicString pseudoCredentialsAutoFillClassName = AtomicString("-webkit-credentials-auto-fill-button", AtomicString::ConstructFromLiteral);

This is a unnecessarily slow way to write the code. You can just write attribute == "-webkit-contacts-auto-fill-button"; no need to do all the extra work to create an atomic string.

> Source/WebCore/html/TextFieldInputType.cpp:658
> +        AtomicString attribute = m_autoFillButton->getAttribute(pseudoAttr);

Wrong type here. It should be auto&, or const AtomicString& to avoid unnecessary work.

Wrong function called here. It should be fastGetAttribute.

> Source/WebCore/html/TextFieldInputType.cpp:659
> +        bool shouldUpdateAutoFillButtonType = ((attribute == pseudoContactsAutoFillClassName && element().autoFillButtonType() != AutoFillButtonType::Contacts) || (attribute == pseudoCredentialsAutoFillClassName && element().autoFillButtonType() != AutoFillButtonType::Credentials));

This is really hard to read. I think a helper function would make it easier to read. But I also don’t understand why we wouldn’t just call setPseudo unconditionally. Are we trying to optimize something?

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


More information about the webkit-unassigned mailing list