OLD | NEW |
---|---|
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 countUsageIfVisible(UseCounter::InputTypeTime); | 66 countUsageIfVisible(UseCounter::InputTypeTime); |
67 } | 67 } |
68 | 68 |
69 const AtomicString& TimeInputType::formControlType() const | 69 const AtomicString& TimeInputType::formControlType() const |
70 { | 70 { |
71 return InputTypeNames::time; | 71 return InputTypeNames::time; |
72 } | 72 } |
73 | 73 |
74 Decimal TimeInputType::defaultValueForStepUp() const | 74 Decimal TimeInputType::defaultValueForStepUp() const |
75 { | 75 { |
76 double current = currentTimeMS(); | 76 double current = convertToLocalTime(currentTimeMS()); |
77 double utcOffset = calculateUTCOffset(); | |
78 double dstOffset = calculateDSTOffset(current, utcOffset); | |
79 int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute); | |
80 current += offset * msPerMinute; | |
81 | |
82 DateComponents date; | 77 DateComponents date; |
83 date.setMillisecondsSinceMidnight(current); | 78 date.setMillisecondsSinceMidnight(current); |
tkent
2014/07/28 00:40:26
nit:
ate.setMillisecondsSinceMidnight(convertToLoc
kangil_
2014/07/31 00:45:45
Done.
| |
84 double milliseconds = date.millisecondsSinceEpoch(); | 79 double milliseconds = date.millisecondsSinceEpoch(); |
85 ASSERT(std::isfinite(milliseconds)); | 80 ASSERT(std::isfinite(milliseconds)); |
86 return Decimal::fromDouble(milliseconds); | 81 return Decimal::fromDouble(milliseconds); |
87 } | 82 } |
88 | 83 |
89 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const | 84 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const |
90 { | 85 { |
91 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu eShouldBeInteger)); | 86 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu eShouldBeInteger)); |
92 | 87 |
93 return InputType::createStepRange(anyStepHandling, timeDefaultStepBase, Deci mal::fromDouble(DateComponents::minimumTime()), Decimal::fromDouble(DateComponen ts::maximumTime()), stepDescription); | 88 return InputType::createStepRange(anyStepHandling, timeDefaultStepBase, Deci mal::fromDouble(DateComponents::minimumTime()), Decimal::fromDouble(DateComponen ts::maximumTime()), stepDescription); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 layoutParameters.maximum = DateComponents(); | 155 layoutParameters.maximum = DateComponents(); |
161 } | 156 } |
162 | 157 |
163 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const | 158 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const |
164 { | 159 { |
165 return hasHour && hasMinute && hasAMPM; | 160 return hasHour && hasMinute && hasAMPM; |
166 } | 161 } |
167 #endif | 162 #endif |
168 | 163 |
169 } // namespace blink | 164 } // namespace blink |
OLD | NEW |