Changeset 70549 in webkit


Ignore:
Timestamp:
Oct 26, 2010 11:47:46 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-26 Dai Mikurube <dmikurube@google.com>

Reviewed by Kent Tamura.

Number values should be in the range of IEEE 754 single-precision floating point number
https://bugs.webkit.org/show_bug.cgi?id=48221

Changed tests and test expectations for number values to fit in the
range of IEEE 754 single-precision

  • fast/forms/ValidityState-stepMismatch-expected.txt:
  • fast/forms/input-stepup-stepdown-expected.txt:
  • fast/forms/input-valueasnumber-number-expected.txt:
  • fast/forms/input-valueasnumber-range-expected.txt:
  • fast/forms/script-tests/ValidityState-stepMismatch.js:
  • fast/forms/script-tests/input-stepup-stepdown.js:
  • fast/forms/script-tests/input-valueasnumber-number.js:
  • fast/forms/script-tests/input-valueasnumber-range.js:

2010-10-26 Dai Mikurube <dmikurube@google.com>

Reviewed by Kent Tamura.

Number values should be in the range of IEEE 754 single-precision floating point number
https://bugs.webkit.org/show_bug.cgi?id=48221

Changed the range of number values to fit in IEEE 754 single-precision

  • html/parser/HTMLParserIdioms.cpp: (WebCore::parseToDoubleForNumberType):
  • html/NumberInputType.cpp:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70548 r70549  
     12010-10-26  Dai Mikurube  <dmikurube@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Number values should be in the range of IEEE 754 single-precision floating point number
     6        https://bugs.webkit.org/show_bug.cgi?id=48221
     7
     8        Changed tests and test expectations for number values to fit in the
     9        range of IEEE 754 single-precision
     10
     11        * fast/forms/ValidityState-stepMismatch-expected.txt:
     12        * fast/forms/input-stepup-stepdown-expected.txt:
     13        * fast/forms/input-valueasnumber-number-expected.txt:
     14        * fast/forms/input-valueasnumber-range-expected.txt:
     15        * fast/forms/script-tests/ValidityState-stepMismatch.js:
     16        * fast/forms/script-tests/input-stepup-stepdown.js:
     17        * fast/forms/script-tests/input-valueasnumber-number.js:
     18        * fast/forms/script-tests/input-valueasnumber-range.js:
     19
    1202010-10-26  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt

    r66355 r70549  
    132132PASS stepMismatchFor("-3", undefined, "-4") is false
    133133Huge numbers and small step; uncomparable
    134 PASS stepMismatchFor("1.7976931348623157e+308", "3", "") is false
    135 PASS stepMismatchFor("1.7976931348623156e+308", "3", "") is false
    136 PASS stepMismatchFor("1.7976931348623155e+308", "3", "") is false
     134PASS stepMismatchFor("3.40282347e+38", "3", "") is false
     135PASS stepMismatchFor("3.40282346e+38", "3", "") is false
     136PASS stepMismatchFor("3.40282345e+38", "3", "") is false
    137137Huge numbers and huge step
    138 PASS stepMismatchFor("1.60e+308", "0.20e+308", "") is false
    139 PASS stepMismatchFor("1.60e+308", "0.22e+308", "") is true
     138PASS stepMismatchFor("3.20e+38", "0.20e+38", "") is false
     139PASS stepMismatchFor("3.20e+38", "0.22e+38", "") is true
    140140Fractional numbers
    141141PASS stepMismatchFor("0.9", "0.1", "") is false
     
    158158PASS stepMismatchFor("-3", undefined, "-4") is false
    159159Huge numbers and small step; uncomparable
    160 PASS stepMismatchFor("1.7976931348623157e+308", "3", "") is false
    161 PASS stepMismatchFor("1.7976931348623156e+308", "3", "") is false
    162 PASS stepMismatchFor("1.7976931348623155e+308", "3", "") is false
     160PASS stepMismatchFor("3.40282347e+38", "3", "") is false
     161PASS stepMismatchFor("3.40282346e+38", "3", "") is false
     162PASS stepMismatchFor("3.40282345e+38", "3", "") is false
    163163Huge numbers and huge step
    164 PASS stepMismatchFor("1.60e+308", "0.20e+308", "") is false
    165 PASS stepMismatchFor("1.60e+308", "0.22e+308", "") is false
     164PASS stepMismatchFor("3.20e+38", "0.20e+38", "") is false
     165PASS stepMismatchFor("3.20e+38", "0.22e+38", "") is false
    166166Fractional numbers
    167167PASS stepMismatchFor("0.9", "0.1", "") is false
  • trunk/LayoutTests/fast/forms/input-stepup-stepdown-expected.txt

    r56242 r70549  
    2626PASS stepDown("2010-02-10", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    2727Overflow/underflow
    28 PASS stepUp("2010-02-10", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    29 PASS stepDown("2010-02-10", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     28PASS stepUp("2010-02-10", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     29PASS stepDown("2010-02-10", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    3030PASS stepUp("2010-02-10", "1", "2010-02-10") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    3131PASS stepDown("2010-02-10", "1", "2010-02-10") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     
    5353PASS stepDown("2010-02-10T20:13Z", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    5454Overflow/underflow
    55 PASS stepUp("2010-02-10T20:13Z", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    56 PASS stepDown("2010-02-10T20:13Z", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     55PASS stepUp("2010-02-10T20:13Z", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     56PASS stepDown("2010-02-10T20:13Z", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    5757PASS stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    5858PASS stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     
    8080PASS stepDown("2010-02-10T20:13", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    8181Overflow/underflow
    82 PASS stepUp("2010-02-10T20:13", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    83 PASS stepDown("2010-02-10T20:13", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     82PASS stepUp("2010-02-10T20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     83PASS stepDown("2010-02-10T20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    8484PASS stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    8585PASS stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     
    107107PASS stepDown("2010-02", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    108108Overflow/underflow
    109 PASS stepUp("2010-02", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    110 PASS stepDown("2010-02", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     109PASS stepUp("2010-02", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     110PASS stepDown("2010-02", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    111111PASS stepUp("2010-02", "1", "2010-02") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    112112PASS stepDown("2010-02", "1", "2010-02") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     
    145145PASS stepDown("1", "1", "0", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    146146PASS input.value is "1"
    147 PASS stepDown("1", "1.7976931348623156e+308", "", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     147PASS stepDown("1", "3.40282346e+38", "", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    148148PASS stepUp("-1", "1", "0") is "0"
    149149PASS stepUp("0", "1", "0") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    150150PASS stepUp("-1", "1", "0", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    151151PASS input.value is "-1"
    152 PASS stepUp("1", "1.7976931348623156e+308", "", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     152PASS stepUp("1", "3.40282346e+38", "", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    153153stepDown()/stepUp() for stepMismatch values
    154154PASS stepUp("1", "2", "") is "4"
     
    158158PASS stepUp("89", "10", "99") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    159159Huge value and small step
    160 PASS input.min = ""; stepUp("1e+308", "1", "", 999999) is "1e+308"
    161 PASS input.max = ""; stepDown("1e+308", "1", "", 999999) is "1e+308"
     160PASS input.min = ""; stepUp("1e+38", "1", "", 999999) is "1e+38"
     161PASS input.max = ""; stepDown("1e+38", "1", "", 999999) is "1e+38"
    162162Fractional numbers
    163163PASS input.min = ""; stepUp("0", "0.33333333333333333", "", 3) is "1"
     
    210210PASS stepDownExplicitBounds("0", null, "1", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    211211PASS input.value is "1"
    212 PASS stepDownExplicitBounds(null, null, "1.7976931348623156e+308", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     212PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    213213PASS stepUpExplicitBounds(-100, 0, 1, -1) is "0"
    214214PASS stepUpExplicitBounds(null, 0, 1, 0) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    215215PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    216216PASS input.value is "-1"
    217 PASS stepUpExplicitBounds(null, null, "1.7976931348623156e+308", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     217PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    218218stepDown()/stepUp() for stepMismatch values
    219219PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
     
    224224PASS stepUpExplicitBounds(null, 99, 10, 89) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    225225Huge value and small step
    226 PASS stepUpExplicitBounds(0, 1e308, 1, 1e308, 999999) is "1e+308"
    227 PASS stepDownExplicitBounds(0, 1e308, 1, 1e308, 999999) is "1e+308"
     226PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
     227PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
    228228Fractional numbers
    229229PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
     
    259259PASS stepDown("20:13", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    260260Overflow/underflow
    261 PASS stepUp("20:13", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    262 PASS stepDown("20:13", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     261PASS stepUp("20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     262PASS stepDown("20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    263263PASS stepUp("20:13", "1", "20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    264264PASS stepDown("20:13", "1", "20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     
    288288PASS stepDown("2010-W02", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    289289Overflow/underflow
    290 PASS stepUp("2010-W02", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    291 PASS stepDown("2010-W02", "1.7976931348623156e+308", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     290PASS stepUp("2010-W02", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     291PASS stepDown("2010-W02", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    292292PASS stepUp("2010-W02", "1", "2010-W02") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    293293PASS stepDown("2010-W02", "1", "2010-W02") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
  • trunk/LayoutTests/fast/forms/input-valueasnumber-number-expected.txt

    r53893 r70549  
    1212PASS valueAsNumberFor("1.2E-10") is 1.2E-10
    1313PASS valueAsNumberFor("1.2E+10") is 1.2E10
    14 PASS valueAsNumberFor("12345678901234567890123456789012345678901234567890") is 1.2345678901234567E+49
     14PASS valueAsNumberFor("123456789012345678901234567890123456789") is 1.2345678901234568E+38
    1515PASS valueAsNumberFor("0.12345678901234567890123456789012345678901234567890") is 0.123456789012345678
    1616valueAsNumber for invalid string values:
     
    3939PASS setValueAsNumberAndGetValue(1.2e10) is "12000000000"
    4040PASS setValueAsNumberAndGetValue(1.2e-10) is "1.2e-10"
    41 PASS setValueAsNumberAndGetValue(1.2345678901234567e+49) is "1.2345678901234567e+49"
     41PASS setValueAsNumberAndGetValue(1.2345678901234567e+38) is "1.2345678901234567e+38"
     42PASS setValueAsNumberAndGetValue("-3.40282346e+38") is "-3.40282346e+38"
     43PASS setValueAsNumberAndGetValue("-3.40282348e+38") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     44PASS setValueAsNumberAndGetValue("3.40282346e+38") is "3.40282346e+38"
     45PASS setValueAsNumberAndGetValue("3.40282348e+38") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    4246Tests to set invalid values to valueAsNumber:
    4347PASS setValueAsNumberAndGetValue(null) is "0"
  • trunk/LayoutTests/fast/forms/input-valueasnumber-range-expected.txt

    r53893 r70549  
    1212PASS valueAsNumberFor("1.2E-10") is 0
    1313PASS valueAsNumberFor("1.2E+10") is 100
    14 PASS valueAsNumberFor("12345678901234567890123456789012345678901234567890") is 100
     14PASS valueAsNumberFor("123456789012345678901234567890123456789") is 100
    1515PASS valueAsNumberFor("0.12345678901234567890123456789012345678901234567890") is 0
    1616valueAsNumber for invalid string values:
     
    3939PASS setValueAsNumberAndGetValue(1.2e10) is "100"
    4040PASS setValueAsNumberAndGetValue(1.2e-10) is "0"
    41 PASS setValueAsNumberAndGetValue(1.2345678901234567e+49) is "100"
     41PASS setValueAsNumberAndGetValue(1.2345678901234567e+38) is "100"
    4242Tests to set invalid values to valueAsNumber:
    4343PASS setValueAsNumberAndGetValue(null) is "0"
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js

    r66355 r70549  
    149149shouldBe('stepMismatchFor("-3", undefined, "-4")', 'false');
    150150debug('Huge numbers and small step; uncomparable');
    151 shouldBe('stepMismatchFor("1.7976931348623157e+308", "3", "")', 'false');
    152 shouldBe('stepMismatchFor("1.7976931348623156e+308", "3", "")', 'false');
    153 shouldBe('stepMismatchFor("1.7976931348623155e+308", "3", "")', 'false');
     151shouldBe('stepMismatchFor("3.40282347e+38", "3", "")', 'false');
     152shouldBe('stepMismatchFor("3.40282346e+38", "3", "")', 'false');
     153shouldBe('stepMismatchFor("3.40282345e+38", "3", "")', 'false');
    154154debug('Huge numbers and huge step');
    155 shouldBe('stepMismatchFor("1.60e+308", "0.20e+308", "")', 'false');
    156 shouldBe('stepMismatchFor("1.60e+308", "0.22e+308", "")', 'true');
     155shouldBe('stepMismatchFor("3.20e+38", "0.20e+38", "")', 'false');
     156shouldBe('stepMismatchFor("3.20e+38", "0.22e+38", "")', 'true');
    157157debug('Fractional numbers');
    158158shouldBe('stepMismatchFor("0.9", "0.1", "")', 'false');
     
    180180shouldBe('stepMismatchFor("-3", undefined, "-4")', 'false');
    181181debug('Huge numbers and small step; uncomparable');
    182 shouldBe('stepMismatchFor("1.7976931348623157e+308", "3", "")', 'false');
    183 shouldBe('stepMismatchFor("1.7976931348623156e+308", "3", "")', 'false');
    184 shouldBe('stepMismatchFor("1.7976931348623155e+308", "3", "")', 'false');
     182shouldBe('stepMismatchFor("3.40282347e+38", "3", "")', 'false');
     183shouldBe('stepMismatchFor("3.40282346e+38", "3", "")', 'false');
     184shouldBe('stepMismatchFor("3.40282345e+38", "3", "")', 'false');
    185185debug('Huge numbers and huge step');
    186 shouldBe('stepMismatchFor("1.60e+308", "0.20e+308", "")', 'false');
    187 shouldBe('stepMismatchFor("1.60e+308", "0.22e+308", "")', 'false');
     186shouldBe('stepMismatchFor("3.20e+38", "0.20e+38", "")', 'false');
     187shouldBe('stepMismatchFor("3.20e+38", "0.22e+38", "")', 'false');
    188188debug('Fractional numbers');
    189189shouldBe('stepMismatchFor("0.9", "0.1", "")', 'false');
  • trunk/LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js

    r56242 r70549  
    7373shouldThrow('stepDown("2010-02-10", "any", null)', invalidStateErr);
    7474debug('Overflow/underflow');
    75 shouldThrow('stepUp("2010-02-10", "1.7976931348623156e+308", null)', invalidStateErr);
    76 shouldThrow('stepDown("2010-02-10", "1.7976931348623156e+308", null)', invalidStateErr);
     75shouldThrow('stepUp("2010-02-10", "3.40282346e+38", null)', invalidStateErr);
     76shouldThrow('stepDown("2010-02-10", "3.40282346e+38", null)', invalidStateErr);
    7777shouldThrow('stepUp("2010-02-10", "1", "2010-02-10")', invalidStateErr);
    7878shouldThrow('stepDown("2010-02-10", "1", "2010-02-10")', invalidStateErr);
     
    102102shouldThrow('stepDown("2010-02-10T20:13Z", "any", null)', invalidStateErr);
    103103debug('Overflow/underflow');
    104 shouldThrow('stepUp("2010-02-10T20:13Z", "1.7976931348623156e+308", null)', invalidStateErr);
    105 shouldThrow('stepDown("2010-02-10T20:13Z", "1.7976931348623156e+308", null)', invalidStateErr);
     104shouldThrow('stepUp("2010-02-10T20:13Z", "3.40282346e+38", null)', invalidStateErr);
     105shouldThrow('stepDown("2010-02-10T20:13Z", "3.40282346e+38", null)', invalidStateErr);
    106106shouldThrow('stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z")', invalidStateErr);
    107107shouldThrow('stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z")', invalidStateErr);
     
    131131shouldThrow('stepDown("2010-02-10T20:13", "any", null)', invalidStateErr);
    132132debug('Overflow/underflow');
    133 shouldThrow('stepUp("2010-02-10T20:13", "1.7976931348623156e+308", null)', invalidStateErr);
    134 shouldThrow('stepDown("2010-02-10T20:13", "1.7976931348623156e+308", null)', invalidStateErr);
     133shouldThrow('stepUp("2010-02-10T20:13", "3.40282346e+38", null)', invalidStateErr);
     134shouldThrow('stepDown("2010-02-10T20:13", "3.40282346e+38", null)', invalidStateErr);
    135135shouldThrow('stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13")', invalidStateErr);
    136136shouldThrow('stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13")', invalidStateErr);
     
    160160shouldThrow('stepDown("2010-02", "any", null)', invalidStateErr);
    161161debug('Overflow/underflow');
    162 shouldThrow('stepUp("2010-02", "1.7976931348623156e+308", null)', invalidStateErr);
    163 shouldThrow('stepDown("2010-02", "1.7976931348623156e+308", null)', invalidStateErr);
     162shouldThrow('stepUp("2010-02", "3.40282346e+38", null)', invalidStateErr);
     163shouldThrow('stepDown("2010-02", "3.40282346e+38", null)', invalidStateErr);
    164164shouldThrow('stepUp("2010-02", "1", "2010-02")', invalidStateErr);
    165165shouldThrow('stepDown("2010-02", "1", "2010-02")', invalidStateErr);
     
    200200shouldThrow('stepDown("1", "1", "0", 2)', invalidStateErr);
    201201shouldBe('input.value', '"1"');
    202 shouldThrow('stepDown("1", "1.7976931348623156e+308", "", 2)', invalidStateErr);
     202shouldThrow('stepDown("1", "3.40282346e+38", "", 2)', invalidStateErr);
    203203shouldBe('stepUp("-1", "1", "0")', '"0"');
    204204shouldThrow('stepUp("0", "1", "0")', invalidStateErr);
    205205shouldThrow('stepUp("-1", "1", "0", 2)', invalidStateErr);
    206206shouldBe('input.value', '"-1"');
    207 shouldThrow('stepUp("1", "1.7976931348623156e+308", "", 2)', invalidStateErr);
     207shouldThrow('stepUp("1", "3.40282346e+38", "", 2)', invalidStateErr);
    208208debug('stepDown()/stepUp() for stepMismatch values');
    209209shouldBe('stepUp("1", "2", "")', '"4"');
     
    214214shouldThrow('stepUp("89", "10", "99")', invalidStateErr);
    215215debug('Huge value and small step');
    216 shouldBe('input.min = ""; stepUp("1e+308", "1", "", 999999)', '"1e+308"');
    217 shouldBe('input.max = ""; stepDown("1e+308", "1", "", 999999)', '"1e+308"');
     216shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999999)', '"1e+38"');
     217shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999999)', '"1e+38"');
    218218debug('Fractional numbers');
    219219shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"');
     
    268268shouldThrow('stepDownExplicitBounds("0", null, "1", "1", "2")', invalidStateErr);
    269269shouldBe('input.value', '"1"');
    270 shouldThrow('stepDownExplicitBounds(null, null, "1.7976931348623156e+308", "1", "2")', invalidStateErr);
     270shouldThrow('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")', invalidStateErr);
    271271shouldBe('stepUpExplicitBounds(-100, 0, 1, -1)', '"0"');
    272272shouldThrow('stepUpExplicitBounds(null, 0, 1, 0)', invalidStateErr);
    273273shouldThrow('stepUpExplicitBounds(-100, 0, 1, -1, 2)', invalidStateErr);
    274274shouldBe('input.value', '"-1"');
    275 shouldThrow('stepUpExplicitBounds(null, null, "1.7976931348623156e+308", "1", "2")', invalidStateErr);
     275shouldThrow('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")', invalidStateErr);
    276276debug('stepDown()/stepUp() for stepMismatch values');
    277277shouldBe('stepUpExplicitBounds(null, null, 2, 1)', '"4"');
     
    282282shouldThrow('stepUpExplicitBounds(null, 99, 10, 89)', invalidStateErr);
    283283debug('Huge value and small step');
    284 shouldBe('stepUpExplicitBounds(0, 1e308, 1, 1e308, 999999)', '"1e+308"');
    285 shouldBe('stepDownExplicitBounds(0, 1e308, 1, 1e308, 999999)', '"1e+308"');
     284shouldBe('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999)', '"1e+38"');
     285shouldBe('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999)', '"1e+38"');
    286286debug('Fractional numbers');
    287287shouldBe('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '"1"');
     
    319319shouldThrow('stepDown("20:13", "any", null)', invalidStateErr);
    320320debug('Overflow/underflow');
    321 shouldThrow('stepUp("20:13", "1.7976931348623156e+308", null)', invalidStateErr);
    322 shouldThrow('stepDown("20:13", "1.7976931348623156e+308", null)', invalidStateErr);
     321shouldThrow('stepUp("20:13", "3.40282346e+38", null)', invalidStateErr);
     322shouldThrow('stepDown("20:13", "3.40282346e+38", null)', invalidStateErr);
    323323shouldThrow('stepUp("20:13", "1", "20:13")', invalidStateErr);
    324324shouldThrow('stepDown("20:13", "1", "20:13")', invalidStateErr);
     
    350350shouldThrow('stepDown("2010-W02", "any", null)', invalidStateErr);
    351351debug('Overflow/underflow');
    352 shouldThrow('stepUp("2010-W02", "1.7976931348623156e+308", null)', invalidStateErr);
    353 shouldThrow('stepDown("2010-W02", "1.7976931348623156e+308", null)', invalidStateErr);
     352shouldThrow('stepUp("2010-W02", "3.40282346e+38", null)', invalidStateErr);
     353shouldThrow('stepDown("2010-W02", "3.40282346e+38", null)', invalidStateErr);
    354354shouldThrow('stepUp("2010-W02", "1", "2010-W02")', invalidStateErr);
    355355shouldThrow('stepDown("2010-W02", "1", "2010-W02")', invalidStateErr);
  • trunk/LayoutTests/fast/forms/script-tests/input-valueasnumber-number.js

    r53893 r70549  
    2222shouldBe('valueAsNumberFor("1.2E-10")', '1.2E-10');
    2323shouldBe('valueAsNumberFor("1.2E+10")', '1.2E10');
    24 shouldBe('valueAsNumberFor("12345678901234567890123456789012345678901234567890")', '1.2345678901234567E+49');
     24shouldBe('valueAsNumberFor("123456789012345678901234567890123456789")', '1.2345678901234568E+38');
    2525shouldBe('valueAsNumberFor("0.12345678901234567890123456789012345678901234567890")', '0.123456789012345678');
    2626
     
    5252shouldBe('setValueAsNumberAndGetValue(1.2e10)', '"12000000000"');
    5353shouldBe('setValueAsNumberAndGetValue(1.2e-10)', '"1.2e-10"');
    54 shouldBe('setValueAsNumberAndGetValue(1.2345678901234567e+49)', '"1.2345678901234567e+49"');
     54shouldBe('setValueAsNumberAndGetValue(1.2345678901234567e+38)', '"1.2345678901234567e+38"');
     55shouldBe('setValueAsNumberAndGetValue("-3.40282346e+38")', '"-3.40282346e+38"');
     56shouldThrow('setValueAsNumberAndGetValue("-3.40282348e+38")', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
     57shouldBe('setValueAsNumberAndGetValue("3.40282346e+38")', '"3.40282346e+38"');
     58shouldThrow('setValueAsNumberAndGetValue("3.40282348e+38")', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
    5559
    5660debug('Tests to set invalid values to valueAsNumber:');
  • trunk/LayoutTests/fast/forms/script-tests/input-valueasnumber-range.js

    r53893 r70549  
    2727shouldBe('valueAsNumberFor("1.2E-10")', '0');
    2828shouldBe('valueAsNumberFor("1.2E+10")', '100');
    29 shouldBe('valueAsNumberFor("12345678901234567890123456789012345678901234567890")', '100');
     29shouldBe('valueAsNumberFor("123456789012345678901234567890123456789")', '100');
    3030shouldBe('valueAsNumberFor("0.12345678901234567890123456789012345678901234567890")', '0');
    3131
     
    5757shouldBe('setValueAsNumberAndGetValue(1.2e10)', '"100"');
    5858shouldBe('setValueAsNumberAndGetValue(1.2e-10)', '"0"');
    59 shouldBe('setValueAsNumberAndGetValue(1.2345678901234567e+49)', '"100"');
     59shouldBe('setValueAsNumberAndGetValue(1.2345678901234567e+38)', '"100"');
    6060
    6161debug('Tests to set invalid values to valueAsNumber:');
  • trunk/WebCore/ChangeLog

    r70546 r70549  
     12010-10-26  Dai Mikurube  <dmikurube@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Number values should be in the range of IEEE 754 single-precision floating point number
     6        https://bugs.webkit.org/show_bug.cgi?id=48221
     7
     8        Changed the range of number values to fit in IEEE 754 single-precision
     9
     10        * html/parser/HTMLParserIdioms.cpp:
     11        (WebCore::parseToDoubleForNumberType):
     12        * html/NumberInputType.cpp:
     13
    1142010-10-26  David Hyatt  <hyatt@apple.com>
    215
  • trunk/WebCore/html/NumberInputType.cpp

    r69445 r70549  
    4444using namespace std;
    4545
    46 // FIXME: Number values should be in the range of IEEE 754 single-precision
    47 // floating point number.
    48 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#real-numbers
    49 static const double numberDefaultMinimum = -DBL_MAX;
    50 static const double numberDefaultMaximum = DBL_MAX;
     46static const double numberDefaultMinimum = -FLT_MAX;
     47static const double numberDefaultMaximum = FLT_MAX;
    5148
    5249static const double numberDefaultStep = 1.0;
     
    6865}
    6966
    70 void NumberInputType::setValueAsNumber(double newValue, ExceptionCode&) const
     67void NumberInputType::setValueAsNumber(double newValue, ExceptionCode& ec) const
    7168{
     69    if (newValue < numberDefaultMinimum) {
     70        ec = INVALID_STATE_ERR;
     71        return;
     72    }
     73    if (newValue > numberDefaultMaximum) {
     74        ec = INVALID_STATE_ERR;
     75        return;
     76    }
    7277    element()->setValue(serialize(newValue));
    7378}
  • trunk/WebCore/html/parser/HTMLParserIdioms.cpp

    r68854 r70549  
    8484        return false;
    8585
     86    // Numbers are considered finite IEEE 754 single-precision floating point values.
     87    // See HTML5 2.4.4.3 `Real numbers.'
     88    if (-FLT_MAX > value || value > FLT_MAX)
     89        return false;
     90
    8691    if (result) {
    8792        // The following expression converts -0 to +0.
Note: See TracChangeset for help on using the changeset viewer.