[Webkit-unassigned] [Bug 44886] Reflected attribute input.size wraps on negative values (Chrome), or returns them (Safari)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 25 21:21:52 PDT 2011


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





--- Comment #10 from Antaryami Pandia <xqb748 at motorola.com>  2011-09-25 21:21:52 PST ---
(In reply to comment #9)
> (From update of attachment 108602 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=108602&action=review
> 
> Thanks for taking this approach.
> 
> > Source/WebCore/html/HTMLInputElement.cpp:779
> > +        if (!attr->isNull()) {
> > +            int value = attr->value().toInt();
> > +            m_size = value > 0 ? value : defaultSize;
> > +        }
> 
> The way this is written, it means that if the attribute is removed, m_size will keep its old value. That’s wrong. We want m_size to get set to defaultSize in that case. Given that 0 turns into defaultSize, we can just remove the isNull check entirely, since toInt will return 0 in that case.
> 
Yes, I should have done away with the if check.But the only thought behind that was, since m_size is initialized with defaultSize it will have this value.
I will remove the if check in the next patch.

> We should make sure we have a test case for the transition from an attribute to not having an attribute, since that test case would have revealed this mistake.

Are you talking of a test case which looks as :-

<!doctype html>
<script>
    var el = document.createElement("input");
    el.setAttribute("size", "-1");
    alert(el.size);

    el.removeAttribute("size");
    alert(el.size);
</script>

                 OR

<!doctype html>
<script>
    var el = document.createElement("input");
    alert(el.size);
</script>

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list