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/BaseMultipleFieldsDateAndTimeInputType.cpp

Issue 128153002: Update of change event for datetime input type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added keyboard change event Created 6 years, 11 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 RefPtr<HTMLInputElement> input(element()); 180 RefPtr<HTMLInputElement> input(element());
181 String oldValue = input->value(); 181 String oldValue = input->value();
182 String newValue = sanitizeValue(dateTimeEditElement()->value()); 182 String newValue = sanitizeValue(dateTimeEditElement()->value());
183 // Even if oldValue is null and newValue is "", we should assume they are sa me. 183 // Even if oldValue is null and newValue is "", we should assume they are sa me.
184 if ((oldValue.isEmpty() && newValue.isEmpty()) || oldValue == newValue) { 184 if ((oldValue.isEmpty() && newValue.isEmpty()) || oldValue == newValue) {
185 input->setNeedsValidityCheck(); 185 input->setNeedsValidityCheck();
186 } else { 186 } else {
187 input->setValueInternal(newValue, DispatchNoEvent); 187 input->setValueInternal(newValue, DispatchNoEvent);
188 input->setNeedsStyleRecalc(); 188 input->setNeedsStyleRecalc();
189 input->dispatchFormControlInputEvent(); 189 input->dispatchFormControlInputEvent();
190 input->dispatchFormControlChangeEvent();
191 } 190 }
192 input->notifyFormStateChanged(); 191 input->notifyFormStateChanged();
193 input->updateClearButtonVisibility(); 192 input->updateClearButtonVisibility();
194 } 193 }
195 194
196 bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const 195 bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const
197 { 196 {
198 return false; 197 return false;
199 } 198 }
200 199
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return; 256 return;
258 } 257 }
259 258
260 DateTimeEditElement* edit = this->dateTimeEditElement(); 259 DateTimeEditElement* edit = this->dateTimeEditElement();
261 if (!edit) 260 if (!edit)
262 return; 261 return;
263 DateComponents date; 262 DateComponents date;
264 unsigned end; 263 unsigned end;
265 if (date.parseDate(value, 0, end) && end == value.length()) 264 if (date.parseDate(value, 0, end) && end == value.length())
266 edit->setOnlyYearMonthDay(date); 265 edit->setOnlyYearMonthDay(date);
266 element().dispatchFormControlChangeEvent();
267 } 267 }
268 268
269 void BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorChooseValue(double v alue) 269 void BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorChooseValue(double v alue)
270 { 270 {
271 ASSERT(std::isfinite(value) || std::isnan(value)); 271 ASSERT(std::isfinite(value) || std::isnan(value));
272 if (std::isnan(value)) 272 if (std::isnan(value))
273 element().setValue(emptyString(), DispatchInputAndChangeEvent); 273 element().setValue(emptyString(), DispatchInputAndChangeEvent);
274 else 274 else
275 element().setValueAsNumber(value, ASSERT_NO_EXCEPTION, DispatchInputAndC hangeEvent); 275 element().setValueAsNumber(value, ASSERT_NO_EXCEPTION, DispatchInputAndC hangeEvent);
276 } 276 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 { 441 {
442 DateTimeEditElement* edit = dateTimeEditElement(); 442 DateTimeEditElement* edit = dateTimeEditElement();
443 return element().value().isEmpty() && edit && edit->anyEditableFieldsHaveVal ues(); 443 return element().value().isEmpty() && edit && edit->anyEditableFieldsHaveVal ues();
444 } 444 }
445 445
446 AtomicString BaseMultipleFieldsDateAndTimeInputType::localeIdentifier() const 446 AtomicString BaseMultipleFieldsDateAndTimeInputType::localeIdentifier() const
447 { 447 {
448 return element().computeInheritedLanguage(); 448 return element().computeInheritedLanguage();
449 } 449 }
450 450
451 void BaseMultipleFieldsDateAndTimeInputType::editControlDidChangeValueByKeyboard ()
452 {
453 element().dispatchFormControlChangeEvent();
454 }
455
451 void BaseMultipleFieldsDateAndTimeInputType::minOrMaxAttributeChanged() 456 void BaseMultipleFieldsDateAndTimeInputType::minOrMaxAttributeChanged()
452 { 457 {
453 updateView(); 458 updateView();
454 } 459 }
455 460
456 void BaseMultipleFieldsDateAndTimeInputType::readonlyAttributeChanged() 461 void BaseMultipleFieldsDateAndTimeInputType::readonlyAttributeChanged()
457 { 462 {
458 spinButtonElement()->releaseCapture(); 463 spinButtonElement()->releaseCapture();
459 clearButtonElement()->releaseCapture(); 464 clearButtonElement()->releaseCapture();
460 if (DateTimeEditElement* edit = dateTimeEditElement()) 465 if (DateTimeEditElement* edit = dateTimeEditElement())
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 clearButton->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNo ne); 612 clearButton->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNo ne);
608 } else { 613 } else {
609 clearButton->removeInlineStyleProperty(CSSPropertyOpacity); 614 clearButton->removeInlineStyleProperty(CSSPropertyOpacity);
610 clearButton->removeInlineStyleProperty(CSSPropertyPointerEvents); 615 clearButton->removeInlineStyleProperty(CSSPropertyPointerEvents);
611 } 616 }
612 } 617 }
613 618
614 } // namespace WebCore 619 } // namespace WebCore
615 620
616 #endif 621 #endif
OLDNEW
« no previous file with comments | « Source/core/html/forms/BaseMultipleFieldsDateAndTimeInputType.h ('k') | Source/core/html/shadow/DateTimeEditElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698