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/HostsUsingFeatures.h" | 28 #include "core/frame/HostsUsingFeatures.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 isScoped(const AtomicString& eventType) | 37 static bool isScoped(const AtomicString& eventType) |
kochi
2016/06/03 08:45:57
As the user of this function is now only isScopedI
hayato
2016/06/03 09:03:04
Done
| |
38 { | 38 { |
39 // WebKit never allowed selectstart event to cross the the shadow DOM bounda ry. | 39 // WebKit never allowed selectstart event to cross the the shadow DOM bounda ry. |
40 // Changing this breaks existing sites. | 40 // Changing this breaks existing sites. |
41 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. | 41 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. |
42 return (eventType == EventTypeNames::abort | 42 return (eventType == EventTypeNames::abort |
43 || eventType == EventTypeNames::change | 43 || eventType == EventTypeNames::change |
44 || eventType == EventTypeNames::error | 44 || eventType == EventTypeNames::error |
45 || eventType == EventTypeNames::load | 45 || eventType == EventTypeNames::load |
46 || eventType == EventTypeNames::reset | 46 || eventType == EventTypeNames::reset |
47 || eventType == EventTypeNames::resize | 47 || eventType == EventTypeNames::resize |
48 || eventType == EventTypeNames::scroll | 48 || eventType == EventTypeNames::scroll |
49 || eventType == EventTypeNames::select | 49 || eventType == EventTypeNames::select |
50 || eventType == EventTypeNames::selectstart | 50 || eventType == EventTypeNames::selectstart |
51 || eventType == EventTypeNames::slotchange); | 51 || eventType == EventTypeNames::slotchange); |
52 } | 52 } |
53 | 53 |
54 Event::Event() | 54 Event::Event() |
55 : Event("", false, false) | 55 : Event("", false, false) |
56 { | 56 { |
57 m_wasInitialized = false; | 57 m_wasInitialized = false; |
58 } | 58 } |
59 | 59 |
60 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g) | 60 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g) |
61 : Event(eventType, canBubbleArg, cancelableArg, !isScoped(eventType), monoto nicallyIncreasingTime()) | 61 : Event(eventType, canBubbleArg, cancelableArg, ComposedMode::Scoped, monoto nicallyIncreasingTime()) |
62 { | 62 { |
63 } | 63 } |
64 | 64 |
65 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) | 65 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) |
66 : Event(eventType, canBubbleArg, cancelableArg, !isScoped(eventType), platfo rmTimeStamp) | 66 : Event(eventType, canBubbleArg, cancelableArg, ComposedMode::Scoped, platfo rmTimeStamp) |
67 { | 67 { |
68 } | 68 } |
69 | 69 |
70 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool composed, double platformTimeStamp) | 70 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, ComposedMode composedMode) |
71 : Event(eventType, canBubbleArg, cancelableArg, composedMode, monotonicallyI ncreasingTime()) | |
72 { | |
73 } | |
74 | |
75 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, ComposedMode composedMode, double platformTimeStamp) | |
71 : m_type(eventType) | 76 : m_type(eventType) |
72 , m_canBubble(canBubbleArg) | 77 , m_canBubble(canBubbleArg) |
73 , m_cancelable(cancelableArg) | 78 , m_cancelable(cancelableArg) |
74 , m_composed(composed) | 79 , m_composed(composedMode == ComposedMode::Composed) |
75 , m_propagationStopped(false) | 80 , m_propagationStopped(false) |
76 , m_immediatePropagationStopped(false) | 81 , m_immediatePropagationStopped(false) |
77 , m_defaultPrevented(false) | 82 , m_defaultPrevented(false) |
78 , m_defaultHandled(false) | 83 , m_defaultHandled(false) |
79 , m_cancelBubble(false) | 84 , m_cancelBubble(false) |
80 , m_wasInitialized(true) | 85 , m_wasInitialized(true) |
81 , m_isTrusted(false) | 86 , m_isTrusted(false) |
82 , m_handlingPassive(false) | 87 , m_handlingPassive(false) |
83 , m_eventPhase(0) | 88 , m_eventPhase(0) |
84 , m_currentTarget(nullptr) | 89 , m_currentTarget(nullptr) |
85 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) | 90 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) |
86 , m_platformTimeStamp(platformTimeStamp) | 91 , m_platformTimeStamp(platformTimeStamp) |
87 { | 92 { |
88 } | 93 } |
89 | 94 |
90 Event::Event(const AtomicString& eventType, const EventInit& initializer) | 95 Event::Event(const AtomicString& eventType, const EventInit& initializer) |
91 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali zer.composed(), monotonicallyIncreasingTime()) | 96 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali zer.composed() ? ComposedMode::Composed : ComposedMode::Scoped, monotonicallyInc reasingTime()) |
92 { | 97 { |
93 } | 98 } |
94 | 99 |
95 Event::~Event() | 100 Event::~Event() |
96 { | 101 { |
97 } | 102 } |
98 | 103 |
99 bool Event::isScopedInV0() const | 104 bool Event::isScopedInV0() const |
100 { | 105 { |
101 return isTrusted() && isScoped(m_type); | 106 return isTrusted() && isScoped(m_type); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 | 364 |
360 DEFINE_TRACE(Event) | 365 DEFINE_TRACE(Event) |
361 { | 366 { |
362 visitor->trace(m_currentTarget); | 367 visitor->trace(m_currentTarget); |
363 visitor->trace(m_target); | 368 visitor->trace(m_target); |
364 visitor->trace(m_underlyingEvent); | 369 visitor->trace(m_underlyingEvent); |
365 visitor->trace(m_eventPath); | 370 visitor->trace(m_eventPath); |
366 } | 371 } |
367 | 372 |
368 } // namespace blink | 373 } // namespace blink |
OLD | NEW |