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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
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 22 matching lines...) Expand all
33 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
34 #include "wtf/RefCounted.h" 34 #include "wtf/RefCounted.h"
35 #include "wtf/text/AtomicString.h" 35 #include "wtf/text/AtomicString.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class DOMWrapperWorld; 39 class DOMWrapperWorld;
40 class EventTarget; 40 class EventTarget;
41 class ExecutionContext; 41 class ExecutionContext;
42 42
43 class CORE_EXPORT Event : public RefCountedWillBeGarbageCollectedFinalized<Event >, public ScriptWrappable { 43 class CORE_EXPORT Event : public GarbageCollectedFinalized<Event>, public Scrip tWrappable {
44 DEFINE_WRAPPERTYPEINFO(); 44 DEFINE_WRAPPERTYPEINFO();
45 public: 45 public:
46 enum PhaseType { 46 enum PhaseType {
47 NONE = 0, 47 NONE = 0,
48 CAPTURING_PHASE = 1, 48 CAPTURING_PHASE = 1,
49 AT_TARGET = 2, 49 AT_TARGET = 2,
50 BUBBLING_PHASE = 3 50 BUBBLING_PHASE = 3
51 }; 51 };
52 52
53 enum EventType { 53 enum EventType {
(...skipping 14 matching lines...) Expand all
68 SELECT = 16384, 68 SELECT = 16384,
69 CHANGE = 32768 69 CHANGE = 32768
70 }; 70 };
71 71
72 enum RailsMode { 72 enum RailsMode {
73 RailsModeFree = 0, 73 RailsModeFree = 0,
74 RailsModeHorizontal = 1, 74 RailsModeHorizontal = 1,
75 RailsModeVertical = 2 75 RailsModeVertical = 2
76 }; 76 };
77 77
78 static PassRefPtrWillBeRawPtr<Event> create() 78 static RawPtr<Event> create()
79 { 79 {
80 return adoptRefWillBeNoop(new Event); 80 return adoptRefWillBeNoop(new Event);
81 } 81 }
82 82
83 // A factory for a simple event. The event doesn't bubble, and isn't 83 // A factory for a simple event. The event doesn't bubble, and isn't
84 // cancelable. 84 // cancelable.
85 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#fire-a-simple-event 85 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#fire-a-simple-event
86 static PassRefPtrWillBeRawPtr<Event> create(const AtomicString& type) 86 static RawPtr<Event> create(const AtomicString& type)
87 { 87 {
88 return adoptRefWillBeNoop(new Event(type, false, false)); 88 return new Event(type, false, false);
89 } 89 }
90 static PassRefPtrWillBeRawPtr<Event> createCancelable(const AtomicString& ty pe) 90 static RawPtr<Event> createCancelable(const AtomicString& type)
91 { 91 {
92 return adoptRefWillBeNoop(new Event(type, false, true)); 92 return new Event(type, false, true);
93 } 93 }
94 static PassRefPtrWillBeRawPtr<Event> createBubble(const AtomicString& type) 94 static RawPtr<Event> createBubble(const AtomicString& type)
95 { 95 {
96 return adoptRefWillBeNoop(new Event(type, true, false)); 96 return new Event(type, true, false);
97 } 97 }
98 static PassRefPtrWillBeRawPtr<Event> createCancelableBubble(const AtomicStri ng& type) 98 static RawPtr<Event> createCancelableBubble(const AtomicString& type)
99 { 99 {
100 return adoptRefWillBeNoop(new Event(type, true, true)); 100 return new Event(type, true, true);
101 } 101 }
102 102
103 static PassRefPtrWillBeRawPtr<Event> create(const AtomicString& type, const EventInit& initializer) 103 static RawPtr<Event> create(const AtomicString& type, const EventInit& initi alizer)
104 { 104 {
105 return adoptRefWillBeNoop(new Event(type, initializer)); 105 return new Event(type, initializer);
106 } 106 }
107 107
108 virtual ~Event(); 108 virtual ~Event();
109 109
110 void initEvent(const AtomicString& type, bool canBubble, bool cancelable); 110 void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
111 void initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool can celableArg, EventTarget* relatedTarget); 111 void initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool can celableArg, EventTarget* relatedTarget);
112 112
113 const AtomicString& type() const { return m_type; } 113 const AtomicString& type() const { return m_type; }
114 void setType(const AtomicString& type) { m_type = type; } 114 void setType(const AtomicString& type) { m_type = type; }
115 115
116 EventTarget* target() const { return m_target.get(); } 116 EventTarget* target() const { return m_target.get(); }
117 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>); 117 void setTarget(RawPtr<EventTarget>);
118 118
119 EventTarget* currentTarget() const; 119 EventTarget* currentTarget() const;
120 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = curren tTarget; } 120 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = curren tTarget; }
121 121
122 unsigned short eventPhase() const { return m_eventPhase; } 122 unsigned short eventPhase() const { return m_eventPhase; }
123 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; } 123 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; }
124 124
125 bool bubbles() const { return m_canBubble; } 125 bool bubbles() const { return m_canBubble; }
126 bool cancelable() const { return m_cancelable; } 126 bool cancelable() const { return m_cancelable; }
127 bool scoped() const { return m_scoped; } 127 bool scoped() const { return m_scoped; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 virtual void preventDefault(); 176 virtual void preventDefault();
177 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defau ltPrevented; } 177 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defau ltPrevented; }
178 178
179 bool defaultHandled() const { return m_defaultHandled; } 179 bool defaultHandled() const { return m_defaultHandled; }
180 void setDefaultHandled() { m_defaultHandled = true; } 180 void setDefaultHandled() { m_defaultHandled = true; }
181 181
182 bool cancelBubble() const { return m_cancelBubble; } 182 bool cancelBubble() const { return m_cancelBubble; }
183 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; } 183 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
184 184
185 Event* underlyingEvent() const { return m_underlyingEvent.get(); } 185 Event* underlyingEvent() const { return m_underlyingEvent.get(); }
186 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>); 186 void setUnderlyingEvent(RawPtr<Event>);
187 187
188 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } 188 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; }
189 void initEventPath(Node&); 189 void initEventPath(Node&);
190 190
191 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; 191 HeapVector<Member<EventTarget>> path(ScriptState*) const;
192 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> deepPath(ScriptState*) con st; 192 HeapVector<Member<EventTarget>> deepPath(ScriptState*) const;
193 193
194 bool isBeingDispatched() const { return eventPhase(); } 194 bool isBeingDispatched() const { return eventPhase(); }
195 195
196 // Events that must not leak across isolated world, similar to how 196 // Events that must not leak across isolated world, similar to how
197 // ErrorEvent behaves, can override this method. 197 // ErrorEvent behaves, can override this method.
198 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t rue; } 198 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t rue; }
199 199
200 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator(); 200 virtual RawPtr<EventDispatchMediator> createMediator();
201 201
202 bool isTrusted() const { return m_isTrusted; } 202 bool isTrusted() const { return m_isTrusted; }
203 void setTrusted(bool value) { m_isTrusted = value; } 203 void setTrusted(bool value) { m_isTrusted = value; }
204 204
205 void setHandlingPassive(bool value) { m_handlingPassive = value; } 205 void setHandlingPassive(bool value) { m_handlingPassive = value; }
206 206
207 DECLARE_VIRTUAL_TRACE(); 207 DECLARE_VIRTUAL_TRACE();
208 208
209 protected: 209 protected:
210 Event(); 210 Event();
211 Event(const AtomicString& type, bool canBubble, bool cancelable); 211 Event(const AtomicString& type, bool canBubble, bool cancelable);
212 Event(const AtomicString& type, bool canBubble, bool cancelable, EventTarget * relatedTarget); 212 Event(const AtomicString& type, bool canBubble, bool cancelable, EventTarget * relatedTarget);
213 Event(const AtomicString& type, bool canBubble, bool cancelable, double plat formTimeStamp); 213 Event(const AtomicString& type, bool canBubble, bool cancelable, double plat formTimeStamp);
214 Event(const AtomicString& type, bool canBubble, bool cancelable, EventTarget * relatedTarget, double platformTimeStamp); 214 Event(const AtomicString& type, bool canBubble, bool cancelable, EventTarget * relatedTarget, double platformTimeStamp);
215 Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped ); 215 Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped );
216 Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped , bool relatedTargetScoped, double platformTimeStamp); 216 Event(const AtomicString& type, bool canBubble, bool cancelable, bool scoped , bool relatedTargetScoped, double platformTimeStamp);
217 Event(const AtomicString& type, const EventInit&); 217 Event(const AtomicString& type, const EventInit&);
218 218
219 virtual void receivedTarget(); 219 virtual void receivedTarget();
220 bool dispatched() const { return m_target; } 220 bool dispatched() const { return m_target; }
221 221
222 void setCanBubble(bool bubble) { m_canBubble = bubble; } 222 void setCanBubble(bool bubble) { m_canBubble = bubble; }
223 223
224 private: 224 private:
225 enum EventPathMode { 225 enum EventPathMode {
226 EmptyAfterDispatch, 226 EmptyAfterDispatch,
227 NonEmptyAfterDispatch 227 NonEmptyAfterDispatch
228 }; 228 };
229 229
230 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> pathInternal(ScriptState*, EventPathMode) const; 230 HeapVector<Member<EventTarget>> pathInternal(ScriptState*, EventPathMode) co nst;
231 231
232 AtomicString m_type; 232 AtomicString m_type;
233 unsigned m_canBubble:1; 233 unsigned m_canBubble:1;
234 unsigned m_cancelable:1; 234 unsigned m_cancelable:1;
235 unsigned m_scoped:1; 235 unsigned m_scoped:1;
236 unsigned m_relatedTargetScoped:1; 236 unsigned m_relatedTargetScoped:1;
237 237
238 unsigned m_propagationStopped:1; 238 unsigned m_propagationStopped:1;
239 unsigned m_immediatePropagationStopped:1; 239 unsigned m_immediatePropagationStopped:1;
240 unsigned m_defaultPrevented:1; 240 unsigned m_defaultPrevented:1;
241 unsigned m_defaultHandled:1; 241 unsigned m_defaultHandled:1;
242 unsigned m_cancelBubble:1; 242 unsigned m_cancelBubble:1;
243 unsigned m_isTrusted : 1; 243 unsigned m_isTrusted : 1;
244 unsigned m_handlingPassive : 1; 244 unsigned m_handlingPassive : 1;
245 245
246 unsigned short m_eventPhase; 246 unsigned short m_eventPhase;
247 RefPtrWillBeMember<EventTarget> m_currentTarget; 247 Member<EventTarget> m_currentTarget;
248 RefPtrWillBeMember<EventTarget> m_target; 248 Member<EventTarget> m_target;
249 DOMTimeStamp m_createTime; 249 DOMTimeStamp m_createTime;
250 RefPtrWillBeMember<Event> m_underlyingEvent; 250 Member<Event> m_underlyingEvent;
251 OwnPtrWillBeMember<EventPath> m_eventPath; 251 Member<EventPath> m_eventPath;
252 // The monotonic platform time in seconds, for input events it is the 252 // The monotonic platform time in seconds, for input events it is the
253 // event timestamp provided by the host OS and reported in the original 253 // event timestamp provided by the host OS and reported in the original
254 // WebInputEvent instance. 254 // WebInputEvent instance.
255 double m_platformTimeStamp; 255 double m_platformTimeStamp;
256 }; 256 };
257 257
258 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ 258 #define DEFINE_EVENT_TYPE_CASTS(typeName) \
259 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t ypeName()) 259 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t ypeName())
260 260
261 } // namespace blink 261 } // namespace blink
262 262
263 #endif // Event_h 263 #endif // Event_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/ErrorEvent.h ('k') | third_party/WebKit/Source/core/events/Event.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698