| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 date.setMillisecondsSinceMidnight(current); | 88 date.setMillisecondsSinceMidnight(current); |
| 89 double milliseconds = date.millisecondsSinceEpoch(); | 89 double milliseconds = date.millisecondsSinceEpoch(); |
| 90 ASSERT(std::isfinite(milliseconds)); | 90 ASSERT(std::isfinite(milliseconds)); |
| 91 return Decimal::fromDouble(milliseconds); | 91 return Decimal::fromDouble(milliseconds); |
| 92 } | 92 } |
| 93 | 93 |
| 94 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const | 94 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const |
| 95 { | 95 { |
| 96 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time
DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu
eShouldBeInteger)); | 96 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time
DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu
eShouldBeInteger)); |
| 97 | 97 |
| 98 const Decimal stepBase = findStepBase(0); | 98 return InputType::createStepRange(anyStepHandling, 0, Decimal::fromDouble(Da
teComponents::minimumTime()), Decimal::fromDouble(DateComponents::maximumTime())
, stepDescription); |
| 99 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), D
ecimal::fromDouble(DateComponents::minimumTime())); | |
| 100 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), D
ecimal::fromDouble(DateComponents::maximumTime())); | |
| 101 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); | |
| 102 return StepRange(stepBase, minimum, maximum, step, stepDescription); | |
| 103 } | 99 } |
| 104 | 100 |
| 105 bool TimeInputType::parseToDateComponentsInternal(const String& string, DateComp
onents* out) const | 101 bool TimeInputType::parseToDateComponentsInternal(const String& string, DateComp
onents* out) const |
| 106 { | 102 { |
| 107 ASSERT(out); | 103 ASSERT(out); |
| 108 unsigned end; | 104 unsigned end; |
| 109 return out->parseTime(string, 0, end) && end == string.length(); | 105 return out->parseTime(string, 0, end) && end == string.length(); |
| 110 } | 106 } |
| 111 | 107 |
| 112 bool TimeInputType::setMillisecondToDateComponents(double value, DateComponents*
date) const | 108 bool TimeInputType::setMillisecondToDateComponents(double value, DateComponents*
date) const |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 layoutParameters.maximum = DateComponents(); | 165 layoutParameters.maximum = DateComponents(); |
| 170 } | 166 } |
| 171 | 167 |
| 172 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo
l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const | 168 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo
l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const |
| 173 { | 169 { |
| 174 return hasHour && hasMinute && hasAMPM; | 170 return hasHour && hasMinute && hasAMPM; |
| 175 } | 171 } |
| 176 #endif | 172 #endif |
| 177 | 173 |
| 178 } // namespace WebCore | 174 } // namespace WebCore |
| OLD | NEW |