Title: [122797] trunk/Source/WebCore
- Revision
- 122797
- Author
- [email protected]
- Date
- 2012-07-16 19:25:18 -0700 (Mon, 16 Jul 2012)
Log Message
REGRESSION(r119948): [Form] HTMLInputElement.valueAsNumber for input type "month" should return number of month since January 1970
https://bugs.webkit.org/show_bug.cgi?id=91211
Reviewed by Kent Tamura.
This patch changes BaseDateAndTimeInputType::valueAsDouble() to call
virtual function parseToNumber() which "month" input type overrides
instead of non-virtual function parseToDouble() which returns number
of milliseconds.
No new tests. Existing test (fast/form/month/input-valueasnumber-month.html) coverts this, although it is disabled.
* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::valueAsDouble): Changed to call parseToNumber().
(WebCore::BaseDateAndTimeInputType::parseToNumber): Changed to what parseToDouble() did.
* html/BaseDateAndTimeInputType.h:
(BaseDateAndTimeInputType): Remove parseToDouble().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (122796 => 122797)
--- trunk/Source/WebCore/ChangeLog 2012-07-17 02:10:34 UTC (rev 122796)
+++ trunk/Source/WebCore/ChangeLog 2012-07-17 02:25:18 UTC (rev 122797)
@@ -1,3 +1,23 @@
+2012-07-16 Yoshifumi Inoue <[email protected]>
+
+ REGRESSION(r119948): [Form] HTMLInputElement.valueAsNumber for input type "month" should return number of month since January 1970
+ https://bugs.webkit.org/show_bug.cgi?id=91211
+
+ Reviewed by Kent Tamura.
+
+ This patch changes BaseDateAndTimeInputType::valueAsDouble() to call
+ virtual function parseToNumber() which "month" input type overrides
+ instead of non-virtual function parseToDouble() which returns number
+ of milliseconds.
+
+ No new tests. Existing test (fast/form/month/input-valueasnumber-month.html) coverts this, although it is disabled.
+
+ * html/BaseDateAndTimeInputType.cpp:
+ (WebCore::BaseDateAndTimeInputType::valueAsDouble): Changed to call parseToNumber().
+ (WebCore::BaseDateAndTimeInputType::parseToNumber): Changed to what parseToDouble() did.
+ * html/BaseDateAndTimeInputType.h:
+ (BaseDateAndTimeInputType): Remove parseToDouble().
+
2012-07-16 Adrienne Walker <[email protected]>
[chromium] Turn off ScrollbarLayerChromium for Windows due to bad alpha values
Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp (122796 => 122797)
--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2012-07-17 02:10:34 UTC (rev 122796)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2012-07-17 02:25:18 UTC (rev 122797)
@@ -62,7 +62,8 @@
double BaseDateAndTimeInputType::valueAsDouble() const
{
- return parseToDouble(element()->value());
+ const Decimal value = parseToNumber(element()->value(), Decimal::nan());
+ return value.isFinite() ? value.toDouble() : DateComponents::invalidMilliseconds();
}
void BaseDateAndTimeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionCode&) const
@@ -108,22 +109,16 @@
handleWheelEventForSpinButton(event);
}
-double BaseDateAndTimeInputType::parseToDouble(const String& source) const
+Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const
{
DateComponents date;
if (!parseToDateComponents(source, &date))
- return DateComponents::invalidMilliseconds();
+ return defaultValue;
double msec = date.millisecondsSinceEpoch();
ASSERT(isfinite(msec));
- return msec;
+ return Decimal::fromDouble(msec);
}
-Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const
-{
- const double doubleValue = parseToDouble(source);
- return isfinite(doubleValue) ? Decimal::fromDouble(doubleValue) : defaultValue;
-}
-
bool BaseDateAndTimeInputType::parseToDateComponents(const String& source, DateComponents* out) const
{
if (source.isEmpty())
Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.h (122796 => 122797)
--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.h 2012-07-17 02:10:34 UTC (rev 122796)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.h 2012-07-17 02:25:18 UTC (rev 122797)
@@ -65,7 +65,6 @@
virtual String visibleValue() const OVERRIDE;
virtual String convertFromVisibleValue(const String&) const OVERRIDE;
virtual String sanitizeValue(const String&) const OVERRIDE;
- double parseToDouble(const String&) const;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes