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 16 matching lines...) Expand all Loading... | |
27 #include "core/events/EventTarget.h" | 27 #include "core/events/EventTarget.h" |
28 #include "core/frame/OriginsUsingFeatures.h" | 28 #include "core/frame/OriginsUsingFeatures.h" |
29 #include "core/frame/UseCounter.h" | 29 #include "core/frame/UseCounter.h" |
30 #include "core/svg/SVGElement.h" | 30 #include "core/svg/SVGElement.h" |
31 #include "core/timing/DOMWindowPerformance.h" | 31 #include "core/timing/DOMWindowPerformance.h" |
32 #include "core/timing/Performance.h" | 32 #include "core/timing/Performance.h" |
33 #include "wtf/CurrentTime.h" | 33 #include "wtf/CurrentTime.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 static bool defaultScopedFromEventType(const AtomicString& eventType) | |
38 { | |
39 return (eventType == EventTypeNames::abort | |
40 || eventType == EventTypeNames::change | |
41 || eventType == EventTypeNames::error | |
42 || eventType == EventTypeNames::load | |
43 || eventType == EventTypeNames::reset | |
44 || eventType == EventTypeNames::resize | |
45 || eventType == EventTypeNames::scroll | |
46 || eventType == EventTypeNames::select | |
47 || eventType == EventTypeNames::selectstart); | |
48 } | |
49 | |
37 Event::Event() | 50 Event::Event() |
38 : Event("", false, false) | 51 : Event("", false, false, false) |
39 { | 52 { |
40 } | 53 } |
41 | 54 |
42 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g) | 55 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g) |
43 : Event(eventType, canBubbleArg, cancelableArg, monotonicallyIncreasingTime( )) | 56 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), monotonicallyIncreasingTime()) |
44 { | 57 { |
45 } | 58 } |
46 | 59 |
47 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) | 60 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) |
61 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), platformTimeStamp) | |
62 { | |
63 } | |
64 | |
65 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool scoped) | |
66 : Event(eventType, canBubbleArg, cancelableArg, scoped, monotonicallyIncreas ingTime()) | |
67 { | |
68 } | |
69 | |
70 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool scoped, double platformTimeStamp) | |
48 : m_type(eventType) | 71 : m_type(eventType) |
49 , m_canBubble(canBubbleArg) | 72 , m_canBubble(canBubbleArg) |
50 , m_cancelable(cancelableArg) | 73 , m_cancelable(cancelableArg) |
74 , m_scoped(scoped) | |
51 , m_propagationStopped(false) | 75 , m_propagationStopped(false) |
52 , m_immediatePropagationStopped(false) | 76 , m_immediatePropagationStopped(false) |
53 , m_defaultPrevented(false) | 77 , m_defaultPrevented(false) |
54 , m_defaultHandled(false) | 78 , m_defaultHandled(false) |
55 , m_cancelBubble(false) | 79 , m_cancelBubble(false) |
56 , m_isTrusted(false) | 80 , m_isTrusted(false) |
57 , m_handlingPassive(false) | 81 , m_handlingPassive(false) |
58 , m_eventPhase(0) | 82 , m_eventPhase(0) |
59 , m_currentTarget(nullptr) | 83 , m_currentTarget(nullptr) |
60 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) | 84 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) |
61 , m_platformTimeStamp(platformTimeStamp) | 85 , m_platformTimeStamp(platformTimeStamp) |
62 { | 86 { |
63 } | 87 } |
64 | 88 |
65 Event::Event(const AtomicString& eventType, const EventInit& initializer) | 89 Event::Event(const AtomicString& eventType, const EventInit& initializer) |
66 : Event(eventType, initializer.bubbles(), initializer.cancelable()) | 90 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali zer.scoped()) |
hayato
2016/01/22 07:16:25
Maybe we might want to measure the usage of "scope
| |
67 { | 91 { |
68 } | 92 } |
69 | 93 |
70 Event::~Event() | 94 Event::~Event() |
71 { | 95 { |
72 } | 96 } |
73 | 97 |
74 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg) | 98 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg) |
75 { | 99 { |
76 if (dispatched()) | 100 if (dispatched()) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 | 321 |
298 DEFINE_TRACE(Event) | 322 DEFINE_TRACE(Event) |
299 { | 323 { |
300 visitor->trace(m_currentTarget); | 324 visitor->trace(m_currentTarget); |
301 visitor->trace(m_target); | 325 visitor->trace(m_target); |
302 visitor->trace(m_underlyingEvent); | 326 visitor->trace(m_underlyingEvent); |
303 visitor->trace(m_eventPath); | 327 visitor->trace(m_eventPath); |
304 } | 328 } |
305 | 329 |
306 } // namespace blink | 330 } // namespace blink |
OLD | NEW |