| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // These events lack a DOM interface. | 162 // These events lack a DOM interface. |
| 163 virtual bool isClipboardEvent() const; | 163 virtual bool isClipboardEvent() const; |
| 164 virtual bool isBeforeTextInsertedEvent() const; | 164 virtual bool isBeforeTextInsertedEvent() const; |
| 165 | 165 |
| 166 virtual bool isBeforeUnloadEvent() const; | 166 virtual bool isBeforeUnloadEvent() const; |
| 167 | 167 |
| 168 bool propagationStopped() const { return m_propagationStopped || m_immediate
PropagationStopped; } | 168 bool propagationStopped() const { return m_propagationStopped || m_immediate
PropagationStopped; } |
| 169 bool immediatePropagationStopped() const { return m_immediatePropagationStop
ped; } | 169 bool immediatePropagationStopped() const { return m_immediatePropagationStop
ped; } |
| 170 | 170 |
| 171 bool defaultPrevented() const { return m_defaultPrevented; } | 171 bool defaultPrevented() const { return m_defaultPrevented; } |
| 172 virtual void preventDefault() | 172 virtual void preventDefault(); |
| 173 { | |
| 174 if (m_cancelable) | |
| 175 m_defaultPrevented = true; | |
| 176 } | |
| 177 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defau
ltPrevented; } | 173 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defau
ltPrevented; } |
| 178 | 174 |
| 179 bool defaultHandled() const { return m_defaultHandled; } | 175 bool defaultHandled() const { return m_defaultHandled; } |
| 180 void setDefaultHandled() { m_defaultHandled = true; } | 176 void setDefaultHandled() { m_defaultHandled = true; } |
| 181 | 177 |
| 182 bool cancelBubble() const { return m_cancelBubble; } | 178 bool cancelBubble() const { return m_cancelBubble; } |
| 183 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; } | 179 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; } |
| 184 | 180 |
| 185 Event* underlyingEvent() const { return m_underlyingEvent.get(); } | 181 Event* underlyingEvent() const { return m_underlyingEvent.get(); } |
| 186 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>); | 182 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>); |
| 187 | 183 |
| 188 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } | 184 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } |
| 189 void initEventPath(Node&); | 185 void initEventPath(Node&); |
| 190 | 186 |
| 191 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; | 187 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; |
| 192 | 188 |
| 193 bool isBeingDispatched() const { return eventPhase(); } | 189 bool isBeingDispatched() const { return eventPhase(); } |
| 194 | 190 |
| 195 // Events that must not leak across isolated world, similar to how | 191 // Events that must not leak across isolated world, similar to how |
| 196 // ErrorEvent behaves, can override this method. | 192 // ErrorEvent behaves, can override this method. |
| 197 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t
rue; } | 193 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t
rue; } |
| 198 | 194 |
| 199 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator(); | 195 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator(); |
| 200 | 196 |
| 201 bool isTrusted() const { return m_isTrusted; } | 197 bool isTrusted() const { return m_isTrusted; } |
| 202 void setTrusted(bool value) { m_isTrusted = value; } | 198 void setTrusted(bool value) { m_isTrusted = value; } |
| 203 | 199 |
| 200 void setHandlingPassive(bool value) { m_handlingPassive = value; } |
| 201 |
| 204 DECLARE_VIRTUAL_TRACE(); | 202 DECLARE_VIRTUAL_TRACE(); |
| 205 | 203 |
| 206 protected: | 204 protected: |
| 207 Event(); | 205 Event(); |
| 208 Event(const AtomicString& type, bool canBubble, bool cancelable); | 206 Event(const AtomicString& type, bool canBubble, bool cancelable); |
| 209 Event(const AtomicString& type, bool canBubble, bool cancelable, double plat
formTimeStamp); | 207 Event(const AtomicString& type, bool canBubble, bool cancelable, double plat
formTimeStamp); |
| 210 Event(const AtomicString& type, const EventInit&); | 208 Event(const AtomicString& type, const EventInit&); |
| 211 | 209 |
| 212 virtual void receivedTarget(); | 210 virtual void receivedTarget(); |
| 213 bool dispatched() const { return m_target; } | 211 bool dispatched() const { return m_target; } |
| 214 | 212 |
| 215 void setCanBubble(bool bubble) { m_canBubble = bubble; } | 213 void setCanBubble(bool bubble) { m_canBubble = bubble; } |
| 216 | 214 |
| 217 private: | 215 private: |
| 218 AtomicString m_type; | 216 AtomicString m_type; |
| 219 unsigned m_canBubble:1; | 217 unsigned m_canBubble:1; |
| 220 unsigned m_cancelable:1; | 218 unsigned m_cancelable:1; |
| 221 | 219 |
| 222 unsigned m_propagationStopped:1; | 220 unsigned m_propagationStopped:1; |
| 223 unsigned m_immediatePropagationStopped:1; | 221 unsigned m_immediatePropagationStopped:1; |
| 224 unsigned m_defaultPrevented:1; | 222 unsigned m_defaultPrevented:1; |
| 225 unsigned m_defaultHandled:1; | 223 unsigned m_defaultHandled:1; |
| 226 unsigned m_cancelBubble:1; | 224 unsigned m_cancelBubble:1; |
| 227 unsigned m_isTrusted : 1; | 225 unsigned m_isTrusted : 1; |
| 226 unsigned m_handlingPassive : 1; |
| 228 | 227 |
| 229 unsigned short m_eventPhase; | 228 unsigned short m_eventPhase; |
| 230 RefPtrWillBeMember<EventTarget> m_currentTarget; | 229 RefPtrWillBeMember<EventTarget> m_currentTarget; |
| 231 RefPtrWillBeMember<EventTarget> m_target; | 230 RefPtrWillBeMember<EventTarget> m_target; |
| 232 DOMTimeStamp m_createTime; | 231 DOMTimeStamp m_createTime; |
| 233 RefPtrWillBeMember<Event> m_underlyingEvent; | 232 RefPtrWillBeMember<Event> m_underlyingEvent; |
| 234 OwnPtrWillBeMember<EventPath> m_eventPath; | 233 OwnPtrWillBeMember<EventPath> m_eventPath; |
| 235 // The monotonic platform time in seconds, for input events it is the | 234 // The monotonic platform time in seconds, for input events it is the |
| 236 // event timestamp provided by the host OS and reported in the original | 235 // event timestamp provided by the host OS and reported in the original |
| 237 // WebInputEvent instance. | 236 // WebInputEvent instance. |
| 238 double m_platformTimeStamp; | 237 double m_platformTimeStamp; |
| 239 }; | 238 }; |
| 240 | 239 |
| 241 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ | 240 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ |
| 242 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t
ypeName()) | 241 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t
ypeName()) |
| 243 | 242 |
| 244 } // namespace blink | 243 } // namespace blink |
| 245 | 244 |
| 246 #endif // Event_h | 245 #endif // Event_h |
| OLD | NEW |