| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #ifndef Event_h | 24 #ifndef Event_h |
| 25 #define Event_h | 25 #define Event_h |
| 26 | 26 |
| 27 #include "bindings/core/v8/ScriptWrappable.h" | 27 #include "bindings/core/v8/ScriptWrappable.h" |
| 28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
| 29 #include "core/dom/DOMHighResTimeStamp.h" |
| 29 #include "core/dom/DOMTimeStamp.h" | 30 #include "core/dom/DOMTimeStamp.h" |
| 30 #include "core/events/EventInit.h" | 31 #include "core/events/EventInit.h" |
| 31 #include "core/events/EventPath.h" | 32 #include "core/events/EventPath.h" |
| 32 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
| 33 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
| 34 #include "wtf/text/AtomicString.h" | 35 #include "wtf/text/AtomicString.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 class DOMWrapperWorld; | 39 class DOMWrapperWorld; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>); | 116 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>); |
| 116 | 117 |
| 117 EventTarget* currentTarget() const; | 118 EventTarget* currentTarget() const; |
| 118 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = curren
tTarget; } | 119 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = curren
tTarget; } |
| 119 | 120 |
| 120 unsigned short eventPhase() const { return m_eventPhase; } | 121 unsigned short eventPhase() const { return m_eventPhase; } |
| 121 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; } | 122 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; } |
| 122 | 123 |
| 123 bool bubbles() const { return m_canBubble; } | 124 bool bubbles() const { return m_canBubble; } |
| 124 bool cancelable() const { return m_cancelable; } | 125 bool cancelable() const { return m_cancelable; } |
| 125 DOMTimeStamp timeStamp() const { return m_createTime; } | 126 |
| 127 // Event creation timestamp in milliseconds. If |HiResEventTimeStamp| |
| 128 // runtime feature is enabled it returns a DOMHighResTimeStamp using the |
| 129 // platform timestamp (see |m_platformTimeStamp|) otherwise it returns a |
| 130 // DOMTimeStamp that represents the current object's construction time (see |
| 131 // |m_createTime|). For more info see http://crbug.com/160524 |
| 132 double timeStamp(ScriptState*) const; |
| 133 double platformTimeStamp() const { return m_platformTimeStamp; } |
| 134 void setPlatformTimeStamp(double platformTimeStamp) { m_platformTimeStamp =
platformTimeStamp; } |
| 135 DOMTimeStamp createTime() const { return m_createTime; } |
| 126 | 136 |
| 127 void stopPropagation() { m_propagationStopped = true; } | 137 void stopPropagation() { m_propagationStopped = true; } |
| 128 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } | 138 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } |
| 129 | 139 |
| 130 // IE Extensions | 140 // IE Extensions |
| 131 EventTarget* srcElement() const { return target(); } // MSIE extension - "th
e object that fired the event" | 141 EventTarget* srcElement() const { return target(); } // MSIE extension - "th
e object that fired the event" |
| 132 | 142 |
| 133 bool legacyReturnValue(ExecutionContext*) const; | 143 bool legacyReturnValue(ExecutionContext*) const; |
| 134 void setLegacyReturnValue(ExecutionContext*, bool returnValue); | 144 void setLegacyReturnValue(ExecutionContext*, bool returnValue); |
| 135 | 145 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 Event* underlyingEvent() const { return m_underlyingEvent.get(); } | 186 Event* underlyingEvent() const { return m_underlyingEvent.get(); } |
| 177 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>); | 187 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>); |
| 178 | 188 |
| 179 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } | 189 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } |
| 180 void initEventPath(Node&); | 190 void initEventPath(Node&); |
| 181 | 191 |
| 182 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; | 192 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; |
| 183 | 193 |
| 184 bool isBeingDispatched() const { return eventPhase(); } | 194 bool isBeingDispatched() const { return eventPhase(); } |
| 185 | 195 |
| 186 double uiCreateTime() const { return m_uiCreateTime; } | |
| 187 void setUICreateTime(double uiCreateTime) { m_uiCreateTime = uiCreateTime; } | |
| 188 | |
| 189 // Events that must not leak across isolated world, similar to how | 196 // Events that must not leak across isolated world, similar to how |
| 190 // ErrorEvent behaves, can override this method. | 197 // ErrorEvent behaves, can override this method. |
| 191 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t
rue; } | 198 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t
rue; } |
| 192 | 199 |
| 193 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator(); | 200 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator(); |
| 194 | 201 |
| 195 bool isTrusted() const { return m_isTrusted; } | 202 bool isTrusted() const { return m_isTrusted; } |
| 196 void setTrusted(bool value) { m_isTrusted = value; } | 203 void setTrusted(bool value) { m_isTrusted = value; } |
| 197 | 204 |
| 198 DECLARE_VIRTUAL_TRACE(); | 205 DECLARE_VIRTUAL_TRACE(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 218 unsigned m_defaultHandled:1; | 225 unsigned m_defaultHandled:1; |
| 219 unsigned m_cancelBubble:1; | 226 unsigned m_cancelBubble:1; |
| 220 unsigned m_isTrusted : 1; | 227 unsigned m_isTrusted : 1; |
| 221 | 228 |
| 222 unsigned short m_eventPhase; | 229 unsigned short m_eventPhase; |
| 223 RefPtrWillBeMember<EventTarget> m_currentTarget; | 230 RefPtrWillBeMember<EventTarget> m_currentTarget; |
| 224 RefPtrWillBeMember<EventTarget> m_target; | 231 RefPtrWillBeMember<EventTarget> m_target; |
| 225 DOMTimeStamp m_createTime; | 232 DOMTimeStamp m_createTime; |
| 226 RefPtrWillBeMember<Event> m_underlyingEvent; | 233 RefPtrWillBeMember<Event> m_underlyingEvent; |
| 227 OwnPtrWillBeMember<EventPath> m_eventPath; | 234 OwnPtrWillBeMember<EventPath> m_eventPath; |
| 228 double m_uiCreateTime; // For input events, the time the event was recorded
by the UI. | 235 // 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 |
| 237 // WebInputEvent instance. |
| 238 double m_platformTimeStamp; |
| 229 }; | 239 }; |
| 230 | 240 |
| 231 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ | 241 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ |
| 232 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t
ypeName()) | 242 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t
ypeName()) |
| 233 | 243 |
| 234 } // namespace blink | 244 } // namespace blink |
| 235 | 245 |
| 236 #endif // Event_h | 246 #endif // Event_h |
| OLD | NEW |