Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: Source/core/html/forms/BaseDateAndTimeInputType.cpp

Issue 394903004: document.lastModified should consider user's local time zone (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix windows build error Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return locale().queryString(WebLocalizedString::ValidationRangeOverflowDateT ime, localizeValue(serialize(maximum))); 83 return locale().queryString(WebLocalizedString::ValidationRangeOverflowDateT ime, localizeValue(serialize(maximum)));
84 } 84 }
85 85
86 String BaseDateAndTimeInputType::rangeUnderflowText(const Decimal& minimum) cons t 86 String BaseDateAndTimeInputType::rangeUnderflowText(const Decimal& minimum) cons t
87 { 87 {
88 return locale().queryString(WebLocalizedString::ValidationRangeUnderflowDate Time, localizeValue(serialize(minimum))); 88 return locale().queryString(WebLocalizedString::ValidationRangeUnderflowDate Time, localizeValue(serialize(minimum)));
89 } 89 }
90 90
91 Decimal BaseDateAndTimeInputType::defaultValueForStepUp() const 91 Decimal BaseDateAndTimeInputType::defaultValueForStepUp() const
92 { 92 {
93 double ms = currentTimeMS(); 93 double current = convertToLocalTime(currentTimeMS());
94 double utcOffset = calculateUTCOffset(); 94 return Decimal::fromDouble(current);
tkent 2014/07/28 00:40:26 nit: return Decimal::fromDouble(convertToLocalTi
kangil_ 2014/07/31 00:45:45 Done.
95 double dstOffset = calculateDSTOffset(ms, utcOffset);
96 int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute);
97 return Decimal::fromDouble(ms + (offset * msPerMinute));
98 } 95 }
99 96
100 bool BaseDateAndTimeInputType::isSteppable() const 97 bool BaseDateAndTimeInputType::isSteppable() const
101 { 98 {
102 return true; 99 return true;
103 } 100 }
104 101
105 Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Deci mal& defaultValue) const 102 Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Deci mal& defaultValue) const
106 { 103 {
107 DateComponents date; 104 DateComponents date;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 { 180 {
184 return element().isRequired() && value.isEmpty(); 181 return element().isRequired() && value.isEmpty();
185 } 182 }
186 183
187 bool BaseDateAndTimeInputType::shouldShowFocusRingOnMouseFocus() const 184 bool BaseDateAndTimeInputType::shouldShowFocusRingOnMouseFocus() const
188 { 185 {
189 return true; 186 return true;
190 } 187 }
191 188
192 } // namespace blink 189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698