Changeset 96224 in webkit


Ignore:
Timestamp:
Sep 28, 2011 8:52:19 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Reflected attribute input.size wraps on negative values (Chrome), or
returns them (Safari).
https://bugs.webkit.org/show_bug.cgi?id=44886

Patch by Antaryami Pandia <antaryami.pandia@motorola.com> on 2011-09-28
Reviewed by Darin Adler.

Source/WebCore:

Test: fast/dom/HTMLInputElement/input-size-attribute.html

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::parseMappedAttribute):

LayoutTests:

  • fast/dom/HTMLInputElement/input-size-attribute-expected.txt: Added.
  • fast/dom/HTMLInputElement/input-size-attribute.html: Added.
  • fast/dom/HTMLInputElement/script-tests/size-attribute.js:
  • fast/dom/HTMLInputElement/size-attribute-expected.txt:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r96223 r96224  
     12011-09-28  Antaryami Pandia  <antaryami.pandia@motorola.com>
     2
     3        Reflected attribute input.size wraps on negative values (Chrome), or
     4        returns them (Safari).
     5        https://bugs.webkit.org/show_bug.cgi?id=44886
     6
     7        Reviewed by Darin Adler.
     8
     9        * fast/dom/HTMLInputElement/input-size-attribute-expected.txt: Added.
     10        * fast/dom/HTMLInputElement/input-size-attribute.html: Added.
     11        * fast/dom/HTMLInputElement/script-tests/size-attribute.js:
     12        * fast/dom/HTMLInputElement/size-attribute-expected.txt:
     13
    1142011-09-28  Vsevolod Vlasov  <vsevik@chromium.org>
    215
  • trunk/LayoutTests/fast/dom/HTMLInputElement/script-tests/size-attribute.js

    r48551 r96224  
    88}
    99
    10 shouldBe('document.createElement("input").size', '20'); // Gecko and WebKit don't match.
     10shouldBe('document.createElement("input").size', '20');
    1111
    12 shouldBe('sizeAttributeEffect("")', '0');
     12shouldBe('sizeAttributeEffect("")', '20');
    1313
    1414shouldBe('sizeAttributeEffect("1")', '1');
     
    1616shouldBe('sizeAttributeEffect("10")', '10');
    1717
    18 shouldBe('sizeAttributeEffect("0")', '0');
     18shouldBe('sizeAttributeEffect("0")', '20');
    1919
    20 shouldBe('sizeAttributeEffect("-1")', '-1'); // Gecko and WebKit don't match.
     20shouldBe('sizeAttributeEffect("-1")', '20');
    2121
    2222shouldBe('sizeAttributeEffect("1x")', '1');
     
    2727shouldBe('sizeAttributeEffect("2.9")', '2');
    2828
    29 shouldBe('sizeAttributeEffect("a")', '0');
     29shouldBe('sizeAttributeEffect("a")', '20');
    3030
    3131var arabicIndicDigitOne = String.fromCharCode(0x661);
    32 shouldBe('sizeAttributeEffect(arabicIndicDigitOne)', '0');
     32shouldBe('sizeAttributeEffect(arabicIndicDigitOne)', '20');
    3333shouldBe('sizeAttributeEffect("2" + arabicIndicDigitOne)', '2');
    3434
  • trunk/LayoutTests/fast/dom/HTMLInputElement/size-attribute-expected.txt

    r37531 r96224  
    55
    66PASS document.createElement("input").size is 20
    7 PASS sizeAttributeEffect("") is 0
     7PASS sizeAttributeEffect("") is 20
    88PASS sizeAttributeEffect("1") is 1
    99PASS sizeAttributeEffect("2") is 2
    1010PASS sizeAttributeEffect("10") is 10
    11 PASS sizeAttributeEffect("0") is 0
    12 PASS sizeAttributeEffect("-1") is -1
     11PASS sizeAttributeEffect("0") is 20
     12PASS sizeAttributeEffect("-1") is 20
    1313PASS sizeAttributeEffect("1x") is 1
    1414PASS sizeAttributeEffect("1.") is 1
     
    1717PASS sizeAttributeEffect("2.") is 2
    1818PASS sizeAttributeEffect("2.9") is 2
    19 PASS sizeAttributeEffect("a") is 0
    20 PASS sizeAttributeEffect(arabicIndicDigitOne) is 0
     19PASS sizeAttributeEffect("a") is 20
     20PASS sizeAttributeEffect(arabicIndicDigitOne) is 20
    2121PASS sizeAttributeEffect("2" + arabicIndicDigitOne) is 2
    2222PASS successfullyParsed is true
  • trunk/Source/WebCore/ChangeLog

    r96223 r96224  
     12011-09-28  Antaryami Pandia  <antaryami.pandia@motorola.com>
     2
     3        Reflected attribute input.size wraps on negative values (Chrome), or
     4        returns them (Safari).
     5        https://bugs.webkit.org/show_bug.cgi?id=44886
     6
     7        Reviewed by Darin Adler.
     8
     9        Test: fast/dom/HTMLInputElement/input-size-attribute.html
     10
     11        * html/HTMLInputElement.cpp:
     12        (WebCore::HTMLInputElement::parseMappedAttribute):
     13
    1142011-09-28  Vsevolod Vlasov  <vsevik@chromium.org>
    215
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r95911 r96224  
    769769        parseMaxLengthAttribute(attr);
    770770    else if (attr->name() == sizeAttr) {
    771         m_size = attr->isNull() ? defaultSize : attr->value().toInt();
    772         if (renderer())
     771        int oldSize = m_size;
     772        int value = attr->value().toInt();
     773        m_size = value > 0 ? value : defaultSize;
     774        if (m_size != oldSize && renderer())
    773775            renderer()->setNeedsLayoutAndPrefWidthsRecalc();
    774776    } else if (attr->name() == altAttr)
Note: See TracChangeset for help on using the changeset viewer.