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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // We don't need to call focus(). This function is called when control | 66 // We don't need to call focus(). This function is called when control |
67 // got focus. | 67 // got focus. |
68 | 68 |
69 // Add focus ring by CSS "focus" pseudo class. | 69 // Add focus ring by CSS "focus" pseudo class. |
70 element()->setFocus(true); | 70 element()->setFocus(true); |
71 } | 71 } |
72 | 72 |
73 void BaseMultipleFieldsDateAndTimeInputType::editControlValueChanged() | 73 void BaseMultipleFieldsDateAndTimeInputType::editControlValueChanged() |
74 { | 74 { |
75 RefPtr<HTMLInputElement> input(element()); | 75 RefPtr<HTMLInputElement> input(element()); |
76 input->setValueInternal(sanitizeValue(m_dateTimeEditElement->value()), Dispa
tchNoEvent); | 76 String oldValue = input->value(); |
77 input->setNeedsStyleRecalc(); | 77 String newValue = sanitizeValue(m_dateTimeEditElement->value()); |
78 input->dispatchFormControlInputEvent(); | 78 // Even if oldValue is null and newValue is "", we should assume they are sa
me. |
79 input->dispatchFormControlChangeEvent(); | 79 if ((oldValue.isEmpty() && newValue.isEmpty()) || oldValue == newValue) |
| 80 input->setNeedsValidityCheck(); |
| 81 else { |
| 82 input->setValueInternal(newValue, DispatchNoEvent); |
| 83 input->setNeedsStyleRecalc(); |
| 84 input->dispatchFormControlInputEvent(); |
| 85 input->dispatchFormControlChangeEvent(); |
| 86 } |
80 input->notifyFormStateChanged(); | 87 input->notifyFormStateChanged(); |
81 } | 88 } |
82 | 89 |
83 bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const | 90 bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const |
84 { | 91 { |
85 return false; | 92 return false; |
86 } | 93 } |
87 | 94 |
88 bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled() const | 95 bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled() const |
89 { | 96 { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 { | 441 { |
435 StepRange stepRange = createStepRange(AnyIsDefaultStep); | 442 StepRange stepRange = createStepRange(AnyIsDefaultStep); |
436 return date.second() || date.millisecond() | 443 return date.second() || date.millisecond() |
437 || !stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero(
) | 444 || !stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero(
) |
438 || !stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); | 445 || !stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); |
439 } | 446 } |
440 | 447 |
441 } // namespace WebCore | 448 } // namespace WebCore |
442 | 449 |
443 #endif | 450 #endif |
OLD | NEW |