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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp

Issue 2418573003: date-time-local WIP
Patch Set: Fix some more Created 4 years, 2 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 using namespace HTMLNames; 45 using namespace HTMLNames;
46 46
47 static const int dateTimeLocalDefaultStep = 60; 47 static const int dateTimeLocalDefaultStep = 60;
48 static const int dateTimeLocalDefaultStepBase = 0; 48 static const int dateTimeLocalDefaultStepBase = 0;
49 static const int dateTimeLocalStepScaleFactor = 1000; 49 static const int dateTimeLocalStepScaleFactor = 1000;
50 50
51 InputType* DateTimeLocalInputType::create(HTMLInputElement& element) { 51 InputType* DateTimeLocalInputType::create(HTMLInputElement& element) {
52 return new DateTimeLocalInputType(element); 52 return new DateTimeLocalInputType(element);
53 } 53 }
54 54
55 String DateTimeLocalInputType::sanitizeValue(const String& proposedValue) const {
56 DateComponents date;
57 if (proposedValue.isEmpty() || !parseToDateComponents(proposedValue, &date))
58 return emptyString();
59 return date.toString();
60 }
61
55 void DateTimeLocalInputType::countUsage() { 62 void DateTimeLocalInputType::countUsage() {
56 countUsageIfVisible(UseCounter::InputTypeDateTimeLocal); 63 countUsageIfVisible(UseCounter::InputTypeDateTimeLocal);
57 } 64 }
58 65
59 const AtomicString& DateTimeLocalInputType::formControlType() const { 66 const AtomicString& DateTimeLocalInputType::formControlType() const {
60 return InputTypeNames::datetime_local; 67 return InputTypeNames::datetime_local;
61 } 68 }
62 69
63 double DateTimeLocalInputType::valueAsDate() const { 70 double DateTimeLocalInputType::valueAsDate() const {
64 // valueAsDate doesn't work for the datetime-local type according to the 71 // valueAsDate doesn't work for the datetime-local type according to the
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 bool hasWeek, 193 bool hasWeek,
187 bool hasDay, 194 bool hasDay,
188 bool hasAMPM, 195 bool hasAMPM,
189 bool hasHour, 196 bool hasHour,
190 bool hasMinute, 197 bool hasMinute,
191 bool hasSecond) const { 198 bool hasSecond) const {
192 return hasYear && hasMonth && hasDay && hasAMPM && hasHour && hasMinute; 199 return hasYear && hasMonth && hasDay && hasAMPM && hasHour && hasMinute;
193 } 200 }
194 201
195 } // namespace blink 202 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698