Changeset 64711 in webkit


Ignore:
Timestamp:
Aug 4, 2010 10:51:33 PM (14 years ago)
Author:
tkent@chromium.org
Message:

Spin-button behavior improvement for out-of-range values
https://bugs.webkit.org/show_bug.cgi?id=43463

Reviewed by Darin Adler.

WebCore:

If the current value is smaller than the minimum value, the up
button should change the value to the minimum value. If the
current value is larger than the maximum value, the down button
should change the value to the maximum value.

Test: fast/forms/input-number-outofrange.html

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::stepUpFromRenderer):

LayoutTests:

  • fast/forms/input-number-outofrange-expected.txt: Added.
  • fast/forms/input-number-outofrange.html: Added.
  • fast/forms/script-tests/input-number-outofrange.js: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64707 r64711  
     12010-08-04  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Spin-button behavior improvement for out-of-range values
     6        https://bugs.webkit.org/show_bug.cgi?id=43463
     7
     8        * fast/forms/input-number-outofrange-expected.txt: Added.
     9        * fast/forms/input-number-outofrange.html: Added.
     10        * fast/forms/script-tests/input-number-outofrange.js: Added.
     11
    1122010-08-04  Kent Tamura  <tkent@chromium.org>
    213
  • trunk/WebCore/ChangeLog

    r64705 r64711  
     12010-08-04  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Spin-button behavior improvement for out-of-range values
     6        https://bugs.webkit.org/show_bug.cgi?id=43463
     7
     8        If the current value is smaller than the minimum value, the up
     9        button should change the value to the minimum value. If the
     10        current value is larger than the maximum value, the down button
     11        should change the value to the maximum value.
     12
     13        Test: fast/forms/input-number-outofrange.html
     14
     15        * html/HTMLInputElement.cpp:
     16        (WebCore::HTMLInputElement::stepUpFromRenderer):
     17
    1182010-08-04  Antonio Gomes  <tonikitoo@webkit.org>
    219
  • trunk/WebCore/html/HTMLInputElement.cpp

    r64616 r64711  
    28182818void HTMLInputElement::stepUpFromRenderer(int n)
    28192819{
    2820     // The difference from stepUp()/stepDown() is:
    2821     // If the current value is invalid, the value will be
    2822     //  - the minimum value if n > 0
    2823     //  - the maximum value if n < 0
     2820    // The differences from stepUp()/stepDown():
     2821    // If the current value is not a number, the value will be
     2822    //  - The value should be the minimum value if n > 0
     2823    //  - The value should be the maximum value if n < 0
     2824    // If the current value is smaller than the minimum value:
     2825    //  - The value should be the minimum value if n > 0
     2826    //  - Nothing should happen if n < 0
     2827    // If the current value is larger than the maximum value:
     2828    //  - The value should be the maximum value if n < 0
     2829    //  - Nothing should happen if n > 0
    28242830
    28252831    ASSERT(hasSpinButton());
     
    28332839    String currentStringValue = value();
    28342840    double current = parseToDouble(currentStringValue, nan);
    2835     if (!isfinite(current))
     2841    if (!isfinite(current) || (n > 0 && current < minimum()) || (n < 0 && current > maximum()))
    28362842        setValue(serialize(n > 0 ? minimum() : maximum()));
    28372843    else {
Note: See TracChangeset for help on using the changeset viewer.