diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/html/TimeInputType.cpp | |
parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/html/TimeInputType.cpp')
-rw-r--r-- | WebCore/html/TimeInputType.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/WebCore/html/TimeInputType.cpp b/WebCore/html/TimeInputType.cpp index 27dce90..6b381be 100644 --- a/WebCore/html/TimeInputType.cpp +++ b/WebCore/html/TimeInputType.cpp @@ -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()); |