<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#c30">Comment # 30</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:zacharyli323&#64;gmail.com" title="Zach Li &lt;zacharyli323&#64;gmail.com&gt;"> <span class="fn">Zach Li</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=153116#c29">comment #29</a>)
<span class="quote">&gt; Three other small suggestions. You can probably do two of these if you come
&gt; back for cleanup.
&gt; 
&gt; (In reply to <a href="show_bug.cgi?id=153116#c27">comment #27</a>)
&gt; &gt; void TextFieldInputType::updateAutoFillButton()
&gt; &gt; {
&gt; &gt;     if (shouldDrawAutoFillButton()) {
&gt; &gt;         if (!m_container)
&gt; &gt;             createContainer();
&gt; &gt; 
&gt; &gt;         if (!m_autoFillButton) {
&gt; &gt;             m_autoFillButton = AutoFillButtonElement::create(element().document(), *this);
&gt; &gt;             m_container-&gt;appendChild(*m_autoFillButton, IGNORE_EXCEPTION);
&gt; &gt;         }
&gt; &gt; 
&gt; &gt;         m_autoFillButton-&gt;setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));
&gt; &gt;         m_autoFillButton-&gt;setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock, true);
&gt; &gt;         return;
&gt; &gt;     }
&gt; &gt;     
&gt; &gt;     if (m_autoFillButton)
&gt; &gt;         m_autoFillButton-&gt;setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true);        
&gt; &gt; }
&gt; 
&gt; Only thing I would do differently is that I would do the &quot;should not draw&quot;
&gt; case first as the early exit case, reversing the logic.
&gt; 
&gt;     if (!shouldDrawAutoFillButton()) {
&gt;         if (m_autoFillButton)
&gt;             m_autoFillButton-&gt;setInlineStyleProperty(CSSPropertyDisplay,
&gt; CSSValueNone, true);
&gt;         return;
&gt;     }
&gt; 
&gt; That way less of the real logic of the function is nested inside an if
&gt; statement.
&gt; 
&gt; Also, should not use IGNORE_EXCEPTION in the call to appendChild. We want
&gt; the default behavior, ASSERT_NO_EXCEPTION.
&gt; 
&gt; I’m also not 100% sure why we have to set important to true in these style
&gt; rules. It would be nice if someone double checked that we need to do that,
&gt; possibly even making a test case, and if not, remove those unsightly &quot;,
&gt; true&quot; in all the calls to setInlineStyleProperty.</span >

(In reply to <a href="show_bug.cgi?id=153116#c28">comment #28</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=153116#c27">comment #27</a>)
&gt; &gt; Taking your above comments into consideration, we only need the
&gt; &gt; updateAutoFillButton() method that looks like:
&gt; 
&gt; Yes, that looks right.
&gt; 
&gt; &gt; &gt; &gt; Source/WebCore/testing/Internals.idl:64
&gt; &gt; &gt; &gt; +enum AutoFillButtonType {
&gt; &gt; &gt; &gt; +    &quot;AutoFillButtonTypeNone&quot;,
&gt; &gt; &gt; &gt; +    &quot;AutoFillButtonTypeContacts&quot;,
&gt; &gt; &gt; &gt; +    &quot;AutoFillButtonTypeCredentials&quot;
&gt; &gt; &gt; &gt; +};
&gt; &gt; &gt; 
&gt; &gt; &gt; I would have just used the strings &quot;none&quot;, &quot;credentials&quot;, and &quot;contacts&quot;.
&gt; &gt; &gt; Not sure why the long strings with capital letters are better.
&gt; &gt; 
&gt; &gt; I also prefer shorter strings as long as they are clear. In Internals.idl,
&gt; &gt; there are strings with capital letters and there are strings with lower case
&gt; &gt; for enum, what is the recommended practice for this?
&gt; 
&gt; I think there’s some confusion between true enums in C++ code, where the
&gt; values need to avoid conflicting with each other and look right in C++ code
&gt; context, enums in DOM APIs and enums in our internals file.
&gt; 
&gt; 1) For enums in C++ code, they need to not collide with each other so we
&gt; either need to prefix values with the type, or use enum class. And we use
&gt; capital letters in those by convention.
&gt; 
&gt; 2) For enums in DOM APIs, we need to match the style of the DOM
&gt; specifications, which means we use ALL_CAPITAL_LETTERS style for the values.
&gt; There is also some issue of name conflict there.
&gt; 
&gt; 3) For these enums for internals, what we are calling enums is actually just
&gt; a list of string values. There is no need to make them unique, prefix them
&gt; with a type name, or anything else like that.
&gt; 
&gt; So for these, in category (3) I think we should use lower case strings. When
&gt; there is more than one word, not sure if we should use spaces (like normal
&gt; English), hyphens (like CSS identifiers), underscores, or capital letters
&gt; (like local variables in C++ code). But really no need to use capital
&gt; letters.</span >

This is really helpful!</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>