<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&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=270014&amp;action=diff" name="attach_270014" title="Patch v4">attachment 270014</a> <a href="attachment.cgi?id=270014&amp;action=edit" title="Patch v4">[details]</a></span>
Patch v4

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=270014&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=270014&amp;action=review</a>

I think we should eventually return to this and refine a little further.

<span class="quote">&gt; Source/WebCore/html/TextFieldInputType.cpp:429
&gt; +static bool isAutoFillButtonTypeChanged(const AtomicString&amp; attribute, AutoFillButtonType autoFillButtonType)
&gt; +{
&gt; +    if (attribute == &quot;-webkit-contacts-auto-fill-button&quot; &amp;&amp; autoFillButtonType != AutoFillButtonType::Contacts)
&gt; +        return true;
&gt; +
&gt; +    if (attribute == &quot;-webkit-credentials-auto-fill-button&quot; &amp;&amp; autoFillButtonType != AutoFillButtonType::Credentials)
&gt; +        return true;
&gt; +
&gt; +    return false;
&gt; +}</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">&gt; Source/WebCore/html/TextFieldInputType.cpp:645
&gt; +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">&gt; Source/WebCore/html/TextFieldInputType.cpp:650
&gt; +    if (autoFillButtonType == AutoFillButtonType::None)
&gt; +        return;</span >

This is dead code and it’s not needed. It will never be called in this case.

<span class="quote">&gt; Source/WebCore/html/TextFieldInputType.cpp:653
&gt; +    m_autoFillButton-&gt;setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType));</span >

This isn’t needed. The caller can take care of this after creating the button.

<span class="quote">&gt; Source/WebCore/html/TextFieldInputType.cpp:664
&gt; -            createAutoFillButton();
&gt; +            createAutoFillButton(element().autoFillButtonType());</span >

This change wasn’t needed.

<span class="quote">&gt; Source/WebCore/html/TextFieldInputType.cpp:669
&gt; +        const AtomicString&amp; attribute = m_autoFillButton-&gt;fastGetAttribute(pseudoAttr);
&gt; +        bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, element().autoFillButtonType());
&gt; +        if (shouldUpdateAutoFillButtonType)
&gt; +            m_autoFillButton-&gt;setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));</span >

There’s no value to making this conditional. It should just be:

    m_autoFillButton-&gt;setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));

The other checking, including the isAutoFillButtonTypeChanged, is unnecessary and slightly wasteful.

<span class="quote">&gt; Source/WebCore/testing/Internals.idl:64
&gt; +enum AutoFillButtonType {
&gt; +    &quot;AutoFillButtonTypeNone&quot;,
&gt; +    &quot;AutoFillButtonTypeContacts&quot;,
&gt; +    &quot;AutoFillButtonTypeCredentials&quot;
&gt; +};</span >

I would have just used the strings &quot;none&quot;, &quot;credentials&quot;, and &quot;contacts&quot;. 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>