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

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

Issue 136783006: Upgrade stepUp()/stepDown() implementation to match spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: applyStep(): add missing EventQueueScope Created 6 years, 10 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
« no previous file with comments | « Source/core/html/forms/StepRange.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 date.setMillisecondsSinceMidnight(current); 83 date.setMillisecondsSinceMidnight(current);
84 double milliseconds = date.millisecondsSinceEpoch(); 84 double milliseconds = date.millisecondsSinceEpoch();
85 ASSERT(std::isfinite(milliseconds)); 85 ASSERT(std::isfinite(milliseconds));
86 return Decimal::fromDouble(milliseconds); 86 return Decimal::fromDouble(milliseconds);
87 } 87 }
88 88
89 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const 89 StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const
90 { 90 {
91 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu eShouldBeInteger)); 91 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (time DefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValu eShouldBeInteger));
92 92
93 return InputType::createStepRange(anyStepHandling, 0, Decimal::fromDouble(Da teComponents::minimumTime()), Decimal::fromDouble(DateComponents::maximumTime()) , stepDescription); 93 return InputType::createStepRange(anyStepHandling, timeDefaultStepBase, Deci mal::fromDouble(DateComponents::minimumTime()), Decimal::fromDouble(DateComponen ts::maximumTime()), stepDescription);
94 } 94 }
95 95
96 bool TimeInputType::parseToDateComponentsInternal(const String& string, DateComp onents* out) const 96 bool TimeInputType::parseToDateComponentsInternal(const String& string, DateComp onents* out) const
97 { 97 {
98 ASSERT(out); 98 ASSERT(out);
99 unsigned end; 99 unsigned end;
100 return out->parseTime(string, 0, end) && end == string.length(); 100 return out->parseTime(string, 0, end) && end == string.length();
101 } 101 }
102 102
103 bool TimeInputType::setMillisecondToDateComponents(double value, DateComponents* date) const 103 bool TimeInputType::setMillisecondToDateComponents(double value, DateComponents* date) const
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 layoutParameters.maximum = DateComponents(); 160 layoutParameters.maximum = DateComponents();
161 } 161 }
162 162
163 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const 163 bool TimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, boo l hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const
164 { 164 {
165 return hasHour && hasMinute && hasAMPM; 165 return hasHour && hasMinute && hasAMPM;
166 } 166 }
167 #endif 167 #endif
168 168
169 } // namespace WebCore 169 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/forms/StepRange.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698