Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: third_party/WebKit/Source/core/events/Event.cpp

Issue 2012423004: Rename Event.scoped to Event.composed and invert its meaning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event-composed-path
Patch Set: rebased Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 defaultScopedFromEventType(const AtomicString& eventType) 37 static bool isScoped(const AtomicString& eventType)
38 { 38 {
39 // WebKit never allowed selectstart event to cross the the shadow DOM bounda ry.
40 // Changing this breaks existing sites.
41 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
39 return (eventType == EventTypeNames::abort 42 return (eventType == EventTypeNames::abort
40 || eventType == EventTypeNames::change 43 || eventType == EventTypeNames::change
41 || eventType == EventTypeNames::error 44 || eventType == EventTypeNames::error
42 || eventType == EventTypeNames::load 45 || eventType == EventTypeNames::load
43 || eventType == EventTypeNames::reset 46 || eventType == EventTypeNames::reset
44 || eventType == EventTypeNames::resize 47 || eventType == EventTypeNames::resize
45 || eventType == EventTypeNames::scroll 48 || eventType == EventTypeNames::scroll
46 || eventType == EventTypeNames::select 49 || eventType == EventTypeNames::select
47 || eventType == EventTypeNames::selectstart 50 || eventType == EventTypeNames::selectstart
48 || eventType == EventTypeNames::slotchange); 51 || eventType == EventTypeNames::slotchange);
49 } 52 }
50 53
51 Event::Event() 54 Event::Event()
52 : Event("", false, false, false) 55 : Event("", false, false, false)
53 { 56 {
54 m_wasInitialized = false; 57 m_wasInitialized = false;
55 } 58 }
56 59
57 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g) 60 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g)
58 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), false, monotonicallyIncreasingTime()) 61 : Event(eventType, canBubbleArg, cancelableArg, !isScoped(eventType), false, monotonicallyIncreasingTime())
59 { 62 {
60 } 63 }
61 64
62 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, EventTarget* relatedTarget) 65 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, EventTarget* relatedTarget)
63 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), relatedTarget ? true : false, monotonicallyIncreasingTime()) 66 : Event(eventType, canBubbleArg, cancelableArg, !isScoped(eventType), relate dTarget ? true : false, monotonicallyIncreasingTime())
64 { 67 {
65 } 68 }
66 69
67 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp) 70 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, double platformTimeStamp)
68 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), false, platformTimeStamp) 71 : Event(eventType, canBubbleArg, cancelableArg, !isScoped(eventType), false, platformTimeStamp)
69 { 72 {
70 } 73 }
71 74
72 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, EventTarget* relatedTarget, double platformTimeStamp) 75 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, EventTarget* relatedTarget, double platformTimeStamp)
73 : Event(eventType, canBubbleArg, cancelableArg, defaultScopedFromEventType(e ventType), relatedTarget ? true : false, platformTimeStamp) 76 : Event(eventType, canBubbleArg, cancelableArg, !isScoped(eventType), relate dTarget ? true : false, platformTimeStamp)
74 { 77 {
75 } 78 }
76 79
77 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool scoped) 80 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool composed)
78 : Event(eventType, canBubbleArg, cancelableArg, scoped, false, monotonically IncreasingTime()) 81 : Event(eventType, canBubbleArg, cancelableArg, composed, false, monotonical lyIncreasingTime())
79 { 82 {
80 } 83 }
81 84
82 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool scoped, bool relatedTargetScoped, double platformTimeStamp) 85 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr g, bool composed, bool relatedTargetScoped, double platformTimeStamp)
83 : m_type(eventType) 86 : m_type(eventType)
84 , m_canBubble(canBubbleArg) 87 , m_canBubble(canBubbleArg)
85 , m_cancelable(cancelableArg) 88 , m_cancelable(cancelableArg)
86 , m_scoped(scoped) 89 , m_composed(composed)
87 , m_relatedTargetScoped(relatedTargetScoped) 90 , m_relatedTargetScoped(relatedTargetScoped)
88 , m_propagationStopped(false) 91 , m_propagationStopped(false)
89 , m_immediatePropagationStopped(false) 92 , m_immediatePropagationStopped(false)
90 , m_defaultPrevented(false) 93 , m_defaultPrevented(false)
91 , m_defaultHandled(false) 94 , m_defaultHandled(false)
92 , m_cancelBubble(false) 95 , m_cancelBubble(false)
93 , m_wasInitialized(true) 96 , m_wasInitialized(true)
94 , m_isTrusted(false) 97 , m_isTrusted(false)
95 , m_handlingPassive(false) 98 , m_handlingPassive(false)
96 , m_eventPhase(0) 99 , m_eventPhase(0)
97 , m_currentTarget(nullptr) 100 , m_currentTarget(nullptr)
98 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) 101 , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
99 , m_platformTimeStamp(platformTimeStamp) 102 , m_platformTimeStamp(platformTimeStamp)
100 { 103 {
101 } 104 }
102 105
103 Event::Event(const AtomicString& eventType, const EventInit& initializer) 106 Event::Event(const AtomicString& eventType, const EventInit& initializer)
104 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali zer.scoped(), initializer.relatedTargetScoped(), monotonicallyIncreasingTime()) 107 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali zer.composed(), initializer.relatedTargetScoped(), monotonicallyIncreasingTime() )
105 { 108 {
106 } 109 }
107 110
108 Event::~Event() 111 Event::~Event()
109 { 112 {
110 } 113 }
111 114
115 bool Event::isScopedInV0() const
116 {
117 return isTrusted() && isScoped(m_type);
118 }
119
112 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg) 120 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg)
113 { 121 {
114 initEvent(eventTypeArg, canBubbleArg, cancelableArg, nullptr); 122 initEvent(eventTypeArg, canBubbleArg, cancelableArg, nullptr);
115 } 123 }
116 124
117 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget) 125 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget)
118 { 126 {
119 if (isBeingDispatched()) 127 if (isBeingDispatched())
120 return; 128 return;
121 129
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 377
370 DEFINE_TRACE(Event) 378 DEFINE_TRACE(Event)
371 { 379 {
372 visitor->trace(m_currentTarget); 380 visitor->trace(m_currentTarget);
373 visitor->trace(m_target); 381 visitor->trace(m_target);
374 visitor->trace(m_underlyingEvent); 382 visitor->trace(m_underlyingEvent);
375 visitor->trace(m_eventPath); 383 visitor->trace(m_eventPath);
376 } 384 }
377 385
378 } // namespace blink 386 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.h ('k') | third_party/WebKit/Source/core/events/Event.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698