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

Side by Side Diff: Source/core/html/forms/DateTimeLocalInputType.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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void DateTimeLocalInputType::setValueAsDate(double value, ExceptionState& except ionState) const 79 void DateTimeLocalInputType::setValueAsDate(double value, ExceptionState& except ionState) const
80 { 80 {
81 // valueAsDate doesn't work for the datetime-local type according to the sta ndard. 81 // valueAsDate doesn't work for the datetime-local type according to the sta ndard.
82 InputType::setValueAsDate(value, exceptionState); 82 InputType::setValueAsDate(value, exceptionState);
83 } 83 }
84 84
85 StepRange DateTimeLocalInputType::createStepRange(AnyStepHandling anyStepHandlin g) const 85 StepRange DateTimeLocalInputType::createStepRange(AnyStepHandling anyStepHandlin g) const
86 { 86 {
87 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (date TimeLocalDefaultStep, dateTimeLocalDefaultStepBase, dateTimeLocalStepScaleFactor , StepRange::ScaledStepValueShouldBeInteger)); 87 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (date TimeLocalDefaultStep, dateTimeLocalDefaultStepBase, dateTimeLocalStepScaleFactor , StepRange::ScaledStepValueShouldBeInteger));
88 88
89 const Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), 0); 89 const Decimal stepBase = findStepBase(0);
90 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), D ecimal::fromDouble(DateComponents::minimumDateTime())); 90 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), D ecimal::fromDouble(DateComponents::minimumDateTime()));
91 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), D ecimal::fromDouble(DateComponents::maximumDateTime())); 91 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), D ecimal::fromDouble(DateComponents::maximumDateTime()));
92 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr)); 92 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
93 return StepRange(stepBase, minimum, maximum, step, stepDescription); 93 return StepRange(stepBase, minimum, maximum, step, stepDescription);
94 } 94 }
95 95
96 bool DateTimeLocalInputType::parseToDateComponentsInternal(const String& string, DateComponents* out) const 96 bool DateTimeLocalInputType::parseToDateComponentsInternal(const String& string, DateComponents* out) const
97 { 97 {
98 ASSERT(out); 98 ASSERT(out);
99 unsigned end; 99 unsigned end;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 layoutParameters.placeholderForYear = locale().queryString(WebLocalizedStrin g::PlaceholderForYearField); 167 layoutParameters.placeholderForYear = locale().queryString(WebLocalizedStrin g::PlaceholderForYearField);
168 } 168 }
169 169
170 bool DateTimeLocalInputType::isValidFormat(bool hasYear, bool hasMonth, bool has Week, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) c onst 170 bool DateTimeLocalInputType::isValidFormat(bool hasYear, bool hasMonth, bool has Week, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) c onst
171 { 171 {
172 return hasYear && hasMonth && hasDay && hasAMPM && hasHour && hasMinute; 172 return hasYear && hasMonth && hasDay && hasAMPM && hasHour && hasMinute;
173 } 173 }
174 #endif 174 #endif
175 175
176 } // namespace WebCore 176 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698