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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "core/events/Event.h" | 23 #include "core/events/Event.h" |
24 | 24 |
25 #include "core/dom/StaticNodeList.h" | 25 #include "core/dom/StaticNodeList.h" |
26 #include "core/events/EventDispatchMediator.h" | 26 #include "core/events/EventDispatchMediator.h" |
27 #include "core/events/EventTarget.h" | 27 #include "core/events/EventTarget.h" |
| 28 #include "core/frame/Deprecation.h" |
28 #include "core/frame/HostsUsingFeatures.h" | 29 #include "core/frame/HostsUsingFeatures.h" |
29 #include "core/frame/UseCounter.h" | 30 #include "core/frame/UseCounter.h" |
30 #include "core/svg/SVGElement.h" | 31 #include "core/svg/SVGElement.h" |
31 #include "core/timing/DOMWindowPerformance.h" | 32 #include "core/timing/DOMWindowPerformance.h" |
32 #include "core/timing/Performance.h" | 33 #include "core/timing/Performance.h" |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 static bool isEventTypeScopedInV0(const AtomicString& eventType) { | 37 static bool isEventTypeScopedInV0(const AtomicString& eventType) { |
37 // WebKit never allowed selectstart event to cross the the shadow DOM | 38 // WebKit never allowed selectstart event to cross the the shadow DOM |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 TimeTicks platformTimeStamp) | 81 TimeTicks platformTimeStamp) |
81 : m_type(eventType), | 82 : m_type(eventType), |
82 m_canBubble(canBubbleArg), | 83 m_canBubble(canBubbleArg), |
83 m_cancelable(cancelableArg), | 84 m_cancelable(cancelableArg), |
84 m_composed(composedMode == ComposedMode::Composed), | 85 m_composed(composedMode == ComposedMode::Composed), |
85 m_isEventTypeScopedInV0(isEventTypeScopedInV0(eventType)), | 86 m_isEventTypeScopedInV0(isEventTypeScopedInV0(eventType)), |
86 m_propagationStopped(false), | 87 m_propagationStopped(false), |
87 m_immediatePropagationStopped(false), | 88 m_immediatePropagationStopped(false), |
88 m_defaultPrevented(false), | 89 m_defaultPrevented(false), |
89 m_defaultHandled(false), | 90 m_defaultHandled(false), |
90 m_cancelBubble(false), | |
91 m_wasInitialized(true), | 91 m_wasInitialized(true), |
92 m_isTrusted(false), | 92 m_isTrusted(false), |
93 m_preventDefaultCalledOnUncancelableEvent(false), | 93 m_preventDefaultCalledOnUncancelableEvent(false), |
94 m_handlingPassive(PassiveMode::NotPassiveDefault), | 94 m_handlingPassive(PassiveMode::NotPassiveDefault), |
95 m_eventPhase(0), | 95 m_eventPhase(0), |
96 m_currentTarget(nullptr), | 96 m_currentTarget(nullptr), |
97 m_platformTimeStamp(platformTimeStamp) {} | 97 m_platformTimeStamp(platformTimeStamp) {} |
98 | 98 |
99 Event::Event(const AtomicString& eventType, const EventInit& initializer) | 99 Event::Event(const AtomicString& eventType, const EventInit& initializer) |
100 : Event(eventType, | 100 : Event(eventType, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 DOMWindowPerformance::performance(*scriptState->domWindow()); | 330 DOMWindowPerformance::performance(*scriptState->domWindow()); |
331 double timestampSeconds = (m_platformTimeStamp - TimeTicks()).InSecondsF(); | 331 double timestampSeconds = (m_platformTimeStamp - TimeTicks()).InSecondsF(); |
332 timeStamp = | 332 timeStamp = |
333 performance->monotonicTimeToDOMHighResTimeStamp(timestampSeconds); | 333 performance->monotonicTimeToDOMHighResTimeStamp(timestampSeconds); |
334 } | 334 } |
335 | 335 |
336 return timeStamp; | 336 return timeStamp; |
337 } | 337 } |
338 | 338 |
339 void Event::setCancelBubble(ExecutionContext* context, bool cancel) { | 339 void Event::setCancelBubble(ExecutionContext* context, bool cancel) { |
340 if (!m_cancelBubble && cancel) | 340 if (cancel) { |
341 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToTrue); | 341 m_propagationStopped = true; |
342 else if (m_cancelBubble && !cancel) | 342 } else { |
343 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToFalse); | 343 Deprecation::countDeprecation( |
344 m_cancelBubble = cancel; | 344 context, UseCounter::EventCancelBubbleWasChangedToFalse); |
| 345 } |
345 } | 346 } |
346 | 347 |
347 DEFINE_TRACE(Event) { | 348 DEFINE_TRACE(Event) { |
348 visitor->trace(m_currentTarget); | 349 visitor->trace(m_currentTarget); |
349 visitor->trace(m_target); | 350 visitor->trace(m_target); |
350 visitor->trace(m_underlyingEvent); | 351 visitor->trace(m_underlyingEvent); |
351 visitor->trace(m_eventPath); | 352 visitor->trace(m_eventPath); |
352 } | 353 } |
353 | 354 |
354 } // namespace blink | 355 } // namespace blink |
OLD | NEW |