input[type=number] does not increment/decrement integers with trailing decimal characters
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 07:21:41 +0000 (07:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 07:21:41 +0000 (07:21 +0000)
commit72632a63aa9608692ceac66ec5c75e5cdb69c38e
treea2258cd12bc9b196c548bd1c27460bf016922e41
parentf0afb8760bfe3ea3a6a815e0f0be0db9d6fe8446
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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt
LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt
LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html
LayoutTests/fast/forms/number/number-stepup-stepdown.html
LayoutTests/fast/forms/range/input-appearance-range-decimals-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/range/input-appearance-range-decimals.html [new file with mode: 0644]
LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt
LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer-expected.txt
LayoutTests/fast/forms/range/range-stepup-stepdown-from-renderer.html
LayoutTests/fast/forms/range/range-stepup-stepdown.html
Source/WebCore/ChangeLog
Source/WebCore/html/InputType.cpp
Source/WebCore/platform/Decimal.cpp