| 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(); | |
| 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; | 76 DateComponents date; |
| 83 date.setMillisecondsSinceMidnight(current); | 77 date.setMillisecondsSinceMidnight(convertToLocalTime(currentTimeMS())); |
| 84 double milliseconds = date.millisecondsSinceEpoch(); | 78 double milliseconds = date.millisecondsSinceEpoch(); |
| 85 ASSERT(std::isfinite(milliseconds)); | 79 ASSERT(std::isfinite(milliseconds)); |
| 86 return Decimal::fromDouble(milliseconds); | 80 return Decimal::fromDouble(milliseconds); |
| 87 } | 81 } |
| 88 | 82 |
| 89 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const | 83 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const |
| 90 { | 84 { |
| 91 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time
DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu
eShouldBeInteger)); | 85 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time
DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu
eShouldBeInteger)); |
| 92 | 86 |
| 93 return InputType::createStepRange(anyStepHandling, timeDefaultStepBase, Deci
mal::fromDouble(DateComponents::minimumTime()), Decimal::fromDouble(DateComponen
ts::maximumTime()), stepDescription); | 87 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(); | 154 layoutParameters.maximum = DateComponents(); |
| 161 } | 155 } |
| 162 | 156 |
| 163 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo
l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const | 157 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo
l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const |
| 164 { | 158 { |
| 165 return hasHour && hasMinute && hasAMPM; | 159 return hasHour && hasMinute && hasAMPM; |
| 166 } | 160 } |
| 167 #endif | 161 #endif |
| 168 | 162 |
| 169 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |