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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 if (!containsFocusedShadowElement()) | 182 if (!containsFocusedShadowElement()) |
183 return; | 183 return; |
184 // Add focus ring by CSS "focus" pseudo class. | 184 // Add focus ring by CSS "focus" pseudo class. |
185 // FIXME: Setting the focus flag to non-focused element is too tricky. | 185 // FIXME: Setting the focus flag to non-focused element is too tricky. |
186 element().setFocus(true); | 186 element().setFocus(true); |
187 } | 187 } |
188 | 188 |
189 void MultipleFieldsTemporalInputTypeView::editControlValueChanged() { | 189 void MultipleFieldsTemporalInputTypeView::editControlValueChanged() { |
190 String oldValue = element().value(); | 190 String oldValue = element().value(); |
191 String newValue = m_inputType->sanitizeValue(dateTimeEditElement()->value()); | 191 String newValue = m_inputType->sanitizeValue(dateTimeEditElement()->value()); |
192 // Even if oldValue is null and newValue is "", we should assume they are same
. | 192 // Even if oldValue is null and newValue is "", we should assume they are |
| 193 // same. |
193 if ((oldValue.isEmpty() && newValue.isEmpty()) || oldValue == newValue) { | 194 if ((oldValue.isEmpty() && newValue.isEmpty()) || oldValue == newValue) { |
194 element().setNeedsValidityCheck(); | 195 element().setNeedsValidityCheck(); |
195 } else { | 196 } else { |
196 element().setValueInternal(newValue, DispatchNoEvent); | 197 element().setValueInternal(newValue, DispatchNoEvent); |
197 element().setNeedsStyleRecalc( | 198 element().setNeedsStyleRecalc( |
198 SubtreeStyleChange, | 199 SubtreeStyleChange, |
199 StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue)); | 200 StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue)); |
200 element().dispatchFormControlInputEvent(); | 201 element().dispatchFormControlInputEvent(); |
201 } | 202 } |
202 element().notifyFormStateChanged(); | 203 element().notifyFormStateChanged(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 style->setDirection(contentDirection); | 344 style->setDirection(contentDirection); |
344 style->setDisplay(newDisplay); | 345 style->setDisplay(newDisplay); |
345 style->setUnique(); | 346 style->setUnique(); |
346 return style.release(); | 347 return style.release(); |
347 } | 348 } |
348 | 349 |
349 void MultipleFieldsTemporalInputTypeView::createShadowSubtree() { | 350 void MultipleFieldsTemporalInputTypeView::createShadowSubtree() { |
350 DCHECK(element().shadow()); | 351 DCHECK(element().shadow()); |
351 | 352 |
352 // Element must not have a layoutObject here, because if it did | 353 // Element must not have a layoutObject here, because if it did |
353 // DateTimeEditElement::customStyleForLayoutObject() is called in appendChild(
) | 354 // DateTimeEditElement::customStyleForLayoutObject() is called in |
354 // before the field wrapper element is created. | 355 // appendChild() before the field wrapper element is created. |
355 // FIXME: This code should not depend on such craziness. | 356 // FIXME: This code should not depend on such craziness. |
356 DCHECK(!element().layoutObject()); | 357 DCHECK(!element().layoutObject()); |
357 | 358 |
358 Document& document = element().document(); | 359 Document& document = element().document(); |
359 ContainerNode* container = element().userAgentShadowRoot(); | 360 ContainerNode* container = element().userAgentShadowRoot(); |
360 | 361 |
361 container->appendChild(DateTimeEditElement::create(document, *this)); | 362 container->appendChild(DateTimeEditElement::create(document, *this)); |
362 element().updateView(); | 363 element().updateView(); |
363 container->appendChild(ClearButtonElement::create(document, *this)); | 364 container->appendChild(ClearButtonElement::create(document, *this)); |
364 container->appendChild(SpinButtonElement::create(document, *this)); | 365 container->appendChild(SpinButtonElement::create(document, *this)); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 return element().locale().isRTL() ? RTL : LTR; | 625 return element().locale().isRTL() ? RTL : LTR; |
625 } | 626 } |
626 | 627 |
627 AXObject* MultipleFieldsTemporalInputTypeView::popupRootAXObject() { | 628 AXObject* MultipleFieldsTemporalInputTypeView::popupRootAXObject() { |
628 if (PickerIndicatorElement* picker = pickerIndicatorElement()) | 629 if (PickerIndicatorElement* picker = pickerIndicatorElement()) |
629 return picker->popupRootAXObject(); | 630 return picker->popupRootAXObject(); |
630 return nullptr; | 631 return nullptr; |
631 } | 632 } |
632 | 633 |
633 } // namespace blink | 634 } // namespace blink |
OLD | NEW |