<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Need ability to specify alternate image for AutoFill button in input fields"
href="https://bugs.webkit.org/show_bug.cgi?id=153116#c25">Comment # 25</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Need ability to specify alternate image for AutoFill button in input fields"
href="https://bugs.webkit.org/show_bug.cgi?id=153116">bug 153116</a>
from <span class="vcard"><a class="email" href="mailto:darin@apple.com" title="Darin Adler <darin@apple.com>"> <span class="fn">Darin Adler</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=270014&action=diff" name="attach_270014" title="Patch v4">attachment 270014</a> <a href="attachment.cgi?id=270014&action=edit" title="Patch v4">[details]</a></span>
Patch v4
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=270014&action=review">https://bugs.webkit.org/attachment.cgi?id=270014&action=review</a>
I think we should eventually return to this and refine a little further.
<span class="quote">> Source/WebCore/html/TextFieldInputType.cpp:429
> +static bool isAutoFillButtonTypeChanged(const AtomicString& attribute, AutoFillButtonType autoFillButtonType)
> +{
> + if (attribute == "-webkit-contacts-auto-fill-button" && autoFillButtonType != AutoFillButtonType::Contacts)
> + return true;
> +
> + if (attribute == "-webkit-credentials-auto-fill-button" && autoFillButtonType != AutoFillButtonType::Credentials)
> + return true;
> +
> + return false;
> +}</span >
I would have written this:
return attribute != autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType);
But as you will see in my comments below, we don’t need this function at all and it should be deleted.
<span class="quote">> Source/WebCore/html/TextFieldInputType.cpp:645
> +void TextFieldInputType::createAutoFillButton(AutoFillButtonType autoFillButtonType)</span >
This function should be entirely deleted and the code should be moved into updateAutoFillButton. There are a few small mistakes that are hidden by having this code in a separate function.
<span class="quote">> Source/WebCore/html/TextFieldInputType.cpp:650
> + if (autoFillButtonType == AutoFillButtonType::None)
> + return;</span >
This is dead code and it’s not needed. It will never be called in this case.
<span class="quote">> Source/WebCore/html/TextFieldInputType.cpp:653
> + m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType));</span >
This isn’t needed. The caller can take care of this after creating the button.
<span class="quote">> Source/WebCore/html/TextFieldInputType.cpp:664
> - createAutoFillButton();
> + createAutoFillButton(element().autoFillButtonType());</span >
This change wasn’t needed.
<span class="quote">> Source/WebCore/html/TextFieldInputType.cpp:669
> + const AtomicString& attribute = m_autoFillButton->fastGetAttribute(pseudoAttr);
> + bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, element().autoFillButtonType());
> + if (shouldUpdateAutoFillButtonType)
> + m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));</span >
There’s no value to making this conditional. It should just be:
m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));
The other checking, including the isAutoFillButtonTypeChanged, is unnecessary and slightly wasteful.
<span class="quote">> Source/WebCore/testing/Internals.idl:64
> +enum AutoFillButtonType {
> + "AutoFillButtonTypeNone",
> + "AutoFillButtonTypeContacts",
> + "AutoFillButtonTypeCredentials"
> +};</span >
I would have just used the strings "none", "credentials", and "contacts". Not sure why the long strings with capital letters are better.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>