OSDN Git Service

Merge WebKit at r73109: Initial merge by git.
[android-x86/external-webkit.git] / WebCore / html / TimeInputType.cpp
index 27dce90..6b381be 100644 (file)
@@ -34,6 +34,9 @@
 #include "DateComponents.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/DateMath.h>
+#include <wtf/MathExtras.h>
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -53,6 +56,21 @@ const AtomicString& TimeInputType::formControlType() const
     return InputTypeNames::time();
 }
 
+double TimeInputType::defaultValueForStepUp() const
+{
+    double current = currentTimeMS();
+    double utcOffset = calculateUTCOffset();
+    double dstOffset = calculateDSTOffset(current, utcOffset);
+    int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute);
+    current += offset * msPerMinute;
+
+    DateComponents date;
+    date.setMillisecondsSinceMidnight(current);
+    double milliseconds = date.millisecondsSinceEpoch();
+    ASSERT(isfinite(milliseconds));
+    return milliseconds;
+}
+
 double TimeInputType::minimum() const
 {
     return parseToDouble(element()->fastGetAttribute(minAttr), DateComponents::minimumTime());