RESOLVED WONTFIX 50007
Auto-clamping values doesn't work for <input type="range" step="any" />
https://bugs.webkit.org/show_bug.cgi?id=50007
Summary Auto-clamping values doesn't work for <input type="range" step="any" />
Dai Mikurube
Reported 2010-11-24 00:35:43 PST
How to reproduce: 1. <input type="range" step="any" id="range" min="0" max="300" /> 2. document.getElementById("range").value = 199 Expected : document.getElementById("range").value should be 198. document.getElementById("range").stepMismatch() should be false correctly. Actual: document.getElementById("range").value is 199. document.getElementById("range").stepMismatch() is false. (As RangeInputType::stepMismatch() is hard-coded.) But it is not step-matching. Facts: 1. A value in <input type="range" /> must be clamped for steps. Never stepMismatch() == true. 2. stepUp() for <input type="range" step="any" /> assumes step="'(1/100 of the value range)" in the current implementation. (See the comment below (*)) (*) WebCore/html/RangeInputType.cpp : // FIXME: We can't use stepUp() for the step value "any". So, we increase // or decrease the value by 1/100 of the value range. Is it reasonable? Though 1 and 2, input.value can be set with a step-mismatched value in case of step="any".
Attachments
Patch (12.05 KB, patch)
2010-11-24 03:18 PST, Dai Mikurube
no flags
Dai Mikurube
Comment 1 2010-11-24 03:18:44 PST
Kent Tamura
Comment 2 2010-11-24 18:06:04 PST
> 1. <input type="range" step="any" id="range" min="0" max="300" /> > 2. document.getElementById("range").value = 199 > > Expected : > document.getElementById("range").value should be 198. > document.getElementById("range").stepMismatch() should be false correctly. No. This range input should accept any value in 0-300 because of step=any. 1/100 step behavior is just for keyboard operation.
Dai Mikurube
Comment 3 2010-11-24 18:19:13 PST
(In reply to comment #2) Thanks. Ok, so what should happen when : 1. <input type="range" step="any" id="range" min="0" max="300" /> 2. document.getElementById("range").value = 199 3. sendKey('Up') for id="range" ? Is it should be 202?
Kent Tamura
Comment 4 2010-11-24 18:23:18 PST
(In reply to comment #3) > (In reply to comment #2) > > Thanks. Ok, so what should happen when : > 1. <input type="range" step="any" id="range" min="0" max="300" /> > 2. document.getElementById("range").value = 199 > 3. sendKey('Up') for id="range" > ? > > Is it should be 202? I think so. The value should increase by 1/100 of the value range.
Dai Mikurube
Comment 5 2010-11-24 21:50:31 PST
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > > Thanks. Ok, so what should happen when : > > 1. <input type="range" step="any" id="range" min="0" max="300" /> > > 2. document.getElementById("range").value = 199 > > 3. sendKey('Up') for id="range" > > ? > > > > Is it should be 202? > > I think so. The value should increase by 1/100 of the value range. Thanks. So closing this bug.
Kent Tamura
Comment 6 2010-11-24 22:00:25 PST
Comment on attachment 74736 [details] Patch Clearing the review flag.
Dai Mikurube
Comment 7 2010-11-24 22:04:52 PST
(In reply to comment #6) > (From update of attachment 74736 [details]) > Clearing the review flag. I forgot it. Thank you.
Note You need to log in before you can comment on or make changes to this bug.