OLD | NEW |
---|---|
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 Loading... | |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 return; | 251 return; |
253 } | 252 } |
254 | 253 |
255 DateTimeEditElement* edit = this->dateTimeEditElement(); | 254 DateTimeEditElement* edit = this->dateTimeEditElement(); |
256 if (!edit) | 255 if (!edit) |
257 return; | 256 return; |
258 DateComponents date; | 257 DateComponents date; |
259 unsigned end; | 258 unsigned end; |
260 if (date.parseDate(value, 0, end) && end == value.length()) | 259 if (date.parseDate(value, 0, end) && end == value.length()) |
261 edit->setOnlyYearMonthDay(date); | 260 edit->setOnlyYearMonthDay(date); |
261 element().dispatchFormControlChangeEvent(); | |
262 } | 262 } |
263 | 263 |
264 void BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorChooseValue(double v alue) | 264 void BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorChooseValue(double v alue) |
265 { | 265 { |
266 ASSERT(std::isfinite(value) || std::isnan(value)); | 266 ASSERT(std::isfinite(value) || std::isnan(value)); |
267 if (std::isnan(value)) | 267 if (std::isnan(value)) |
268 element().setValue(emptyString(), DispatchInputAndChangeEvent); | 268 element().setValue(emptyString(), DispatchInputAndChangeEvent); |
269 else | 269 else |
270 element().setValueAsNumber(value, ASSERT_NO_EXCEPTION, DispatchInputAndC hangeEvent); | 270 element().setValueAsNumber(value, ASSERT_NO_EXCEPTION, DispatchInputAndC hangeEvent); |
271 } | 271 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 void BaseMultipleFieldsDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* e vent) | 423 void BaseMultipleFieldsDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* e vent) |
424 { | 424 { |
425 if (m_pickerIndicatorIsVisible | 425 if (m_pickerIndicatorIsVisible |
426 && ((event->keyIdentifier() == "Down" && event->getModifierState("Alt")) || (RenderTheme::theme().shouldOpenPickerWithF4Key() && event->keyIdentifier() == "F4"))) { | 426 && ((event->keyIdentifier() == "Down" && event->getModifierState("Alt")) || (RenderTheme::theme().shouldOpenPickerWithF4Key() && event->keyIdentifier() == "F4"))) { |
427 if (PickerIndicatorElement* element = pickerIndicatorElement()) | 427 if (PickerIndicatorElement* element = pickerIndicatorElement()) |
428 element->openPopup(); | 428 element->openPopup(); |
429 event->setDefaultHandled(); | 429 event->setDefaultHandled(); |
430 } else { | 430 } else { |
431 forwardEvent(event); | 431 forwardEvent(event); |
432 } | 432 } |
433 element().dispatchFormControlChangeEvent(); | |
tkent
2014/01/20 02:05:22
We shouldn't put dispatchFormControlChangeEvent he
| |
433 } | 434 } |
434 | 435 |
435 bool BaseMultipleFieldsDateAndTimeInputType::hasBadInput() const | 436 bool BaseMultipleFieldsDateAndTimeInputType::hasBadInput() const |
436 { | 437 { |
437 DateTimeEditElement* edit = dateTimeEditElement(); | 438 DateTimeEditElement* edit = dateTimeEditElement(); |
438 return element().value().isEmpty() && edit && edit->anyEditableFieldsHaveVal ues(); | 439 return element().value().isEmpty() && edit && edit->anyEditableFieldsHaveVal ues(); |
439 } | 440 } |
440 | 441 |
441 AtomicString BaseMultipleFieldsDateAndTimeInputType::localeIdentifier() const | 442 AtomicString BaseMultipleFieldsDateAndTimeInputType::localeIdentifier() const |
442 { | 443 { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 clearButton->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNo ne); | 603 clearButton->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNo ne); |
603 } else { | 604 } else { |
604 clearButton->removeInlineStyleProperty(CSSPropertyOpacity); | 605 clearButton->removeInlineStyleProperty(CSSPropertyOpacity); |
605 clearButton->removeInlineStyleProperty(CSSPropertyPointerEvents); | 606 clearButton->removeInlineStyleProperty(CSSPropertyPointerEvents); |
606 } | 607 } |
607 } | 608 } |
608 | 609 |
609 } // namespace WebCore | 610 } // namespace WebCore |
610 | 611 |
611 #endif | 612 #endif |
OLD | NEW |