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

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

Issue 83413002: Derive the step base for an input element as (now) specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Perform step base derivation via InputType::findStepBase() instead Created 7 years 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = parseToNumber(element().fastGetAttribute(minAttr), 0); 98 const Decimal stepBase = findStepBase(0);
99 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), D ecimal::fromDouble(DateComponents::minimumTime())); 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())); 100 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), D ecimal::fromDouble(DateComponents::maximumTime()));
101 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr)); 101 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
102 return StepRange(stepBase, minimum, maximum, step, stepDescription); 102 return StepRange(stepBase, minimum, maximum, step, stepDescription);
103 } 103 }
104 104
105 bool TimeInputType::parseToDateComponentsInternal(const String& string, DateComp onents* out) const 105 bool TimeInputType::parseToDateComponentsInternal(const String& string, DateComp onents* out) const
106 { 106 {
107 ASSERT(out); 107 ASSERT(out);
108 unsigned end; 108 unsigned end;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 layoutParameters.maximum = DateComponents(); 169 layoutParameters.maximum = DateComponents();
170 } 170 }
171 171
172 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const 172 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const
173 { 173 {
174 return hasHour && hasMinute && hasAMPM; 174 return hasHour && hasMinute && hasAMPM;
175 } 175 }
176 #endif 176 #endif
177 177
178 } // namespace WebCore 178 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698