Changeset 86650 in webkit


Ignore:
Timestamp:
May 16, 2011 7:34:25 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-16 Naoki Takano <takano.naoki@gmail.com>

Reviewed by Kent Tamura.

HTML5 Number Spinbox displays a 0 in situations where a 0 is not between the min and max.
https://bugs.webkit.org/show_bug.cgi?id=60871

  • fast/forms/input-stepup-stepdown-from-renderer-expected.txt: Added expected results.
  • fast/forms/script-tests/input-stepup-stepdown-from-renderer.js: Added test patterns when initial values are empty.

2011-05-16 Naoki Takano <takano.naoki@gmail.com>

Reviewed by Kent Tamura.

HTML5 Number Spinbox displays a 0 in situations where a 0 is not between the min and max.
https://bugs.webkit.org/show_bug.cgi?id=60871

Test: fast/forms/input-stepup-stepdown-from-renderer.html

In number input type, if the value is not a number, including empty, the currect valued is assumed 0.
But we have to handle it separately from the case when the value is actuall "0".

  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::stepUpFromRenderer): Added cliping for default value.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86649 r86650  
     12011-05-16  Naoki Takano  <takano.naoki@gmail.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        HTML5 Number Spinbox displays a 0 in situations where a 0 is not between the min and max.
     6        https://bugs.webkit.org/show_bug.cgi?id=60871
     7
     8        * fast/forms/input-stepup-stepdown-from-renderer-expected.txt: Added expected results.
     9        * fast/forms/script-tests/input-stepup-stepdown-from-renderer.js: Added test patterns when initial values are empty.
     10
    1112011-05-16  Adam Barth  <abarth@webkit.org>
    212
  • trunk/LayoutTests/fast/forms/input-stepup-stepdown-from-renderer-expected.txt

    r72884 r86650  
    145145PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 11) is "5.06"
    146146PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 12) is "5.065"
     147PASS stepUpExplicitBounds(-4, 4, 1, "") is "1"
     148PASS stepDownExplicitBounds(-4, 4, 1, "") is "-1"
     149PASS stepDownExplicitBounds(0, 4, 1, "") is "0"
     150PASS stepUpExplicitBounds(-4, 0, 1, "") is "0"
     151PASS stepDownExplicitBounds(1, 4, 1, "") is "1"
     152PASS stepUpExplicitBounds(1, 4, 1, "") is "1"
     153PASS stepDownExplicitBounds(-4, -1, 1, "") is "-1"
     154PASS stepUpExplicitBounds(-4, -1, 1, "") is "-1"
     155PASS stepUpExplicitBounds(-100, null, 3, "") is "2"
     156PASS stepDownExplicitBounds(-100, null, 3, "") is "-1"
     157PASS stepUpExplicitBounds(1, 4, 1, 0) is "1"
     158PASS stepDownExplicitBounds(1, 4, 1, 0) is "0"
     159PASS stepDownExplicitBounds(-4, -1, 1, 0) is "-1"
     160PASS stepUpExplicitBounds(-4, -1, 1, 0) is "0"
     161PASS stepUpExplicitBounds(-100, null, 3, 3) is "5"
     162PASS stepDownExplicitBounds(-100, null, 3, 3) is "2"
    147163
    148164Range type
  • trunk/LayoutTests/fast/forms/script-tests/input-stepup-stepdown-from-renderer.js

    r72884 r86650  
    228228shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 11)', '"5.06"');
    229229shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 12)', '"5.065"');
     230shouldBe('stepUpExplicitBounds(-4, 4, 1, "")', '"1"');
     231shouldBe('stepDownExplicitBounds(-4, 4, 1, "")', '"-1"');
     232shouldBe('stepDownExplicitBounds(0, 4, 1, "")', '"0"');
     233shouldBe('stepUpExplicitBounds(-4, 0, 1, "")', '"0"');
     234shouldBe('stepDownExplicitBounds(1, 4, 1, "")', '"1"');
     235shouldBe('stepUpExplicitBounds(1, 4, 1, "")', '"1"');
     236shouldBe('stepDownExplicitBounds(-4, -1, 1, "")', '"-1"');
     237shouldBe('stepUpExplicitBounds(-4, -1, 1, "")', '"-1"');
     238shouldBe('stepUpExplicitBounds(-100, null, 3, "")', '"2"');
     239shouldBe('stepDownExplicitBounds(-100, null, 3, "")', '"-1"');
     240shouldBe('stepUpExplicitBounds(1, 4, 1, 0)', '"1"');
     241shouldBe('stepDownExplicitBounds(1, 4, 1, 0)', '"0"');
     242shouldBe('stepDownExplicitBounds(-4, -1, 1, 0)', '"-1"');
     243shouldBe('stepUpExplicitBounds(-4, -1, 1, 0)', '"0"');
     244shouldBe('stepUpExplicitBounds(-100, null, 3, 3)', '"5"');
     245shouldBe('stepDownExplicitBounds(-100, null, 3, 3)', '"2"');
    230246
    231247debug('');
  • trunk/Source/WebCore/ChangeLog

    r86649 r86650  
     12011-05-16  Naoki Takano  <takano.naoki@gmail.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        HTML5 Number Spinbox displays a 0 in situations where a 0 is not between the min and max.
     6        https://bugs.webkit.org/show_bug.cgi?id=60871
     7
     8        Test: fast/forms/input-stepup-stepdown-from-renderer.html
     9
     10        In number input type, if the value is not a number, including empty, the currect valued is assumed 0.
     11        But we have to handle it separately from the case when the value is actuall "0".
     12
     13        * html/HTMLInputElement.cpp:
     14        (WebCore::HTMLInputElement::stepUpFromRenderer): Added cliping for default value.
     15
    1162011-05-16  Adam Barth  <abarth@webkit.org>
    217
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r85998 r86650  
    14621462        ExceptionCode ec;
    14631463        current = m_inputType->defaultValueForStepUp();
     1464        int nextDiff = step * n;
     1465        if (current < m_inputType->minimum() - nextDiff)
     1466            current = m_inputType->minimum() - nextDiff;
     1467        if (current > m_inputType->maximum() - nextDiff)
     1468            current = m_inputType->maximum() - nextDiff;
    14641469        setValueAsNumber(current, ec);
    14651470    }
     
    14681473    else {
    14691474        ExceptionCode ec;
    1470         if (stepMismatch(currentStringValue)) {
     1475        if (stepMismatch(value())) {
    14711476            ASSERT(step);
    14721477            double newValue;
Note: See TracChangeset for help on using the changeset viewer.