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

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

Issue 159893007: Revert of Update of change event for datetime input type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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();
190 } 191 }
191 input->notifyFormStateChanged(); 192 input->notifyFormStateChanged();
192 input->updateClearButtonVisibility(); 193 input->updateClearButtonVisibility();
193 } 194 }
194 195
195 bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const 196 bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const
196 { 197 {
197 return false; 198 return false;
198 } 199 }
199 200
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return; 257 return;
257 } 258 }
258 259
259 DateTimeEditElement* edit = this->dateTimeEditElement(); 260 DateTimeEditElement* edit = this->dateTimeEditElement();
260 if (!edit) 261 if (!edit)
261 return; 262 return;
262 DateComponents date; 263 DateComponents date;
263 unsigned end; 264 unsigned end;
264 if (date.parseDate(value, 0, end) && end == value.length()) 265 if (date.parseDate(value, 0, end) && end == value.length())
265 edit->setOnlyYearMonthDay(date); 266 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
456 void BaseMultipleFieldsDateAndTimeInputType::minOrMaxAttributeChanged() 451 void BaseMultipleFieldsDateAndTimeInputType::minOrMaxAttributeChanged()
457 { 452 {
458 updateView(); 453 updateView();
459 } 454 }
460 455
461 void BaseMultipleFieldsDateAndTimeInputType::readonlyAttributeChanged() 456 void BaseMultipleFieldsDateAndTimeInputType::readonlyAttributeChanged()
462 { 457 {
463 spinButtonElement()->releaseCapture(); 458 spinButtonElement()->releaseCapture();
464 clearButtonElement()->releaseCapture(); 459 clearButtonElement()->releaseCapture();
465 if (DateTimeEditElement* edit = dateTimeEditElement()) 460 if (DateTimeEditElement* edit = dateTimeEditElement())
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 clearButton->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNo ne); 607 clearButton->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNo ne);
613 } else { 608 } else {
614 clearButton->removeInlineStyleProperty(CSSPropertyOpacity); 609 clearButton->removeInlineStyleProperty(CSSPropertyOpacity);
615 clearButton->removeInlineStyleProperty(CSSPropertyPointerEvents); 610 clearButton->removeInlineStyleProperty(CSSPropertyPointerEvents);
616 } 611 }
617 } 612 }
618 613
619 } // namespace WebCore 614 } // namespace WebCore
620 615
621 #endif 616 #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