| 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, 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 RailsModeFree = 0, | 72 RailsModeFree = 0, |
| 73 RailsModeHorizontal = 1, | 73 RailsModeHorizontal = 1, |
| 74 RailsModeVertical = 2 | 74 RailsModeVertical = 2 |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 enum class ComposedMode { | 77 enum class ComposedMode { |
| 78 Composed, | 78 Composed, |
| 79 Scoped, | 79 Scoped, |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 enum class PassiveMode { |
| 83 NotPassive, |
| 84 Passive, |
| 85 PassiveForcedDocumentLevel, |
| 86 }; |
| 87 |
| 82 static Event* create() | 88 static Event* create() |
| 83 { | 89 { |
| 84 return new Event; | 90 return new Event; |
| 85 } | 91 } |
| 86 | 92 |
| 87 // A factory for a simple event. The event doesn't bubble, and isn't | 93 // A factory for a simple event. The event doesn't bubble, and isn't |
| 88 // cancelable. | 94 // cancelable. |
| 89 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht
ml#fire-a-simple-event | 95 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht
ml#fire-a-simple-event |
| 90 static Event* create(const AtomicString& type) | 96 static Event* create(const AtomicString& type) |
| 91 { | 97 { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 210 |
| 205 // Events that must not leak across isolated world, similar to how | 211 // Events that must not leak across isolated world, similar to how |
| 206 // ErrorEvent behaves, can override this method. | 212 // ErrorEvent behaves, can override this method. |
| 207 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t
rue; } | 213 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t
rue; } |
| 208 | 214 |
| 209 virtual EventDispatchMediator* createMediator(); | 215 virtual EventDispatchMediator* createMediator(); |
| 210 | 216 |
| 211 bool isTrusted() const { return m_isTrusted; } | 217 bool isTrusted() const { return m_isTrusted; } |
| 212 void setTrusted(bool value) { m_isTrusted = value; } | 218 void setTrusted(bool value) { m_isTrusted = value; } |
| 213 | 219 |
| 214 void setHandlingPassive(bool value); | 220 void setHandlingPassive(PassiveMode); |
| 215 | 221 |
| 216 bool preventDefaultCalledDuringPassive() const { return m_preventDefaultCall
edDuringPassive; } | 222 bool preventDefaultCalledDuringPassive() const { return m_preventDefaultCall
edDuringPassive; } |
| 217 | 223 |
| 218 bool preventDefaultCalledOnUncancelableEvent() const { return m_preventDefau
ltCalledOnUncancelableEvent; } | 224 bool preventDefaultCalledOnUncancelableEvent() const { return m_preventDefau
ltCalledOnUncancelableEvent; } |
| 219 | 225 |
| 220 DECLARE_VIRTUAL_TRACE(); | 226 DECLARE_VIRTUAL_TRACE(); |
| 221 | 227 |
| 222 protected: | 228 protected: |
| 223 Event(); | 229 Event(); |
| 224 Event(const AtomicString& type, bool canBubble, bool cancelable, ComposedMod
e, double platformTimeStamp); | 230 Event(const AtomicString& type, bool canBubble, bool cancelable, ComposedMod
e, double platformTimeStamp); |
| 225 Event(const AtomicString& type, bool canBubble, bool cancelable, double plat
formTimeStamp); | 231 Event(const AtomicString& type, bool canBubble, bool cancelable, double plat
formTimeStamp); |
| 226 Event(const AtomicString& type, bool canBubble, bool cancelable, ComposedMod
e = ComposedMode::Scoped); | 232 Event(const AtomicString& type, bool canBubble, bool cancelable, ComposedMod
e = ComposedMode::Scoped); |
| 227 Event(const AtomicString& type, const EventInit&); | 233 Event(const AtomicString& type, const EventInit&); |
| 228 | 234 |
| 229 virtual void receivedTarget(); | 235 virtual void receivedTarget(); |
| 230 | 236 |
| 231 void setCanBubble(bool bubble) { m_canBubble = bubble; } | 237 void setCanBubble(bool bubble) { m_canBubble = bubble; } |
| 232 | 238 |
| 239 PassiveMode handlingPassive() const { return m_handlingPassive; } |
| 240 |
| 233 private: | 241 private: |
| 234 | 242 |
| 235 enum EventPathMode { | 243 enum EventPathMode { |
| 236 EmptyAfterDispatch, | 244 EmptyAfterDispatch, |
| 237 NonEmptyAfterDispatch | 245 NonEmptyAfterDispatch |
| 238 }; | 246 }; |
| 239 | 247 |
| 240 HeapVector<Member<EventTarget>> pathInternal(ScriptState*, EventPathMode) co
nst; | 248 HeapVector<Member<EventTarget>> pathInternal(ScriptState*, EventPathMode) co
nst; |
| 241 | 249 |
| 242 AtomicString m_type; | 250 AtomicString m_type; |
| 243 unsigned m_canBubble:1; | 251 unsigned m_canBubble:1; |
| 244 unsigned m_cancelable:1; | 252 unsigned m_cancelable:1; |
| 245 unsigned m_composed:1; | 253 unsigned m_composed:1; |
| 246 unsigned m_isEventTypeScopedInV0:1; | 254 unsigned m_isEventTypeScopedInV0:1; |
| 247 | 255 |
| 248 unsigned m_propagationStopped:1; | 256 unsigned m_propagationStopped:1; |
| 249 unsigned m_immediatePropagationStopped:1; | 257 unsigned m_immediatePropagationStopped:1; |
| 250 unsigned m_defaultPrevented:1; | 258 unsigned m_defaultPrevented:1; |
| 251 unsigned m_defaultHandled:1; | 259 unsigned m_defaultHandled:1; |
| 252 unsigned m_cancelBubble:1; | 260 unsigned m_cancelBubble:1; |
| 253 unsigned m_wasInitialized:1; | 261 unsigned m_wasInitialized:1; |
| 254 unsigned m_isTrusted : 1; | 262 unsigned m_isTrusted : 1; |
| 255 unsigned m_handlingPassive : 1; | |
| 256 | 263 |
| 257 // Whether preventDefault was called when |m_handlingPassive| is | 264 // Whether preventDefault was called when |m_handlingPassive| is |
| 258 // true. This field is reset on each call to setHandlingPassive. | 265 // true. This field is reset on each call to setHandlingPassive. |
| 259 unsigned m_preventDefaultCalledDuringPassive : 1; | 266 unsigned m_preventDefaultCalledDuringPassive : 1; |
| 260 // Whether preventDefault was called on uncancelable event. | 267 // Whether preventDefault was called on uncancelable event. |
| 261 unsigned m_preventDefaultCalledOnUncancelableEvent : 1; | 268 unsigned m_preventDefaultCalledOnUncancelableEvent : 1; |
| 262 | 269 |
| 270 PassiveMode m_handlingPassive; |
| 263 unsigned short m_eventPhase; | 271 unsigned short m_eventPhase; |
| 264 Member<EventTarget> m_currentTarget; | 272 Member<EventTarget> m_currentTarget; |
| 265 Member<EventTarget> m_target; | 273 Member<EventTarget> m_target; |
| 266 Member<Event> m_underlyingEvent; | 274 Member<Event> m_underlyingEvent; |
| 267 Member<EventPath> m_eventPath; | 275 Member<EventPath> m_eventPath; |
| 268 // The monotonic platform time in seconds, for input events it is the | 276 // The monotonic platform time in seconds, for input events it is the |
| 269 // event timestamp provided by the host OS and reported in the original | 277 // event timestamp provided by the host OS and reported in the original |
| 270 // WebInputEvent instance. | 278 // WebInputEvent instance. |
| 271 double m_platformTimeStamp; | 279 double m_platformTimeStamp; |
| 272 }; | 280 }; |
| 273 | 281 |
| 274 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ | 282 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ |
| 275 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t
ypeName()) | 283 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t
ypeName()) |
| 276 | 284 |
| 277 } // namespace blink | 285 } // namespace blink |
| 278 | 286 |
| 279 #endif // Event_h | 287 #endif // Event_h |
| OLD | NEW |