<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191940] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191940">191940</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-02 23:21:41 -0800 (Mon, 02 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>input[type=number] does not increment/decrement integers with trailing decimal characters
https://bugs.webkit.org/show_bug.cgi?id=148867
rdar://problem/22589693
Patch by Keith Rollin <krollin@apple.com> on 2015-11-02
Reviewed by Chris Dumez.
Source/WebCore:
Support input[type=number].value attributes of the form "###." (that
is, leading digits with a decimal but no trailing digits). This form
was supported in the setting of the attribute, but not when changing
it through stepUp/Down.
Testing turned up similarly incorrect processing of -.###, so
addressed that, too.
Test: fast/forms/range/input-appearance-range-decimals.html
Updated the following tests:
- fast/forms/number/number-stepup-stepdown-from-renderer.html
- fast/forms/number/number-stepup-stepdown.html
- fast/forms/range/range-stepup-stepdown-from-renderer.html
- fast/forms/range/range-stepup-stepdown.html
* html/InputType.cpp:
(WebCore::InputType::stepUpFromRenderer):
* platform/Decimal.cpp:
(WebCore::Decimal::fromString):
LayoutTests:
New tests for input[type=number].skipUp/Down when .value ends in a
decimal point (with no additional trailing digits). Also some coverage
for input[type=range] which shares some same code.
* fast/forms/number/number-stepup-stepdown-expected.txt:
* fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt:
* fast/forms/number/number-stepup-stepdown-from-renderer.html:
* fast/forms/number/number-stepup-stepdown.html:
* fast/forms/range/range-stepup-stepdown-expected.txt:
* fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt:
* fast/forms/range/range-stepup-stepdown-from-renderer.html:
* fast/forms/range/range-stepup-stepdown.html:
* fast/forms/range/input-appearance-range-decimals-expected.html: Added
* fast/forms/range/input-appearance-range-decimals.html: Added</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastformsnumbernumberstepupstepdownexpectedtxt">trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsnumbernumberstepupstepdownfromrendererexpectedtxt">trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsnumbernumberstepupstepdownfromrendererhtml">trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html</a></li>
<li><a href="#trunkLayoutTestsfastformsnumbernumberstepupstepdownhtml">trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html</a></li>
<li><a href="#trunkLayoutTestsfastformsrangerangestepupstepdownexpectedtxt">trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsrangerangestepupstepdownfromrendererexpectedtxt">trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsrangerangestepupstepdownfromrendererhtml">trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer.html</a></li>
<li><a href="#trunkLayoutTestsfastformsrangerangestepupstepdownhtml">trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlInputTypecpp">trunk/Source/WebCore/html/InputType.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformDecimalcpp">trunk/Source/WebCore/platform/Decimal.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformsrangeinputappearancerangedecimalsexpectedhtml">trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastformsrangeinputappearancerangedecimalshtml">trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/ChangeLog        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-11-02 Keith Rollin <krollin@apple.com>
+
+ input[type=number] does not increment/decrement integers with trailing decimal characters
+ https://bugs.webkit.org/show_bug.cgi?id=148867
+ rdar://problem/22589693
+
+ Reviewed by Chris Dumez.
+
+ New tests for input[type=number].skipUp/Down when .value ends in a
+ decimal point (with no additional trailing digits). Also some coverage
+ for input[type=range] which shares some same code.
+
+ * fast/forms/number/number-stepup-stepdown-expected.txt:
+ * fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt:
+ * fast/forms/number/number-stepup-stepdown-from-renderer.html:
+ * fast/forms/number/number-stepup-stepdown.html:
+ * fast/forms/range/range-stepup-stepdown-expected.txt:
+ * fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt:
+ * fast/forms/range/range-stepup-stepdown-from-renderer.html:
+ * fast/forms/range/range-stepup-stepdown.html:
+ * fast/forms/range/input-appearance-range-decimals-expected.html: Added
+ * fast/forms/range/input-appearance-range-decimals.html: Added
+
</ins><span class="cx"> 2015-11-02 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> [Cocoa] Fix tests
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsnumbernumberstepupstepdownexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -4,9 +4,11 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> Number type
</span><ins>+
</ins><span class="cx"> Invalid value
</span><span class="cx"> PASS stepUp("", null, null) threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="cx"> PASS stepDown("", null, null) threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> Non-number arguments
</span><span class="cx"> PASS stepUp("0", null, null, "0") is "0"
</span><span class="cx"> PASS stepDown("0", null, null, "0") is "0"
</span><span class="lines">@@ -14,6 +16,7 @@
</span><span class="cx"> PASS stepDown("0", null, null, "foo") is "0"
</span><span class="cx"> PASS stepUp("0", null, null, null) is "0"
</span><span class="cx"> PASS stepDown("0", null, null, null) is "0"
</span><ins>+
</ins><span class="cx"> Normal cases
</span><span class="cx"> PASS stepUp("0", null, null) is "1"
</span><span class="cx"> PASS stepUp("1", null, null, 2) is "3"
</span><span class="lines">@@ -21,19 +24,121 @@
</span><span class="cx"> PASS stepDown("2", null, null) is "1"
</span><span class="cx"> PASS stepDown("1", null, null, 2) is "-1"
</span><span class="cx"> PASS stepDown("-1", null, null, -1) is "0"
</span><ins>+
+Fractional cases
+PASS stepUp("0.1", 1, null) is "1.1"
+PASS stepUp("0.2", 1, null) is "1.2"
+PASS stepUp("1.0", 1, null) is "2"
+PASS stepUp("1.1", 1, null) is "2.1"
+PASS stepUp("1.2", 1, null) is "2.2"
+PASS stepUp("2.0", 1, null) is "3"
+
+PASS stepUp("-0.1", 1, null) is "0.9"
+PASS stepUp("-0.2", 1, null) is "0.8"
+PASS stepUp("-1.0", 1, null) is "0"
+PASS stepUp("-1.1", 1, null) is "-0.1"
+PASS stepUp("-1.2", 1, null) is "-0.2"
+PASS stepUp("-2.0", 1, null) is "-1"
+
+PASS stepDown("0.1", 1, null) is "-0.9"
+PASS stepDown("0.2", 1, null) is "-0.8"
+PASS stepDown("1.0", 1, null) is "0"
+PASS stepDown("1.1", 1, null) is "0.1"
+PASS stepDown("1.2", 1, null) is "0.2"
+PASS stepDown("2.0", 1, null) is "1"
+
+PASS stepDown("-0.1", 1, null) is "-1.1"
+PASS stepDown("-0.2", 1, null) is "-1.2"
+PASS stepDown("-1.0", 1, null) is "-2"
+PASS stepDown("-1.1", 1, null) is "-2.1"
+PASS stepDown("-1.2", 1, null) is "-2.2"
+PASS stepDown("-2.0", 1, null) is "-3"
+
+PASS stepUp(".1", 1, null) is "1.1"
+PASS stepUp(".2", 1, null) is "1.2"
+PASS stepUp("1.", 1, null) is "2"
+PASS stepUp("2.", 1, null) is "3"
+
+PASS stepUp("-.1", 1, null) is "0.9"
+PASS stepUp("-.2", 1, null) is "0.8"
+PASS stepUp("-1.", 1, null) is "0"
+PASS stepUp("-2.", 1, null) is "-1"
+
+PASS stepDown(".1", 1, null) is "-0.9"
+PASS stepDown(".2", 1, null) is "-0.8"
+PASS stepDown("1.", 1, null) is "0"
+PASS stepDown("2.", 1, null) is "1"
+
+PASS stepDown("-.1", 1, null) is "-1.1"
+PASS stepDown("-.2", 1, null) is "-1.2"
+PASS stepDown("-1.", 1, null) is "-2"
+PASS stepDown("-2.", 1, null) is "-3"
+
+PASS stepUp("0.1", .1, null) is "0.2"
+PASS stepUp("0.2", .1, null) is "0.3"
+PASS stepUp("1.0", .1, null) is "1.1"
+PASS stepUp("1.1", .1, null) is "1.2"
+PASS stepUp("1.2", .1, null) is "1.3"
+PASS stepUp("2.0", .1, null) is "2.1"
+
+PASS stepUp("-0.1", .1, null) is "0"
+PASS stepUp("-0.2", .1, null) is "-0.1"
+PASS stepUp("-1.0", .1, null) is "-0.9"
+PASS stepUp("-1.1", .1, null) is "-1"
+PASS stepUp("-1.2", .1, null) is "-1.1"
+PASS stepUp("-2.0", .1, null) is "-1.9"
+
+PASS stepDown("0.1", .1, null) is "0"
+PASS stepDown("0.2", .1, null) is "0.1"
+PASS stepDown("1.0", .1, null) is "0.9"
+PASS stepDown("1.1", .1, null) is "1"
+PASS stepDown("1.2", .1, null) is "1.1"
+PASS stepDown("2.0", .1, null) is "1.9"
+
+PASS stepDown("-0.1", .1, null) is "-0.2"
+PASS stepDown("-0.2", .1, null) is "-0.3"
+PASS stepDown("-1.0", .1, null) is "-1.1"
+PASS stepDown("-1.1", .1, null) is "-1.2"
+PASS stepDown("-1.2", .1, null) is "-1.3"
+PASS stepDown("-2.0", .1, null) is "-2.1"
+
+PASS stepUp(".1", .1, null) is "0.2"
+PASS stepUp(".2", .1, null) is "0.3"
+PASS stepUp("1.", .1, null) is "1.1"
+PASS stepUp("2.", .1, null) is "2.1"
+
+PASS stepUp("-.1", .1, null) is "0"
+PASS stepUp("-.2", .1, null) is "-0.1"
+PASS stepUp("-1.", .1, null) is "-0.9"
+PASS stepUp("-2.", .1, null) is "-1.9"
+
+PASS stepDown(".1", .1, null) is "0"
+PASS stepDown(".2", .1, null) is "0.1"
+PASS stepDown("1.", .1, null) is "0.9"
+PASS stepDown("2.", .1, null) is "1.9"
+
+PASS stepDown("-.1", .1, null) is "-0.2"
+PASS stepDown("-.2", .1, null) is "-0.3"
+PASS stepDown("-1.", .1, null) is "-1.1"
+PASS stepDown("-2.", .1, null) is "-2.1"
+
</ins><span class="cx"> Extra arguments
</span><span class="cx"> PASS input.value = "0"; input.min = null; input.step = null; input.stepUp(1, 2); input.value is "1"
</span><span class="cx"> PASS input.value = "1"; input.stepDown(1, 3); input.value is "0"
</span><ins>+
</ins><span class="cx"> Invalid step value
</span><span class="cx"> PASS stepUp("0", "foo", null) is "1"
</span><span class="cx"> PASS stepUp("1", "0", null) is "2"
</span><span class="cx"> PASS stepUp("2", "-1", null) is "3"
</span><ins>+
</ins><span class="cx"> Step=any
</span><span class="cx"> PASS stepUp("0", "any", null) threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="cx"> PASS stepDown("0", "any", null) threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> Step=any corner case
</span><span class="cx"> PASS stepUpExplicitBounds("0", "100", "any", "1.5", "1") threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="cx"> PASS stepDownExplicitBounds("0", "100", "any", "1.5", "1") threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> Overflow/underflow
</span><span class="cx"> PASS stepDown("1", "1", "0") is "0"
</span><span class="cx"> PASS stepDown("0", "1", "0") threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="lines">@@ -45,21 +150,25 @@
</span><span class="cx"> PASS stepUp("-1", "1", "0", 2) threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="cx"> PASS input.value is "-1"
</span><span class="cx"> PASS stepUp("1", "3.40282346e+38", "", 2) threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> stepDown()/stepUp() for stepMismatch values
</span><span class="cx"> PASS stepUp("1", "2", "") is "3"
</span><span class="cx"> PASS input.stepDown(); input.value is "1"
</span><span class="cx"> PASS input.min = "0"; stepUp("9", "10", "", 9) is "99"
</span><span class="cx"> PASS stepDown("19", "10", "0") is "9"
</span><span class="cx"> PASS stepUp("89", "10", "99") is "99"
</span><ins>+
</ins><span class="cx"> Huge value and small step
</span><span class="cx"> PASS input.min = ""; stepUp("1e+38", "1", "", 999999) is "1e+38"
</span><span class="cx"> PASS input.max = ""; stepDown("1e+38", "1", "", 999999) is "1e+38"
</span><ins>+
</ins><span class="cx"> Fractional numbers
</span><span class="cx"> PASS input.min = ""; stepUp("0", "0.33333333333333333", "", 3) is "1"
</span><span class="cx"> PASS stepUp("1", "0.1", "", 10) is "2"
</span><span class="cx"> PASS input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value is "3"
</span><span class="cx"> PASS input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255) is "1"
</span><span class="cx"> PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0"
</span><ins>+
</ins><span class="cx"> Rounding
</span><span class="cx"> PASS stepUp("5.005", "0.005", "", 2) is "5.015"
</span><span class="cx"> PASS stepUp("5.005", "0.005", "", 11) is "5.06"
</span><span class="lines">@@ -67,6 +176,7 @@
</span><span class="cx"> PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 2) is "5.015"
</span><span class="cx"> PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 11) is "5.06"
</span><span class="cx"> PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 12) is "5.065"
</span><ins>+
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsnumbernumberstepupstepdownfromrendererexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx">
</span><span class="cx"> Number type
</span><span class="cx"> Function arguments are (value, step, {min or max}, [stepCount]).
</span><ins>+
</ins><span class="cx"> Invalid value
</span><span class="cx"> PASS stepUp("", null, null) is "1"
</span><span class="cx"> PASS stepDown("", null, null) is "-1"
</span><span class="lines">@@ -18,6 +19,7 @@
</span><span class="cx"> PASS stepDown("foo", "any", null) is "-1"
</span><span class="cx"> PASS stepUp("foo", "foo", null) is "1"
</span><span class="cx"> PASS stepDown("foo", "foo", null) is "-1"
</span><ins>+
</ins><span class="cx"> Normal cases
</span><span class="cx"> PASS stepUp("0", null, null) is "1"
</span><span class="cx"> PASS stepUp("1", null, null, 2) is "3"
</span><span class="lines">@@ -25,16 +27,116 @@
</span><span class="cx"> PASS stepDown("2", null, null) is "1"
</span><span class="cx"> PASS stepDown("1", null, null, 2) is "-1"
</span><span class="cx"> PASS stepDown("-1", null, null, -1) is "0"
</span><ins>+
+Fractional cases
+PASS stepUp("0.1", 1, null) is "1"
+PASS stepUp("0.2", 1, null) is "1"
+PASS stepUp("1.0", 1, null) is "2"
+PASS stepUp("1.1", 1, null) is "2"
+PASS stepUp("1.2", 1, null) is "2"
+PASS stepUp("2.0", 1, null) is "3"
+
+PASS stepUp("-0.1", 1, null) is "0"
+PASS stepUp("-0.2", 1, null) is "0"
+PASS stepUp("-1.0", 1, null) is "0"
+PASS stepUp("-1.1", 1, null) is "-1"
+PASS stepUp("-1.2", 1, null) is "-1"
+PASS stepUp("-2.0", 1, null) is "-1"
+
+PASS stepDown("0.1", 1, null) is "0"
+PASS stepDown("0.2", 1, null) is "0"
+PASS stepDown("1.0", 1, null) is "0"
+PASS stepDown("1.1", 1, null) is "1"
+PASS stepDown("1.2", 1, null) is "1"
+PASS stepDown("2.0", 1, null) is "1"
+
+PASS stepDown("-0.1", 1, null) is "-1"
+PASS stepDown("-0.2", 1, null) is "-1"
+PASS stepDown("-1.0", 1, null) is "-2"
+PASS stepDown("-1.1", 1, null) is "-2"
+PASS stepDown("-1.2", 1, null) is "-2"
+PASS stepDown("-2.0", 1, null) is "-3"
+
+PASS stepUp(".1", 1, null) is "1"
+PASS stepUp(".2", 1, null) is "1"
+PASS stepUp("1.", 1, null) is "2"
+PASS stepUp("2.", 1, null) is "3"
+
+PASS stepUp("-.1", 1, null) is "0"
+PASS stepUp("-.2", 1, null) is "0"
+PASS stepUp("-1.", 1, null) is "0"
+PASS stepUp("-2.", 1, null) is "-1"
+
+PASS stepDown(".1", 1, null) is "0"
+PASS stepDown(".2", 1, null) is "0"
+PASS stepDown("1.", 1, null) is "0"
+PASS stepDown("2.", 1, null) is "1"
+
+PASS stepDown("-.1", 1, null) is "-1"
+PASS stepDown("-.2", 1, null) is "-1"
+PASS stepDown("-1.", 1, null) is "-2"
+PASS stepDown("-2.", 1, null) is "-3"
+
+PASS stepUp("0.1", .1, null) is "0.2"
+PASS stepUp("0.2", .1, null) is "0.3"
+PASS stepUp("1.0", .1, null) is "1.1"
+PASS stepUp("1.1", .1, null) is "1.2"
+PASS stepUp("1.2", .1, null) is "1.3"
+PASS stepUp("2.0", .1, null) is "2.1"
+
+PASS stepUp("-0.1", .1, null) is "0"
+PASS stepUp("-0.2", .1, null) is "-0.1"
+PASS stepUp("-1.0", .1, null) is "-0.9"
+PASS stepUp("-1.1", .1, null) is "-1"
+PASS stepUp("-1.2", .1, null) is "-1.1"
+PASS stepUp("-2.0", .1, null) is "-1.9"
+
+PASS stepDown("0.1", .1, null) is "0"
+PASS stepDown("0.2", .1, null) is "0.1"
+PASS stepDown("1.0", .1, null) is "0.9"
+PASS stepDown("1.1", .1, null) is "1"
+PASS stepDown("1.2", .1, null) is "1.1"
+PASS stepDown("2.0", .1, null) is "1.9"
+
+PASS stepDown("-0.1", .1, null) is "-0.2"
+PASS stepDown("-0.2", .1, null) is "-0.3"
+PASS stepDown("-1.0", .1, null) is "-1.1"
+PASS stepDown("-1.1", .1, null) is "-1.2"
+PASS stepDown("-1.2", .1, null) is "-1.3"
+PASS stepDown("-2.0", .1, null) is "-2.1"
+
+PASS stepUp(".1", .1, null) is "0.2"
+PASS stepUp(".2", .1, null) is "0.3"
+PASS stepUp("1.", .1, null) is "1.1"
+PASS stepUp("2.", .1, null) is "2.1"
+
+PASS stepUp("-.1", .1, null) is "0"
+PASS stepUp("-.2", .1, null) is "-0.1"
+PASS stepUp("-1.", .1, null) is "-0.9"
+PASS stepUp("-2.", .1, null) is "-1.9"
+PASS stepDown(".1", .1, null) is "0"
+PASS stepDown(".2", .1, null) is "0.1"
+PASS stepDown("1.", .1, null) is "0.9"
+PASS stepDown("2.", .1, null) is "1.9"
+
+PASS stepDown("-.1", .1, null) is "-0.2"
+PASS stepDown("-.2", .1, null) is "-0.3"
+PASS stepDown("-1.", .1, null) is "-1.1"
+PASS stepDown("-2.", .1, null) is "-2.1"
+
</ins><span class="cx"> Invalid step value
</span><span class="cx"> PASS stepUp("0", "foo", null) is "1"
</span><span class="cx"> PASS stepUp("1", "0", null) is "2"
</span><span class="cx"> PASS stepUp("2", "-1", null) is "3"
</span><ins>+
</ins><span class="cx"> Step=any
</span><span class="cx"> PASS stepUp("0", "any", null) is "1"
</span><span class="cx"> PASS stepDown("0", "any", null) is "-1"
</span><ins>+
</ins><span class="cx"> Step=any corner case
</span><span class="cx"> PASS stepUpExplicitBounds("0", "100", "any", "1.5", "1") is "2.5"
</span><span class="cx"> PASS stepDownExplicitBounds("0", "100", "any", "1.5", "1") is "0.5"
</span><ins>+
</ins><span class="cx"> Overflow/underflow
</span><span class="cx"> PASS stepDown("1", "1", "0") is "0"
</span><span class="cx"> PASS stepDown("0", "1", "0") is "0"
</span><span class="lines">@@ -44,6 +146,7 @@
</span><span class="cx"> PASS stepUp("0", "1", "0") is "0"
</span><span class="cx"> PASS stepUp("-1", "1", "0", 2) is "0"
</span><span class="cx"> PASS stepUp("1", "3.40282346e+38", "", 2) is "3.40282346e+38"
</span><ins>+
</ins><span class="cx"> stepDown()/stepUp() for stepMismatch values
</span><span class="cx"> PASS stepUp("1", "2", "") is "2"
</span><span class="cx"> PASS input.min = "0"; stepUp("9", "10", "") is "10"
</span><span class="lines">@@ -53,13 +156,16 @@
</span><span class="cx"> PASS stepUp("-7", "300", "") is "0"
</span><span class="cx"> PASS stepDown("7", "300", "") is "0"
</span><span class="cx"> PASS stepDown("-7", "300", "") is "-300"
</span><ins>+
</ins><span class="cx"> Huge value and small step
</span><span class="cx"> PASS input.min = ""; stepUp("1e+38", "1", "", 999) is "1e+38"
</span><span class="cx"> PASS input.max = ""; stepDown("1e+38", "1", "", 999) is "1e+38"
</span><ins>+
</ins><span class="cx"> Fractional numbers
</span><span class="cx"> PASS input.min = ""; stepUp("0", "0.33333333333333333", "", 3) is "1"
</span><span class="cx"> PASS stepUp("1", "0.1", "", 10) is "2"
</span><span class="cx"> PASS input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255) is "1"
</span><ins>+
</ins><span class="cx"> Rounding
</span><span class="cx"> PASS stepUp("5.005", "0.005", "", 2) is "5.015"
</span><span class="cx"> PASS stepUp("5.005", "0.005", "", 11) is "5.06"
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsnumbernumberstepupstepdownfromrendererhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx"> debug('Number type');
</span><span class="cx"> input.type = 'number';
</span><span class="cx"> debug('Function arguments are (value, step, {min or max}, [stepCount]).');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Invalid value');
</span><span class="cx"> shouldBe('stepUp("", null, null)', '"1"');
</span><span class="cx"> shouldBe('stepDown("", null, null)', '"-1"');
</span><span class="lines">@@ -100,6 +102,8 @@
</span><span class="cx"> shouldBe('stepDown("foo", "any", null)', '"-1"');
</span><span class="cx"> shouldBe('stepUp("foo", "foo", null)', '"1"');
</span><span class="cx"> shouldBe('stepDown("foo", "foo", null)', '"-1"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Normal cases');
</span><span class="cx"> shouldBe('stepUp("0", null, null)', '"1"');
</span><span class="cx"> shouldBe('stepUp("1", null, null, 2)', '"3"');
</span><span class="lines">@@ -107,16 +111,160 @@
</span><span class="cx"> shouldBe('stepDown("2", null, null)', '"1"');
</span><span class="cx"> shouldBe('stepDown("1", null, null, 2)', '"-1"');
</span><span class="cx"> shouldBe('stepDown("-1", null, null, -1)', '"0"');
</span><ins>+
+debug('');
+debug('Fractional cases')
+
+// Note: these tests also appear in number-stepup-stepdown.html. However, the
+// results here differ from the results there. According to:
+//
+// https://html.spec.whatwg.org/multipage/forms.html#number-state-(type=number)
+//
+// The browser is allowed to clamp resulting values to the nearest multiple of
+// the [step] value:
+//
+// When the element is suffering from a step mismatch, the user agent may
+// round the element's value to the nearest number for which the element
+// would not suffer from a step mismatch. If there are two such numbers,
+// user agents are encouraged to pick the one nearest positive infinity.
+//
+// WebKit seesm to perform this clamping when stepping from the UI, but not
+// from the API.
+//
+// See also the function comment for InputType::stepUpFromRenderer.
+
+// Base/model/template tests
+shouldBe('stepUp("0.1", 1, null)', '"1"') // Is 1.1 in non-render test
+shouldBe('stepUp("0.2", 1, null)', '"1"'); // Is 1.1 in non-render test
+shouldBe('stepUp("1.0", 1, null)', '"2"');
+shouldBe('stepUp("1.1", 1, null)', '"2"'); // Is 2.1 in non-render test
+shouldBe('stepUp("1.2", 1, null)', '"2"'); // Is 2.2 in non-render test
+shouldBe('stepUp("2.0", 1, null)', '"3"');
+
+debug('');
+// Same as above, but with negative numbers.
+shouldBe('stepUp("-0.1", 1, null)', '"0"'); // Is 0.9 in non-render test
+shouldBe('stepUp("-0.2", 1, null)', '"0"'); // Is 0.8 in non-render test
+shouldBe('stepUp("-1.0", 1, null)', '"0"');
+shouldBe('stepUp("-1.1", 1, null)', '"-1"'); // Is -0.1 in non-render test
+shouldBe('stepUp("-1.2", 1, null)', '"-1"'); // Is -0.2 in non-render test
+shouldBe('stepUp("-2.0", 1, null)', '"-1"');
+
+debug('');
+// Same as above, but stepping down rather than up.
+shouldBe('stepDown("0.1", 1, null)', '"0"'); // Is -0.9 in non-render test
+shouldBe('stepDown("0.2", 1, null)', '"0"'); // Is -0.8 in non-render test
+shouldBe('stepDown("1.0", 1, null)', '"0"');
+shouldBe('stepDown("1.1", 1, null)', '"1"'); // Is 0.1 in non-render test
+shouldBe('stepDown("1.2", 1, null)', '"1"'); // Is 0.2 in non-render test
+shouldBe('stepDown("2.0", 1, null)', '"1"');
+
+debug('');
+shouldBe('stepDown("-0.1", 1, null)', '"-1"'); // Is -1.1 in non-render test
+shouldBe('stepDown("-0.2", 1, null)', '"-1"'); // Is -1.2 in non-render test
+shouldBe('stepDown("-1.0", 1, null)', '"-2"');
+shouldBe('stepDown("-1.1", 1, null)', '"-2"'); // Is -2.1 in non-render test
+shouldBe('stepDown("-1.2", 1, null)', '"-2"'); // Is -2.2 in non-render test
+shouldBe('stepDown("-2.0", 1, null)', '"-3"');
+
+// Same as above, but with leading/trailing zeros removed.
+debug('');
+shouldBe('stepUp(".1", 1, null)', '"1"'); // Is 1.1 in non-render test
+shouldBe('stepUp(".2", 1, null)', '"1"'); // Is 1.2 in non-render test
+shouldBe('stepUp("1.", 1, null)', '"2"');
+shouldBe('stepUp("2.", 1, null)', '"3"');
+
+debug('');
+shouldBe('stepUp("-.1", 1, null)', '"0"'); // Is 0.9 in non-render test
+shouldBe('stepUp("-.2", 1, null)', '"0"'); // Is 0.8 in non-render test
+shouldBe('stepUp("-1.", 1, null)', '"0"');
+shouldBe('stepUp("-2.", 1, null)', '"-1"');
+
+debug('');
+shouldBe('stepDown(".1", 1, null)', '"0"'); // Is -0.9 in non-render test
+shouldBe('stepDown(".2", 1, null)', '"0"'); // Is -0.8 in non-render test
+shouldBe('stepDown("1.", 1, null)', '"0"');
+shouldBe('stepDown("2.", 1, null)', '"1"');
+
+debug('');
+shouldBe('stepDown("-.1", 1, null)', '"-1"'); // Is -1.1 in non-render test
+shouldBe('stepDown("-.2", 1, null)', '"-1"'); // Is -1.2 in non-render test
+shouldBe('stepDown("-1.", 1, null)', '"-2"');
+shouldBe('stepDown("-2.", 1, null)', '"-3"');
+
+// Same as above, but stepping by .1 rather than 1.
+debug('');
+shouldBe('stepUp("0.1", .1, null)', '"0.2"');
+shouldBe('stepUp("0.2", .1, null)', '"0.3"');
+shouldBe('stepUp("1.0", .1, null)', '"1.1"');
+shouldBe('stepUp("1.1", .1, null)', '"1.2"');
+shouldBe('stepUp("1.2", .1, null)', '"1.3"');
+shouldBe('stepUp("2.0", .1, null)', '"2.1"');
+
+debug('');
+shouldBe('stepUp("-0.1", .1, null)', '"0"');
+shouldBe('stepUp("-0.2", .1, null)', '"-0.1"');
+shouldBe('stepUp("-1.0", .1, null)', '"-0.9"');
+shouldBe('stepUp("-1.1", .1, null)', '"-1"');
+shouldBe('stepUp("-1.2", .1, null)', '"-1.1"');
+shouldBe('stepUp("-2.0", .1, null)', '"-1.9"');
+
+debug('');
+shouldBe('stepDown("0.1", .1, null)', '"0"');
+shouldBe('stepDown("0.2", .1, null)', '"0.1"');
+shouldBe('stepDown("1.0", .1, null)', '"0.9"');
+shouldBe('stepDown("1.1", .1, null)', '"1"');
+shouldBe('stepDown("1.2", .1, null)', '"1.1"');
+shouldBe('stepDown("2.0", .1, null)', '"1.9"');
+
+debug('');
+shouldBe('stepDown("-0.1", .1, null)', '"-0.2"');
+shouldBe('stepDown("-0.2", .1, null)', '"-0.3"');
+shouldBe('stepDown("-1.0", .1, null)', '"-1.1"');
+shouldBe('stepDown("-1.1", .1, null)', '"-1.2"');
+shouldBe('stepDown("-1.2", .1, null)', '"-1.3"');
+shouldBe('stepDown("-2.0", .1, null)', '"-2.1"');
+
+debug('');
+shouldBe('stepUp(".1", .1, null)', '"0.2"');
+shouldBe('stepUp(".2", .1, null)', '"0.3"');
+shouldBe('stepUp("1.", .1, null)', '"1.1"');
+shouldBe('stepUp("2.", .1, null)', '"2.1"');
+
+debug('');
+shouldBe('stepUp("-.1", .1, null)', '"0"');
+shouldBe('stepUp("-.2", .1, null)', '"-0.1"');
+shouldBe('stepUp("-1.", .1, null)', '"-0.9"');
+shouldBe('stepUp("-2.", .1, null)', '"-1.9"');
+
+shouldBe('stepDown(".1", .1, null)', '"0"');
+shouldBe('stepDown(".2", .1, null)', '"0.1"');
+shouldBe('stepDown("1.", .1, null)', '"0.9"');
+shouldBe('stepDown("2.", .1, null)', '"1.9"');
+
+debug('');
+shouldBe('stepDown("-.1", .1, null)', '"-0.2"');
+shouldBe('stepDown("-.2", .1, null)', '"-0.3"');
+shouldBe('stepDown("-1.", .1, null)', '"-1.1"');
+shouldBe('stepDown("-2.", .1, null)', '"-2.1"');
+
+debug('');
</ins><span class="cx"> debug('Invalid step value');
</span><span class="cx"> shouldBe('stepUp("0", "foo", null)', '"1"');
</span><span class="cx"> shouldBe('stepUp("1", "0", null)', '"2"');
</span><span class="cx"> shouldBe('stepUp("2", "-1", null)', '"3"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Step=any');
</span><span class="cx"> shouldBe('stepUp("0", "any", null)', '"1"');
</span><span class="cx"> shouldBe('stepDown("0", "any", null)', '"-1"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Step=any corner case');
</span><span class="cx"> shouldBe('stepUpExplicitBounds("0", "100", "any", "1.5", "1")', '"2.5"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds("0", "100", "any", "1.5", "1")', '"0.5"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Overflow/underflow');
</span><span class="cx"> shouldBe('stepDown("1", "1", "0")', '"0"');
</span><span class="cx"> shouldBe('stepDown("0", "1", "0")', '"0"');
</span><span class="lines">@@ -126,6 +274,8 @@
</span><span class="cx"> shouldBe('stepUp("0", "1", "0")', '"0"');
</span><span class="cx"> shouldBe('stepUp("-1", "1", "0", 2)', '"0"');
</span><span class="cx"> shouldBe('stepUp("1", "3.40282346e+38", "", 2)', '"3.40282346e+38"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('stepDown()/stepUp() for stepMismatch values');
</span><span class="cx"> shouldBe('stepUp("1", "2", "")', '"2"');
</span><span class="cx"> shouldBe('input.min = "0"; stepUp("9", "10", "")', '"10"');
</span><span class="lines">@@ -135,13 +285,19 @@
</span><span class="cx"> shouldBe('stepUp("-7", "300", "")', '"0"');
</span><span class="cx"> shouldBe('stepDown("7", "300", "")', '"0"');
</span><span class="cx"> shouldBe('stepDown("-7", "300", "")', '"-300"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Huge value and small step');
</span><span class="cx"> shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999)', '"1e+38"');
</span><span class="cx"> shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999)', '"1e+38"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Fractional numbers');
</span><span class="cx"> shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"');
</span><span class="cx"> shouldBe('stepUp("1", "0.1", "", 10)', '"2"');
</span><span class="cx"> shouldBe('input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255)', '"1"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Rounding');
</span><span class="cx"> shouldBe('stepUp("5.005", "0.005", "", 2)', '"5.015"');
</span><span class="cx"> shouldBe('stepUp("5.005", "0.005", "", 11)', '"5.06"');
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsnumbernumberstepupstepdownhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -55,9 +55,13 @@
</span><span class="cx">
</span><span class="cx"> debug('Number type');
</span><span class="cx"> input.type = 'number';
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Invalid value');
</span><span class="cx"> shouldThrow('stepUp("", null, null)', invalidStateErr);
</span><span class="cx"> shouldThrow('stepDown("", null, null)', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Non-number arguments');
</span><span class="cx"> shouldBe('stepUp("0", null, null, "0")', '"0"');
</span><span class="cx"> shouldBe('stepDown("0", null, null, "0")', '"0"');
</span><span class="lines">@@ -65,6 +69,8 @@
</span><span class="cx"> shouldBe('stepDown("0", null, null, "foo")', '"0"');
</span><span class="cx"> shouldBe('stepUp("0", null, null, null)', '"0"');
</span><span class="cx"> shouldBe('stepDown("0", null, null, null)', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Normal cases');
</span><span class="cx"> shouldBe('stepUp("0", null, null)', '"1"');
</span><span class="cx"> shouldBe('stepUp("1", null, null, 2)', '"3"');
</span><span class="lines">@@ -72,19 +78,147 @@
</span><span class="cx"> shouldBe('stepDown("2", null, null)', '"1"');
</span><span class="cx"> shouldBe('stepDown("1", null, null, 2)', '"-1"');
</span><span class="cx"> shouldBe('stepDown("-1", null, null, -1)', '"0"');
</span><ins>+
+debug('');
+debug('Fractional cases')
+// Base/model/template tests
+shouldBe('stepUp("0.1", 1, null)', '"1.1"');
+shouldBe('stepUp("0.2", 1, null)', '"1.2"');
+shouldBe('stepUp("1.0", 1, null)', '"2"');
+shouldBe('stepUp("1.1", 1, null)', '"2.1"');
+shouldBe('stepUp("1.2", 1, null)', '"2.2"');
+shouldBe('stepUp("2.0", 1, null)', '"3"');
+
+// Same as above, but with negative numbers.
+debug('');
+shouldBe('stepUp("-0.1", 1, null)', '"0.9"');
+shouldBe('stepUp("-0.2", 1, null)', '"0.8"');
+shouldBe('stepUp("-1.0", 1, null)', '"0"');
+shouldBe('stepUp("-1.1", 1, null)', '"-0.1"');
+shouldBe('stepUp("-1.2", 1, null)', '"-0.2"');
+shouldBe('stepUp("-2.0", 1, null)', '"-1"');
+
+// Same as above, but stepping down rather than up.
+debug('');
+shouldBe('stepDown("0.1", 1, null)', '"-0.9"');
+shouldBe('stepDown("0.2", 1, null)', '"-0.8"');
+shouldBe('stepDown("1.0", 1, null)', '"0"');
+shouldBe('stepDown("1.1", 1, null)', '"0.1"');
+shouldBe('stepDown("1.2", 1, null)', '"0.2"');
+shouldBe('stepDown("2.0", 1, null)', '"1"');
+
+debug('');
+shouldBe('stepDown("-0.1", 1, null)', '"-1.1"');
+shouldBe('stepDown("-0.2", 1, null)', '"-1.2"');
+shouldBe('stepDown("-1.0", 1, null)', '"-2"');
+shouldBe('stepDown("-1.1", 1, null)', '"-2.1"');
+shouldBe('stepDown("-1.2", 1, null)', '"-2.2"');
+shouldBe('stepDown("-2.0", 1, null)', '"-3"');
+
+// Same as above, but with leading/trailing zeros removed.
+debug('');
+shouldBe('stepUp(".1", 1, null)', '"1.1"');
+shouldBe('stepUp(".2", 1, null)', '"1.2"');
+shouldBe('stepUp("1.", 1, null)', '"2"');
+shouldBe('stepUp("2.", 1, null)', '"3"');
+
+debug('');
+shouldBe('stepUp("-.1", 1, null)', '"0.9"');
+shouldBe('stepUp("-.2", 1, null)', '"0.8"');
+shouldBe('stepUp("-1.", 1, null)', '"0"');
+shouldBe('stepUp("-2.", 1, null)', '"-1"');
+
+debug('');
+shouldBe('stepDown(".1", 1, null)', '"-0.9"');
+shouldBe('stepDown(".2", 1, null)', '"-0.8"');
+shouldBe('stepDown("1.", 1, null)', '"0"');
+shouldBe('stepDown("2.", 1, null)', '"1"');
+
+debug('');
+shouldBe('stepDown("-.1", 1, null)', '"-1.1"');
+shouldBe('stepDown("-.2", 1, null)', '"-1.2"');
+shouldBe('stepDown("-1.", 1, null)', '"-2"');
+shouldBe('stepDown("-2.", 1, null)', '"-3"');
+
+// Same as above, but stepping by .1 rather than 1.
+debug('');
+shouldBe('stepUp("0.1", .1, null)', '"0.2"');
+shouldBe('stepUp("0.2", .1, null)', '"0.3"');
+shouldBe('stepUp("1.0", .1, null)', '"1.1"');
+shouldBe('stepUp("1.1", .1, null)', '"1.2"');
+shouldBe('stepUp("1.2", .1, null)', '"1.3"');
+shouldBe('stepUp("2.0", .1, null)', '"2.1"');
+
+debug('');
+shouldBe('stepUp("-0.1", .1, null)', '"0"');
+shouldBe('stepUp("-0.2", .1, null)', '"-0.1"');
+shouldBe('stepUp("-1.0", .1, null)', '"-0.9"');
+shouldBe('stepUp("-1.1", .1, null)', '"-1"');
+shouldBe('stepUp("-1.2", .1, null)', '"-1.1"');
+shouldBe('stepUp("-2.0", .1, null)', '"-1.9"');
+
+debug('');
+shouldBe('stepDown("0.1", .1, null)', '"0"');
+shouldBe('stepDown("0.2", .1, null)', '"0.1"');
+shouldBe('stepDown("1.0", .1, null)', '"0.9"');
+shouldBe('stepDown("1.1", .1, null)', '"1"');
+shouldBe('stepDown("1.2", .1, null)', '"1.1"');
+shouldBe('stepDown("2.0", .1, null)', '"1.9"');
+
+debug('');
+shouldBe('stepDown("-0.1", .1, null)', '"-0.2"');
+shouldBe('stepDown("-0.2", .1, null)', '"-0.3"');
+shouldBe('stepDown("-1.0", .1, null)', '"-1.1"');
+shouldBe('stepDown("-1.1", .1, null)', '"-1.2"');
+shouldBe('stepDown("-1.2", .1, null)', '"-1.3"');
+shouldBe('stepDown("-2.0", .1, null)', '"-2.1"');
+
+debug('');
+shouldBe('stepUp(".1", .1, null)', '"0.2"');
+shouldBe('stepUp(".2", .1, null)', '"0.3"');
+shouldBe('stepUp("1.", .1, null)', '"1.1"');
+shouldBe('stepUp("2.", .1, null)', '"2.1"');
+
+debug('');
+shouldBe('stepUp("-.1", .1, null)', '"0"');
+shouldBe('stepUp("-.2", .1, null)', '"-0.1"');
+shouldBe('stepUp("-1.", .1, null)', '"-0.9"');
+shouldBe('stepUp("-2.", .1, null)', '"-1.9"');
+
+debug('');
+shouldBe('stepDown(".1", .1, null)', '"0"');
+shouldBe('stepDown(".2", .1, null)', '"0.1"');
+shouldBe('stepDown("1.", .1, null)', '"0.9"');
+shouldBe('stepDown("2.", .1, null)', '"1.9"');
+
+debug('');
+shouldBe('stepDown("-.1", .1, null)', '"-0.2"');
+shouldBe('stepDown("-.2", .1, null)', '"-0.3"');
+shouldBe('stepDown("-1.", .1, null)', '"-1.1"');
+shouldBe('stepDown("-2.", .1, null)', '"-2.1"');
+
+debug('');
</ins><span class="cx"> debug('Extra arguments');
</span><span class="cx"> shouldBe('input.value = "0"; input.min = null; input.step = null; input.stepUp(1, 2); input.value', '"1"');
</span><span class="cx"> shouldBe('input.value = "1"; input.stepDown(1, 3); input.value', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Invalid step value');
</span><span class="cx"> shouldBe('stepUp("0", "foo", null)', '"1"');
</span><span class="cx"> shouldBe('stepUp("1", "0", null)', '"2"');
</span><span class="cx"> shouldBe('stepUp("2", "-1", null)', '"3"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Step=any');
</span><span class="cx"> shouldThrow('stepUp("0", "any", null)', invalidStateErr);
</span><span class="cx"> shouldThrow('stepDown("0", "any", null)', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Step=any corner case');
</span><span class="cx"> shouldThrow('stepUpExplicitBounds("0", "100", "any", "1.5", "1")', invalidStateErr);
</span><span class="cx"> shouldThrow('stepDownExplicitBounds("0", "100", "any", "1.5", "1")', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Overflow/underflow');
</span><span class="cx"> shouldBe('stepDown("1", "1", "0")', '"0"');
</span><span class="cx"> shouldThrow('stepDown("0", "1", "0")', invalidStateErr);
</span><span class="lines">@@ -96,21 +230,29 @@
</span><span class="cx"> shouldThrow('stepUp("-1", "1", "0", 2)', invalidStateErr);
</span><span class="cx"> shouldBe('input.value', '"-1"');
</span><span class="cx"> shouldThrow('stepUp("1", "3.40282346e+38", "", 2)', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('stepDown()/stepUp() for stepMismatch values');
</span><span class="cx"> shouldBe('stepUp("1", "2", "")', '"3"');
</span><span class="cx"> shouldBe('input.stepDown(); input.value', '"1"');
</span><span class="cx"> shouldBe('input.min = "0"; stepUp("9", "10", "", 9)', '"99"');
</span><span class="cx"> shouldBe('stepDown("19", "10", "0")', '"9"');
</span><span class="cx"> shouldBe('stepUp("89", "10", "99")', '"99"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Huge value and small step');
</span><span class="cx"> shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999999)', '"1e+38"');
</span><span class="cx"> shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999999)', '"1e+38"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Fractional numbers');
</span><span class="cx"> shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"');
</span><span class="cx"> shouldBe('stepUp("1", "0.1", "", 10)', '"2"');
</span><span class="cx"> shouldBe('input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value', '"3"');
</span><span class="cx"> shouldBe('input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255)', '"1"');
</span><span class="cx"> shouldBe('for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Rounding');
</span><span class="cx"> shouldBe('stepUp("5.005", "0.005", "", 2)', '"5.015"');
</span><span class="cx"> shouldBe('stepUp("5.005", "0.005", "", 11)', '"5.06"');
</span><span class="lines">@@ -118,6 +260,8 @@
</span><span class="cx"> shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 2)', '"5.015"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 11)', '"5.06"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 12)', '"5.065"');
</span><ins>+
+debug('');
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsrangeinputappearancerangedecimalsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals-expected.html (0 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals-expected.html        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+<!DOCTYPE html>
+<body>
+<input type=range value="0.4" min="-0.4" max="1.0">
+<body>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsrangeinputappearancerangedecimalshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals.html (0 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals.html         (rev 0)
+++ trunk/LayoutTests/fast/forms/range/input-appearance-range-decimals.html        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+<!DOCTYPE html>
+<body>
+<!-- These numbers should parse the same as 0.4, -0.4, and 1.0 -->
+<input type=range value=".4" min="-.4" max="1.">
+<body>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsrangerangestepupstepdownexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx"> Using the default values
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "") is "51"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, null, "") is "49"
</span><ins>+
</ins><span class="cx"> Non-number arguments (stepCount)
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "0", "0") is "0"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, null, "0", "0") is "0"
</span><span class="lines">@@ -14,6 +15,7 @@
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, null, "0", "foo") is "0"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "0", null) is "0"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, null, "0", null) is "0"
</span><ins>+
</ins><span class="cx"> Normal cases
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "0") is "1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "1", 2) is "3"
</span><span class="lines">@@ -21,9 +23,108 @@
</span><span class="cx"> PASS stepDownExplicitBounds("-100", null, null, "2") is "1"
</span><span class="cx"> PASS stepDownExplicitBounds("-100", null, null, "1", 2) is "-1"
</span><span class="cx"> PASS stepDownExplicitBounds("-100", null, null, "-1", -1) is "0"
</span><ins>+
+Fractional cases
+PASS stepUpExplicitBounds(-10, 10, 1, "0.1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "0.2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.0") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.1") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.2") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "2.0") is "3"
+
+PASS stepUpExplicitBounds(-10, 10, 1, "-0.1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-0.2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.0") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.1") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.2") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-2.0") is "-1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, "0.1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "0.2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.0") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.1") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.2") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "2.0") is "1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, "-0.1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-0.2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.0") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.1") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.2") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-2.0") is "-3"
+
+PASS stepUpExplicitBounds(-10, 10, 1, ".1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, ".2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "2.") is "3"
+
+PASS stepUpExplicitBounds(-10, 10, 1, "-.1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-.2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-2.") is "-1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, ".1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, ".2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "2.") is "1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, "-.1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-.2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-2.") is "-3"
+
+PASS stepUpExplicitBounds(-10, 10, .1, "0.1") is "0.2"
+PASS stepUpExplicitBounds(-10, 10, .1, "0.2") is "0.3"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.0") is "1.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.1") is "1.2"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.2") is "1.3"
+PASS stepUpExplicitBounds(-10, 10, .1, "2.0") is "2.1"
+
+PASS stepUpExplicitBounds(-10, 10, .1, "-0.1") is "0"
+PASS stepUpExplicitBounds(-10, 10, .1, "-0.2") is "-0.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.0") is "-0.9"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.1") is "-1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.2") is "-1.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-2.0") is "-1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, "0.1") is "0"
+PASS stepDownExplicitBounds(-10, 10, .1, "0.2") is "0.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.0") is "0.9"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.1") is "1"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.2") is "1.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "2.0") is "1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, "-0.1") is "-0.2"
+PASS stepDownExplicitBounds(-10, 10, .1, "-0.2") is "-0.3"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.0") is "-1.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.1") is "-1.2"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.2") is "-1.3"
+PASS stepDownExplicitBounds(-10, 10, .1, "-2.0") is "-2.1"
+
+PASS stepUpExplicitBounds(-10, 10, .1, ".1") is "0.2"
+PASS stepUpExplicitBounds(-10, 10, .1, ".2") is "0.3"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.") is "1.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "2.") is "2.1"
+
+PASS stepUpExplicitBounds(-10, 10, .1, "-.1") is "0"
+PASS stepUpExplicitBounds(-10, 10, .1, "-.2") is "-0.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.") is "-0.9"
+PASS stepUpExplicitBounds(-10, 10, .1, "-2.") is "-1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, ".1") is "0"
+PASS stepDownExplicitBounds(-10, 10, .1, ".2") is "0.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.") is "0.9"
+PASS stepDownExplicitBounds(-10, 10, .1, "2.") is "1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, "-.1") is "-0.2"
+PASS stepDownExplicitBounds(-10, 10, .1, "-.2") is "-0.3"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.") is "-1.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "-2.") is "-2.1"
+
</ins><span class="cx"> Extra arguments
</span><span class="cx"> PASS setInputAttributes(null, null, null, "0"); input.stepUp(1,2); input.value is "1"
</span><span class="cx"> PASS setInputAttributes(null, null, null, "1"); input.stepDown(1,3); input.value is "0"
</span><ins>+
</ins><span class="cx"> Invalid step value
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "foo", "0") is "1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "0", "1") is "2"
</span><span class="lines">@@ -31,9 +132,11 @@
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "foo", "1") is "0"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "0", "2") is "1"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "-1", "3") is "2"
</span><ins>+
</ins><span class="cx"> Step=any
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "any", "1") threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "any", "1") threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> Overflow/underflow
</span><span class="cx"> PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
</span><span class="cx"> PASS stepUpExplicitBounds(null, "100", "1", "100") threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="lines">@@ -51,16 +154,20 @@
</span><span class="cx"> PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) threw exception Error: InvalidStateError: DOM Exception 11.
</span><span class="cx"> PASS input.value is "-1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> stepDown()/stepUp() for stepMismatch values
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
</span><span class="cx"> PASS input.stepDown(); input.value is "2"
</span><span class="cx"> PASS stepUpExplicitBounds(0, null, 10, 9, 9) is "100"
</span><span class="cx"> PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
</span><ins>+
</ins><span class="cx"> value + step is <= max, but rounded result would be > max.
</span><span class="cx"> PASS stepUpExplicitBounds(null, 99, 10, 89) threw exception Error: InvalidStateError: DOM Exception 11.
</span><ins>+
</ins><span class="cx"> Huge value and small step
</span><span class="cx"> PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
</span><span class="cx"> PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
</span><ins>+
</ins><span class="cx"> Fractional numbers
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, 0.1, 1) is "1.1"
</span><span class="lines">@@ -71,6 +178,7 @@
</span><span class="cx"> PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, 0.1, 1, 8) is "0.2"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
</span><ins>+
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsrangerangestepupstepdownfromrendererexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "any", "foo") is "49"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "foo", "foo") is "51"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "foo", "foo") is "49"
</span><ins>+
</ins><span class="cx"> Normal cases
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "0") is "1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, null, "1", 2) is "3"
</span><span class="lines">@@ -24,6 +25,103 @@
</span><span class="cx"> PASS stepDownExplicitBounds("-100", null, null, "2") is "1"
</span><span class="cx"> PASS stepDownExplicitBounds("-100", null, null, "1", 2) is "-1"
</span><span class="cx"> PASS stepDownExplicitBounds("-100", null, null, "-1", -1) is "0"
</span><ins>+
+Fractional cases
+PASS stepUpExplicitBounds(-10, 10, 1, "0.1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "0.2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.0") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.1") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.2") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "2.0") is "3"
+
+PASS stepUpExplicitBounds(-10, 10, 1, "-0.1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-0.2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.0") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.1") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.2") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-2.0") is "-1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, "0.1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "0.2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.0") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.1") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.2") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "2.0") is "1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, "-0.1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-0.2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.0") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.1") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.2") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-2.0") is "-3"
+
+PASS stepUpExplicitBounds(-10, 10, 1, ".1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, ".2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "1.") is "2"
+PASS stepUpExplicitBounds(-10, 10, 1, "2.") is "3"
+
+PASS stepUpExplicitBounds(-10, 10, 1, "-.1") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-.2") is "1"
+PASS stepUpExplicitBounds(-10, 10, 1, "-1.") is "0"
+PASS stepUpExplicitBounds(-10, 10, 1, "-2.") is "-1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, ".1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, ".2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "1.") is "0"
+PASS stepDownExplicitBounds(-10, 10, 1, "2.") is "1"
+
+PASS stepDownExplicitBounds(-10, 10, 1, "-.1") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-.2") is "-1"
+PASS stepDownExplicitBounds(-10, 10, 1, "-1.") is "-2"
+PASS stepDownExplicitBounds(-10, 10, 1, "-2.") is "-3"
+
+PASS stepUpExplicitBounds(-10, 10, .1, "0.1") is "0.2"
+PASS stepUpExplicitBounds(-10, 10, .1, "0.2") is "0.3"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.0") is "1.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.1") is "1.2"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.2") is "1.3"
+PASS stepUpExplicitBounds(-10, 10, .1, "2.0") is "2.1"
+
+PASS stepUpExplicitBounds(-10, 10, .1, "-0.1") is "0"
+PASS stepUpExplicitBounds(-10, 10, .1, "-0.2") is "-0.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.0") is "-0.9"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.1") is "-1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.2") is "-1.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-2.0") is "-1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, "0.1") is "0"
+PASS stepDownExplicitBounds(-10, 10, .1, "0.2") is "0.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.0") is "0.9"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.1") is "1"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.2") is "1.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "2.0") is "1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, "-0.1") is "-0.2"
+PASS stepDownExplicitBounds(-10, 10, .1, "-0.2") is "-0.3"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.0") is "-1.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.1") is "-1.2"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.2") is "-1.3"
+PASS stepDownExplicitBounds(-10, 10, .1, "-2.0") is "-2.1"
+
+PASS stepUpExplicitBounds(-10, 10, .1, ".1") is "0.2"
+PASS stepUpExplicitBounds(-10, 10, .1, ".2") is "0.3"
+PASS stepUpExplicitBounds(-10, 10, .1, "1.") is "1.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "2.") is "2.1"
+
+PASS stepUpExplicitBounds(-10, 10, .1, "-.1") is "0"
+PASS stepUpExplicitBounds(-10, 10, .1, "-.2") is "-0.1"
+PASS stepUpExplicitBounds(-10, 10, .1, "-1.") is "-0.9"
+PASS stepUpExplicitBounds(-10, 10, .1, "-2.") is "-1.9"
+PASS stepDownExplicitBounds(-10, 10, .1, ".1") is "0"
+PASS stepDownExplicitBounds(-10, 10, .1, ".2") is "0.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "1.") is "0.9"
+PASS stepDownExplicitBounds(-10, 10, .1, "2.") is "1.9"
+
+PASS stepDownExplicitBounds(-10, 10, .1, "-.1") is "-0.2"
+PASS stepDownExplicitBounds(-10, 10, .1, "-.2") is "-0.3"
+PASS stepDownExplicitBounds(-10, 10, .1, "-1.") is "-1.1"
+PASS stepDownExplicitBounds(-10, 10, .1, "-2.") is "-2.1"
+
</ins><span class="cx"> Invalid step value
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "foo", "0") is "1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "0", "1") is "2"
</span><span class="lines">@@ -31,9 +129,11 @@
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "foo", "1") is "0"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "0", "2") is "1"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "-1", "3") is "2"
</span><ins>+
</ins><span class="cx"> Step=any
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "any", "1") is "2"
</span><span class="cx"> PASS stepDownExplicitBounds(null, null, "any", "1") is "0"
</span><ins>+
</ins><span class="cx"> Overflow/underflow
</span><span class="cx"> PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
</span><span class="cx"> PASS stepUpExplicitBounds(null, "100", "1", "100") is "100"
</span><span class="lines">@@ -46,15 +146,19 @@
</span><span class="cx"> PASS stepUpExplicitBounds(null, 0, 1, 0) is "0"
</span><span class="cx"> PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) is "0"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", 2) is "0"
</span><ins>+
</ins><span class="cx"> stepDown()/stepUp() for stepMismatch values
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
</span><span class="cx"> PASS stepUpExplicitBounds(0, null, 10, 9, 9) is "100"
</span><span class="cx"> PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
</span><ins>+
</ins><span class="cx"> value + step is <= max, but rounded result would be > max.
</span><span class="cx"> PASS stepUpExplicitBounds(null, 99, 10, 89) is "90"
</span><ins>+
</ins><span class="cx"> Huge value and small step
</span><span class="cx"> PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999) is "1e+38"
</span><span class="cx"> PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999) is "1e+38"
</span><ins>+
</ins><span class="cx"> Fractional numbers
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
</span><span class="cx"> PASS stepUpExplicitBounds(null, null, 0.1, 1) is "1.1"
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsrangerangestepupstepdownfromrendererhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer.html (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer.html        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer.html        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -101,6 +101,8 @@
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "any", "foo")', '"49"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "foo", "foo")', '"51"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "foo", "foo")', '"49"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Normal cases');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "0")', '"1"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "1", 2)', '"3"');
</span><span class="lines">@@ -108,6 +110,134 @@
</span><span class="cx"> shouldBe('stepDownExplicitBounds("-100", null, null, "2")', '"1"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds("-100", null, null, "1", 2)', '"-1"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds("-100", null, null, "-1", -1)', '"0"');
</span><ins>+
+
+debug('');
+debug('Fractional cases')
+// "When the element is suffering from a step mismatch, the user agent must
+// round the element's value to the nearest number for which the element would
+// not suffer from a step mismatch, and which is greater than or equal to the
+// minimum, and, if the maximum is not less than the minimum, which is less
+// than or equal to the maximum, if there is a number that matches these
+// constraints. If two numbers match these constraints, then user agents must
+// use the one nearest to positive infinity.""
+
+// Base/model/template tests
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "0.1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "0.2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.0")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.1")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.2")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "2.0")', '"3"');
+
+// Same as above, but with negative numbers.
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-0.1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-0.2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.0")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.1")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.2")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-2.0")', '"-1"');
+
+// Same as above, but stepping down rather than up.
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "0.1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "0.2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.0")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.1")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.2")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "2.0")', '"1"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-0.1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-0.2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.0")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.1")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.2")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-2.0")', '"-3"');
+
+// Same as above, but with leading/trailing zeros removed.
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, ".1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, ".2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "2.")', '"3"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-.1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-.2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-2.")', '"-1"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, ".1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, ".2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "2.")', '"1"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-.1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-.2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-2.")', '"-3"');
+
+// Same as above, but stepping by .1 rather than 1.
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "0.1")', '"0.2"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "0.2")', '"0.3"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.0")', '"1.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.1")', '"1.2"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.2")', '"1.3"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "2.0")', '"2.1"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-0.1")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-0.2")', '"-0.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.0")', '"-0.9"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.1")', '"-1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.2")', '"-1.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-2.0")', '"-1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "0.1")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "0.2")', '"0.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.0")', '"0.9"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.1")', '"1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.2")', '"1.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "2.0")', '"1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-0.1")', '"-0.2"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-0.2")', '"-0.3"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.0")', '"-1.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.1")', '"-1.2"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.2")', '"-1.3"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-2.0")', '"-2.1"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, ".1")', '"0.2"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, ".2")', '"0.3"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.")', '"1.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "2.")', '"2.1"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-.1")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-.2")', '"-0.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.")', '"-0.9"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-2.")', '"-1.9"');
+
+shouldBe('stepDownExplicitBounds(-10, 10, .1, ".1")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, ".2")', '"0.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.")', '"0.9"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "2.")', '"1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-.1")', '"-0.2"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-.2")', '"-0.3"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.")', '"-1.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-2.")', '"-2.1"');
+
+debug('');
</ins><span class="cx"> debug('Invalid step value');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "foo", "0")', '"1"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "0", "1")', '"2"');
</span><span class="lines">@@ -115,9 +245,13 @@
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "foo", "1")', '"0"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "0", "2")', '"1"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "-1", "3")', '"2"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Step=any');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "any", "1")', '"2"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "any", "1")', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Overflow/underflow');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, "100", "1", "99")', '"100"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, "100", "1", "100")', '"100"');
</span><span class="lines">@@ -130,15 +264,23 @@
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, 0, 1, 0)', '"0"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(-100, 0, 1, -1, 2)', '"0"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", 2)', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('stepDown()/stepUp() for stepMismatch values');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, 2, 1)', '"4"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(0, null, 10, 9, 9)', '"100"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(0, null, 10, 19)', '"10"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('value + step is <= max, but rounded result would be > max.');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, 99, 10, 89)', '"90"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Huge value and small step');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999)', '"1e+38"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999)', '"1e+38"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Fractional numbers');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '"1"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, 0.1, 1)', '"1.1"');
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsrangerangestepupstepdownhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -63,6 +63,8 @@
</span><span class="cx"> debug('Using the default values');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "")', '"51"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, null, "")', '"49"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Non-number arguments (stepCount)');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "0", "0")', '"0"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, null, "0", "0")', '"0"');
</span><span class="lines">@@ -70,6 +72,8 @@
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, null, "0", "foo")', '"0"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "0", null)', '"0"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, null, "0", null)', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Normal cases');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "0")', '"1"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, null, "1", 2)', '"3"');
</span><span class="lines">@@ -77,9 +81,139 @@
</span><span class="cx"> shouldBe('stepDownExplicitBounds("-100", null, null, "2")', '"1"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds("-100", null, null, "1", 2)', '"-1"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds("-100", null, null, "-1", -1)', '"0"');
</span><ins>+
+debug('');
+debug('Fractional cases')
+// "When the element is suffering from a step mismatch, the user agent must
+// round the element's value to the nearest number for which the element would
+// not suffer from a step mismatch, and which is greater than or equal to the
+// minimum, and, if the maximum is not less than the minimum, which is less
+// than or equal to the maximum, if there is a number that matches these
+// constraints. If two numbers match these constraints, then user agents must
+// use the one nearest to positive infinity.""
+
+// Base/model/template tests
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "0.1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "0.2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.0")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.1")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.2")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "2.0")', '"3"');
+
+// Same as above, but with negative numbers.
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-0.1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-0.2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.0")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.1")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.2")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-2.0")', '"-1"');
+
+// Same as above, but stepping down rather than up.
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "0.1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "0.2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.0")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.1")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.2")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "2.0")', '"1"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-0.1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-0.2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.0")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.1")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.2")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-2.0")', '"-3"');
+
+// Same as above, but with leading/trailing zeros removed.
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, ".1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, ".2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "1.")', '"2"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "2.")', '"3"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-.1")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-.2")', '"1"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-1.")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, 1, "-2.")', '"-1"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, ".1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, ".2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "1.")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "2.")', '"1"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-.1")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-.2")', '"-1"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-1.")', '"-2"');
+shouldBe('stepDownExplicitBounds(-10, 10, 1, "-2.")', '"-3"');
+
+// Same as above, but stepping by .1 rather than 1.
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "0.1")', '"0.2"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "0.2")', '"0.3"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.0")', '"1.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.1")', '"1.2"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.2")', '"1.3"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "2.0")', '"2.1"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-0.1")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-0.2")', '"-0.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.0")', '"-0.9"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.1")', '"-1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.2")', '"-1.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-2.0")', '"-1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "0.1")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "0.2")', '"0.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.0")', '"0.9"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.1")', '"1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.2")', '"1.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "2.0")', '"1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-0.1")', '"-0.2"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-0.2")', '"-0.3"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.0")', '"-1.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.1")', '"-1.2"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.2")', '"-1.3"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-2.0")', '"-2.1"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, ".1")', '"0.2"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, ".2")', '"0.3"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "1.")', '"1.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "2.")', '"2.1"');
+
+debug('');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-.1")', '"0"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-.2")', '"-0.1"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-1.")', '"-0.9"');
+shouldBe('stepUpExplicitBounds(-10, 10, .1, "-2.")', '"-1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, ".1")', '"0"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, ".2")', '"0.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "1.")', '"0.9"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "2.")', '"1.9"');
+
+debug('');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-.1")', '"-0.2"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-.2")', '"-0.3"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-1.")', '"-1.1"');
+shouldBe('stepDownExplicitBounds(-10, 10, .1, "-2.")', '"-2.1"');
+
+debug('');
</ins><span class="cx"> debug('Extra arguments');
</span><span class="cx"> shouldBe('setInputAttributes(null, null, null, "0"); input.stepUp(1,2); input.value', '"1"');
</span><span class="cx"> shouldBe('setInputAttributes(null, null, null, "1"); input.stepDown(1,3); input.value', '"0"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Invalid step value');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "foo", "0")', '"1"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, "0", "1")', '"2"');
</span><span class="lines">@@ -87,9 +221,13 @@
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "foo", "1")', '"0"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "0", "2")', '"1"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, "-1", "3")', '"2"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Step=any');
</span><span class="cx"> shouldThrow('stepUpExplicitBounds(null, null, "any", "1")', invalidStateErr);
</span><span class="cx"> shouldThrow('stepDownExplicitBounds(null, null, "any", "1")', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Overflow/underflow');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, "100", "1", "99")', '"100"');
</span><span class="cx"> shouldThrow('stepUpExplicitBounds(null, "100", "1", "100")', invalidStateErr);
</span><span class="lines">@@ -107,16 +245,24 @@
</span><span class="cx"> shouldThrow('stepUpExplicitBounds(-100, 0, 1, -1, 2)', invalidStateErr);
</span><span class="cx"> shouldBe('input.value', '"-1"');
</span><span class="cx"> shouldThrow('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('stepDown()/stepUp() for stepMismatch values');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, 2, 1)', '"4"');
</span><span class="cx"> shouldBe('input.stepDown(); input.value', '"2"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(0, null, 10, 9, 9)', '"100"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(0, null, 10, 19)', '"10"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('value + step is <= max, but rounded result would be > max.');
</span><span class="cx"> shouldThrow('stepUpExplicitBounds(null, 99, 10, 89)', invalidStateErr);
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Huge value and small step');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999)', '"1e+38"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999)', '"1e+38"');
</span><ins>+
+debug('');
</ins><span class="cx"> debug('Fractional numbers');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '"1"');
</span><span class="cx"> shouldBe('stepUpExplicitBounds(null, null, 0.1, 1)', '"1.1"');
</span><span class="lines">@@ -127,6 +273,8 @@
</span><span class="cx"> shouldBe('for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value', '"0"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, 0.1, 1, 8)', '"0.2"');
</span><span class="cx"> shouldBe('stepDownExplicitBounds(null, null, 0.1, 1)', '"0.9"');
</span><ins>+
+debug('');
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/Source/WebCore/ChangeLog        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-11-02 Keith Rollin <krollin@apple.com>
+
+ input[type=number] does not increment/decrement integers with trailing decimal characters
+ https://bugs.webkit.org/show_bug.cgi?id=148867
+ rdar://problem/22589693
+
+ Reviewed by Chris Dumez.
+
+ Support input[type=number].value attributes of the form "###." (that
+ is, leading digits with a decimal but no trailing digits). This form
+ was supported in the setting of the attribute, but not when changing
+ it through stepUp/Down.
+
+ Testing turned up similarly incorrect processing of -.###, so
+ addressed that, too.
+
+ Test: fast/forms/range/input-appearance-range-decimals.html
+
+ Updated the following tests:
+ - fast/forms/number/number-stepup-stepdown-from-renderer.html
+ - fast/forms/number/number-stepup-stepdown.html
+ - fast/forms/range/range-stepup-stepdown-from-renderer.html
+ - fast/forms/range/range-stepup-stepdown.html
+
+ * html/InputType.cpp:
+ (WebCore::InputType::stepUpFromRenderer):
+ * platform/Decimal.cpp:
+ (WebCore::Decimal::fromString):
+
</ins><span class="cx"> 2015-11-02 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> Null dereference loading Blink layout test fast/css/background-repeat-null-y-crash.html
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlInputTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/InputType.cpp (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/InputType.cpp        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/Source/WebCore/html/InputType.cpp        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -1062,7 +1062,7 @@
</span><span class="cx"> // * If 0 is in-range, but not matched to step value
</span><span class="cx"> // - The value should be the larger matched value nearest to 0 if n > 0
</span><span class="cx"> // e.g. <input type=number min=-100 step=3> -> 2
</span><del>- // - The value should be the smaler matched value nearest to 0 if n < 0
</del><ins>+ // - The value should be the smaller matched value nearest to 0 if n < 0
</ins><span class="cx"> // e.g. <input type=number min=-100 step=3> -> -1
</span><span class="cx"> // As for date/datetime-local/month/time/week types, the current value is assumed as "the current local date/time".
</span><span class="cx"> // As for datetime type, the current value is assumed as "the current date/time in UTC".
</span><span class="lines">@@ -1077,7 +1077,7 @@
</span><span class="cx"> // If the current value is not matched to step value:
</span><span class="cx"> // - The value should be the larger matched value nearest to 0 if n > 0
</span><span class="cx"> // e.g. <input type=number value=3 min=-100 step=3> -> 5
</span><del>- // - The value should be the smaler matched value nearest to 0 if n < 0
</del><ins>+ // - The value should be the smaller matched value nearest to 0 if n < 0
</ins><span class="cx"> // e.g. <input type=number value=3 min=-100 step=3> -> 2
</span><span class="cx"> //
</span><span class="cx"> // n is assumed as -n if step < 0.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDecimalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Decimal.cpp (191939 => 191940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Decimal.cpp        2015-11-03 06:16:26 UTC (rev 191939)
+++ trunk/Source/WebCore/platform/Decimal.cpp        2015-11-03 07:21:41 UTC (rev 191940)
</span><span class="lines">@@ -824,6 +824,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HandleCharAndBreak('0', StateZero);
</span><ins>+ HandleCharAndBreak('.', StateDot);
</ins><span class="cx"> return nan();
</span><span class="cx">
</span><span class="cx"> case StateStart:
</span><span class="lines">@@ -874,7 +875,7 @@
</span><span class="cx"> if (state == StateZero)
</span><span class="cx"> return zero(sign);
</span><span class="cx">
</span><del>- if (state == StateDigit || state == StateEDigit || state == StateDotDigit) {
</del><ins>+ if (state == StateDigit || state == StateDot || state == StateDotDigit || state == StateEDigit) {
</ins><span class="cx"> int resultExponent = exponent * (exponentSign == Negative ? -1 : 1) - numberOfDigitsAfterDot + numberOfExtraDigits;
</span><span class="cx"> if (resultExponent < ExponentMin)
</span><span class="cx"> return zero(Positive);
</span></span></pre>
</div>
</div>
</body>
</html>