[CherryPick] Correct input[type=number] value sanitization for user-input
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2012 13:11:46 +0000 (13:11 +0000)
committerjinwoo jeong <jw00.jeong@samsung.com>
Thu, 28 Mar 2013 03:52:18 +0000 (12:52 +0900)
commit662f276e61d216b11c0b5b1f8bfbc207f69350c5
tree9d0184b208f560bd589aa0e481d8759be107cd9b
parentd09950e72b1091fb1f7ee022b261e0beedca4177
[CherryPick] Correct input[type=number] value sanitization for user-input

[Title] Correct input[type=number] value sanitization for user-input
[Issues] N_SE-28998
[Problem] Input type number not showing any error message in Jquery mobile single page application
[Solution] Cherry picked.
[Cherry-Picker] Jinwoo Jeong <jw00.jeong@samsung.com>

Correct input[type=number] value sanitization for user-input
https://bugs.webkit.org/show_bug.cgi?id=103018

Reviewed by Kentaro Hara.

Source/WebCore:

If a number field has non-number string, HTMLInputElement::value is not
updated and returns the past valid value. It doesn't match to the value
sanitization algorithm defined by the HTML standard [1], and Opera's
behavior. We should sanitize non-number strings to "".

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#number-state-(type=number)
> The value sanitization algorithm is as follows: If the value of the
> element is not a valid floating-point number, then set it to the empty
> string instead.

No new tests. Update existing tests;
fast/forms/number/number-commit-valid-only.html and
fast/forms/number/number-unacceptable-style.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::subtreeHasChanged):
Remove isAcceptableValue check.

* html/HTMLInputElement.h:
(HTMLInputElement): isAcceptableValue is no longer needed.
* html/InputType.cpp: Remove isAcceptableValue.
* html/InputType.h: Ditto.
* html/NumberInputType.cpp: Ditto.
(WebCore::NumberInputType::hasUnacceptableValue):
Fold the isAcceptableValue content into this.
* html/NumberInputType.h:
(NumberInputType): Remove isAcceptableValue.

LayoutTests:

* fast/forms/number/number-commit-valid-only-expected.txt:
* fast/forms/number/number-commit-valid-only.html:
Update the expected HTMLInputElement::value results.
* fast/forms/number/number-unacceptable-style-expected.txt:
* fast/forms/number/number-unacceptable-style.html:
Add some checks for HTMLInputElement::value.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135598 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Conflicts:

LayoutTests/ChangeLog
Source/WebCore/ChangeLog

Conflicts:

Source/WebCore/ChangeLog
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/number/number-commit-valid-only-expected.txt
LayoutTests/fast/forms/number/number-commit-valid-only.html
LayoutTests/fast/forms/number/number-unacceptable-style-expected.txt
LayoutTests/fast/forms/number/number-unacceptable-style.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/html/NumberInputType.cpp
Source/WebCore/html/NumberInputType.h