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

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

Issue 23623017: Prepare for date/time input datalist support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 DateTimeEditElement* edit = this->dateTimeEditElement(); 256 DateTimeEditElement* edit = this->dateTimeEditElement();
257 if (!edit) 257 if (!edit)
258 return; 258 return;
259 DateComponents date; 259 DateComponents date;
260 unsigned end; 260 unsigned end;
261 if (date.parseDate(value, 0, end) && end == value.length()) 261 if (date.parseDate(value, 0, end) && end == value.length())
262 edit->setOnlyYearMonthDay(date); 262 edit->setOnlyYearMonthDay(date);
263 } 263 }
264 264
265 void BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorChooseValue(double v alue)
266 {
267 if (std::isnan(value))
268 element().setValue(String(), DispatchInputAndChangeEvent);
tkent 2013/11/07 01:43:10 Ditto.
269 else
270 element().setValueAsNumber(value, ASSERT_NO_EXCEPTION, DispatchInputAndC hangeEvent);
271 }
272
265 bool BaseMultipleFieldsDateAndTimeInputType::setupDateTimeChooserParameters(Date TimeChooserParameters& parameters) 273 bool BaseMultipleFieldsDateAndTimeInputType::setupDateTimeChooserParameters(Date TimeChooserParameters& parameters)
266 { 274 {
267 return element().setupDateTimeChooserParameters(parameters); 275 return element().setupDateTimeChooserParameters(parameters);
268 } 276 }
269 277
270 BaseMultipleFieldsDateAndTimeInputType::BaseMultipleFieldsDateAndTimeInputType(H TMLInputElement& element) 278 BaseMultipleFieldsDateAndTimeInputType::BaseMultipleFieldsDateAndTimeInputType(H TMLInputElement& element)
271 : BaseDateAndTimeInputType(element) 279 : BaseDateAndTimeInputType(element)
272 , m_isDestroyingShadowSubtree(false) 280 , m_isDestroyingShadowSubtree(false)
273 , m_pickerIndicatorIsVisible(false) 281 , m_pickerIndicatorIsVisible(false)
274 , m_pickerIndicatorIsAlwaysVisible(false) 282 , m_pickerIndicatorIsAlwaysVisible(false)
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 605
598 if (element().isRequired() || !dateTimeEditElement()->anyEditableFieldsHaveV alues()) 606 if (element().isRequired() || !dateTimeEditElement()->anyEditableFieldsHaveV alues())
599 clearButton->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidde n); 607 clearButton->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidde n);
600 else 608 else
601 clearButton->removeInlineStyleProperty(CSSPropertyVisibility); 609 clearButton->removeInlineStyleProperty(CSSPropertyVisibility);
602 } 610 }
603 611
604 } // namespace WebCore 612 } // namespace WebCore
605 613
606 #endif 614 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698