OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 m_composed(composedMode == ComposedMode::Composed), | 85 m_composed(composedMode == ComposedMode::Composed), |
86 m_isEventTypeScopedInV0(isEventTypeScopedInV0(eventType)), | 86 m_isEventTypeScopedInV0(isEventTypeScopedInV0(eventType)), |
87 m_propagationStopped(false), | 87 m_propagationStopped(false), |
88 m_immediatePropagationStopped(false), | 88 m_immediatePropagationStopped(false), |
89 m_defaultPrevented(false), | 89 m_defaultPrevented(false), |
90 m_defaultHandled(false), | 90 m_defaultHandled(false), |
91 m_cancelBubble(false), | 91 m_cancelBubble(false), |
92 m_wasInitialized(true), | 92 m_wasInitialized(true), |
93 m_isTrusted(false), | 93 m_isTrusted(false), |
94 m_preventDefaultCalledOnUncancelableEvent(false), | 94 m_preventDefaultCalledOnUncancelableEvent(false), |
95 m_handlingPassive(PassiveMode::NotPassive), | 95 m_handlingPassive(PassiveMode::NotPassiveDefault), |
96 m_eventPhase(0), | 96 m_eventPhase(0), |
97 m_currentTarget(nullptr), | 97 m_currentTarget(nullptr), |
98 m_platformTimeStamp(platformTimeStamp) {} | 98 m_platformTimeStamp(platformTimeStamp) {} |
99 | 99 |
100 Event::Event(const AtomicString& eventType, const EventInit& initializer) | 100 Event::Event(const AtomicString& eventType, const EventInit& initializer) |
101 : Event(eventType, | 101 : Event(eventType, |
102 initializer.bubbles(), | 102 initializer.bubbles(), |
103 initializer.cancelable(), | 103 initializer.cancelable(), |
104 initializer.composed() ? ComposedMode::Composed | 104 initializer.composed() ? ComposedMode::Composed |
105 : ComposedMode::Scoped, | 105 : ComposedMode::Scoped, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 bool Event::isBeforeTextInsertedEvent() const { | 213 bool Event::isBeforeTextInsertedEvent() const { |
214 return false; | 214 return false; |
215 } | 215 } |
216 | 216 |
217 bool Event::isBeforeUnloadEvent() const { | 217 bool Event::isBeforeUnloadEvent() const { |
218 return false; | 218 return false; |
219 } | 219 } |
220 | 220 |
221 void Event::preventDefault() { | 221 void Event::preventDefault() { |
222 if (m_handlingPassive != PassiveMode::NotPassive) { | 222 if (m_handlingPassive != PassiveMode::NotPassive && |
| 223 m_handlingPassive != PassiveMode::NotPassiveDefault) { |
223 m_preventDefaultCalledDuringPassive = true; | 224 m_preventDefaultCalledDuringPassive = true; |
224 | 225 |
225 const LocalDOMWindow* window = | 226 const LocalDOMWindow* window = |
226 m_eventPath ? m_eventPath->windowEventContext().window() : 0; | 227 m_eventPath ? m_eventPath->windowEventContext().window() : 0; |
227 if (window) { | 228 if (window) { |
228 const char* devToolsMsg = nullptr; | 229 const char* devToolsMsg = nullptr; |
229 switch (m_handlingPassive) { | 230 switch (m_handlingPassive) { |
230 case PassiveMode::NotPassive: | 231 case PassiveMode::NotPassive: |
| 232 case PassiveMode::NotPassiveDefault: |
231 NOTREACHED(); | 233 NOTREACHED(); |
232 break; | 234 break; |
233 case PassiveMode::Passive: | 235 case PassiveMode::Passive: |
| 236 case PassiveMode::PassiveDefault: |
234 devToolsMsg = | 237 devToolsMsg = |
235 "Unable to preventDefault inside passive event listener " | 238 "Unable to preventDefault inside passive event listener " |
236 "invocation."; | 239 "invocation."; |
237 break; | 240 break; |
238 case PassiveMode::PassiveForcedDocumentLevel: | 241 case PassiveMode::PassiveForcedDocumentLevel: |
239 devToolsMsg = | 242 devToolsMsg = |
240 "Unable to preventDefault inside passive event listener due to " | 243 "Unable to preventDefault inside passive event listener due to " |
241 "target being treated as passive. See " | 244 "target being treated as passive. See " |
242 "https://www.chromestatus.com/features/5093566007214080"; | 245 "https://www.chromestatus.com/features/5093566007214080"; |
243 break; | 246 break; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 367 } |
365 | 368 |
366 DEFINE_TRACE(Event) { | 369 DEFINE_TRACE(Event) { |
367 visitor->trace(m_currentTarget); | 370 visitor->trace(m_currentTarget); |
368 visitor->trace(m_target); | 371 visitor->trace(m_target); |
369 visitor->trace(m_underlyingEvent); | 372 visitor->trace(m_underlyingEvent); |
370 visitor->trace(m_eventPath); | 373 visitor->trace(m_eventPath); |
371 } | 374 } |
372 | 375 |
373 } // namespace blink | 376 } // namespace blink |
OLD | NEW |