Title: [139151] trunk
- Revision
- 139151
- Author
- tk...@chromium.org
- Date
- 2013-01-08 20:17:46 -0800 (Tue, 08 Jan 2013)
Log Message
REGRESSION(r135836): Invalid user input for input[type=number] should be cleared by input.value=""
https://bugs.webkit.org/show_bug.cgi?id=106284
Reviewed by Hajime Morita.
Source/WebCore:
No new tests. Updates fast/forms/number/number/validity-badinput.html.
* html/NumberInputType.cpp:
(WebCore::NumberInputType::setValue):
If the new sanitized value is empty and innerTextValue is a bad input
(it means !valueChanged && !innerTextValue().isEmpty() because the new
sanitized value is empty), we need to update innerTextValue with the
empty string.
* html/NumberInputType.h:
(NumberInputType): Declare setValue.
LayoutTests:
* fast/forms/number/number-validity-badinput.html:
Add a test case.
* fast/forms/number/number-validity-badinput-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (139150 => 139151)
--- trunk/LayoutTests/ChangeLog 2013-01-09 03:30:43 UTC (rev 139150)
+++ trunk/LayoutTests/ChangeLog 2013-01-09 04:17:46 UTC (rev 139151)
@@ -1,3 +1,14 @@
+2013-01-08 Kent Tamura <tk...@chromium.org>
+
+ REGRESSION(r135836): Invalid user input for input[type=number] should be cleared by input.value=""
+ https://bugs.webkit.org/show_bug.cgi?id=106284
+
+ Reviewed by Hajime Morita.
+
+ * fast/forms/number/number-validity-badinput.html:
+ Add a test case.
+ * fast/forms/number/number-validity-badinput-expected.txt:
+
2013-01-08 Nate Chapin <jap...@chromium.org>
REGRESSION(r138222?): [Mac WK1] http/tests/appcache/main-resource-redirect.html asserts in WebFrameLoaderClient::dispatchDidFinishLoading
Modified: trunk/LayoutTests/fast/forms/number/number-validity-badinput-expected.txt (139150 => 139151)
--- trunk/LayoutTests/fast/forms/number/number-validity-badinput-expected.txt 2013-01-09 03:30:43 UTC (rev 139150)
+++ trunk/LayoutTests/fast/forms/number/number-validity-badinput-expected.txt 2013-01-09 04:17:46 UTC (rev 139151)
@@ -26,6 +26,8 @@
PASS number.value is ""
The element losts a renderer. The element state should not be changed.
PASS number.style.display = "none"; number.validity.badInput is true
+A bad input should be cleared by value="".
+PASS number.value = ""; document.execCommand("SelectAll"); document.getSelection().toString() is ""
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/forms/number/number-validity-badinput.html (139150 => 139151)
--- trunk/LayoutTests/fast/forms/number/number-validity-badinput.html 2013-01-09 03:30:43 UTC (rev 139150)
+++ trunk/LayoutTests/fast/forms/number/number-validity-badinput.html 2013-01-09 04:17:46 UTC (rev 139151)
@@ -59,6 +59,11 @@
debug("The element losts a renderer. The element state should not be changed.");
shouldBeTrue('number.style.display = "none"; number.validity.badInput');
+number.style.display = 'inline-block';
+number.focus();
+debug('A bad input should be cleared by value="".');
+shouldBeEqualToString('number.value = ""; document.execCommand("SelectAll"); document.getSelection().toString()', '');
+
document.getElementById('parent').innerHTML = '';
</script>
<script src=""
Modified: trunk/Source/WebCore/ChangeLog (139150 => 139151)
--- trunk/Source/WebCore/ChangeLog 2013-01-09 03:30:43 UTC (rev 139150)
+++ trunk/Source/WebCore/ChangeLog 2013-01-09 04:17:46 UTC (rev 139151)
@@ -1,3 +1,21 @@
+2013-01-08 Kent Tamura <tk...@chromium.org>
+
+ REGRESSION(r135836): Invalid user input for input[type=number] should be cleared by input.value=""
+ https://bugs.webkit.org/show_bug.cgi?id=106284
+
+ Reviewed by Hajime Morita.
+
+ No new tests. Updates fast/forms/number/number/validity-badinput.html.
+
+ * html/NumberInputType.cpp:
+ (WebCore::NumberInputType::setValue):
+ If the new sanitized value is empty and innerTextValue is a bad input
+ (it means !valueChanged && !innerTextValue().isEmpty() because the new
+ sanitized value is empty), we need to update innerTextValue with the
+ empty string.
+ * html/NumberInputType.h:
+ (NumberInputType): Declare setValue.
+
2013-01-08 Nate Chapin <jap...@chromium.org>
REGRESSION(r138222?): [Mac WK1] http/tests/appcache/main-resource-redirect.html asserts in WebFrameLoaderClient::dispatchDidFinishLoading
Modified: trunk/Source/WebCore/html/NumberInputType.cpp (139150 => 139151)
--- trunk/Source/WebCore/html/NumberInputType.cpp 2013-01-09 03:30:43 UTC (rev 139150)
+++ trunk/Source/WebCore/html/NumberInputType.cpp 2013-01-09 04:17:46 UTC (rev 139151)
@@ -106,6 +106,13 @@
return InputTypeNames::number();
}
+void NumberInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior)
+{
+ if (!valueChanged && sanitizedValue.isEmpty() && !element()->innerTextValue().isEmpty())
+ updateInnerTextValue();
+ TextFieldInputType::setValue(sanitizedValue, valueChanged, eventBehavior);
+}
+
double NumberInputType::valueAsDouble() const
{
return parseToDoubleForNumberType(element()->value());
Modified: trunk/Source/WebCore/html/NumberInputType.h (139150 => 139151)
--- trunk/Source/WebCore/html/NumberInputType.h 2013-01-09 03:30:43 UTC (rev 139150)
+++ trunk/Source/WebCore/html/NumberInputType.h 2013-01-09 04:17:46 UTC (rev 139151)
@@ -42,6 +42,7 @@
private:
NumberInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
virtual const AtomicString& formControlType() const OVERRIDE;
+ virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE;
virtual double valueAsDouble() const OVERRIDE;
virtual void setValueAsDouble(double, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes