| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/html/shadow/PickerIndicatorElement.h" | 33 #include "core/html/shadow/PickerIndicatorElement.h" |
| 34 | 34 |
| 35 #include "core/events/Event.h" | 35 #include "core/events/Event.h" |
| 36 #include "core/events/KeyboardEvent.h" | 36 #include "core/events/KeyboardEvent.h" |
| 37 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 38 #include "core/html/shadow/ShadowElementNames.h" | 38 #include "core/html/shadow/ShadowElementNames.h" |
| 39 #include "core/layout/LayoutDetailsMarker.h" | 39 #include "core/layout/LayoutDetailsMarker.h" |
| 40 #include "core/page/ChromeClient.h" | 40 #include "core/page/ChromeClient.h" |
| 41 #include "core/page/Page.h" | 41 #include "core/page/Page.h" |
| 42 #include "platform/LayoutTestSupport.h" | 42 #include "platform/LayoutTestSupport.h" |
| 43 #include "wtf/TemporaryChange.h" | |
| 44 | 43 |
| 45 using namespace WTF::Unicode; | 44 using namespace WTF::Unicode; |
| 46 | 45 |
| 47 namespace blink { | 46 namespace blink { |
| 48 | 47 |
| 49 using namespace HTMLNames; | 48 using namespace HTMLNames; |
| 50 | 49 |
| 51 inline PickerIndicatorElement::PickerIndicatorElement(Document& document, Picker
IndicatorOwner& pickerIndicatorOwner) | 50 inline PickerIndicatorElement::PickerIndicatorElement(Document& document, Picker
IndicatorOwner& pickerIndicatorOwner) |
| 52 : HTMLDivElement(document) | 51 : HTMLDivElement(document) |
| 53 , m_pickerIndicatorOwner(&pickerIndicatorOwner) | 52 , m_pickerIndicatorOwner(&pickerIndicatorOwner) |
| 54 , m_isInOpenPopup(false) | |
| 55 { | 53 { |
| 56 } | 54 } |
| 57 | 55 |
| 58 PassRefPtrWillBeRawPtr<PickerIndicatorElement> PickerIndicatorElement::create(Do
cument& document, PickerIndicatorOwner& pickerIndicatorOwner) | 56 PassRefPtrWillBeRawPtr<PickerIndicatorElement> PickerIndicatorElement::create(Do
cument& document, PickerIndicatorOwner& pickerIndicatorOwner) |
| 59 { | 57 { |
| 60 RefPtrWillBeRawPtr<PickerIndicatorElement> element = adoptRefWillBeNoop(new
PickerIndicatorElement(document, pickerIndicatorOwner)); | 58 RefPtrWillBeRawPtr<PickerIndicatorElement> element = adoptRefWillBeNoop(new
PickerIndicatorElement(document, pickerIndicatorOwner)); |
| 61 element->setShadowPseudoId(AtomicString("-webkit-calendar-picker-indicator",
AtomicString::ConstructFromLiteral)); | 59 element->setShadowPseudoId(AtomicString("-webkit-calendar-picker-indicator",
AtomicString::ConstructFromLiteral)); |
| 62 element->setAttribute(idAttr, ShadowElementNames::pickerIndicator()); | 60 element->setAttribute(idAttr, ShadowElementNames::pickerIndicator()); |
| 63 return element.release(); | 61 return element.release(); |
| 64 } | 62 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 m_pickerIndicatorOwner->pickerIndicatorChooseValue(value); | 115 m_pickerIndicatorOwner->pickerIndicatorChooseValue(value); |
| 118 } | 116 } |
| 119 | 117 |
| 120 void PickerIndicatorElement::didEndChooser() | 118 void PickerIndicatorElement::didEndChooser() |
| 121 { | 119 { |
| 122 m_chooser.clear(); | 120 m_chooser.clear(); |
| 123 } | 121 } |
| 124 | 122 |
| 125 void PickerIndicatorElement::openPopup() | 123 void PickerIndicatorElement::openPopup() |
| 126 { | 124 { |
| 127 // The m_isInOpenPopup flag is unnecessary in production. | |
| 128 // MockPagePopupDriver allows to execute JavaScript code in | |
| 129 // DateTimeChooserImpl constructor. It might create another DateTimeChooser. | |
| 130 if (m_isInOpenPopup) | |
| 131 return; | |
| 132 TemporaryChange<bool> reentrancyProtector(m_isInOpenPopup, true); | |
| 133 if (m_chooser) | 125 if (m_chooser) |
| 134 return; | 126 return; |
| 135 if (!document().page()) | 127 if (!document().page()) |
| 136 return; | 128 return; |
| 137 if (!m_pickerIndicatorOwner) | 129 if (!m_pickerIndicatorOwner) |
| 138 return; | 130 return; |
| 139 DateTimeChooserParameters parameters; | 131 DateTimeChooserParameters parameters; |
| 140 if (!m_pickerIndicatorOwner->setupDateTimeChooserParameters(parameters)) | 132 if (!m_pickerIndicatorOwner->setupDateTimeChooserParameters(parameters)) |
| 141 return; | 133 return; |
| 142 m_chooser = document().page()->chromeClient().openDateTimeChooser(this, para
meters); | 134 m_chooser = document().page()->chromeClient().openDateTimeChooser(this, para
meters); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 185 |
| 194 DEFINE_TRACE(PickerIndicatorElement) | 186 DEFINE_TRACE(PickerIndicatorElement) |
| 195 { | 187 { |
| 196 visitor->trace(m_pickerIndicatorOwner); | 188 visitor->trace(m_pickerIndicatorOwner); |
| 197 HTMLDivElement::trace(visitor); | 189 HTMLDivElement::trace(visitor); |
| 198 } | 190 } |
| 199 | 191 |
| 200 } | 192 } |
| 201 | 193 |
| 202 #endif | 194 #endif |
| OLD | NEW |