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

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

Issue 1352523002: Use high precision timestamp for Event.timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 2 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>); 115 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>);
116 116
117 EventTarget* currentTarget() const; 117 EventTarget* currentTarget() const;
118 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = curren tTarget; } 118 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = curren tTarget; }
119 119
120 unsigned short eventPhase() const { return m_eventPhase; } 120 unsigned short eventPhase() const { return m_eventPhase; }
121 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; } 121 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; }
122 122
123 bool bubbles() const { return m_canBubble; } 123 bool bubbles() const { return m_canBubble; }
124 bool cancelable() const { return m_cancelable; } 124 bool cancelable() const { return m_cancelable; }
125 DOMTimeStamp timeStamp() const { return m_createTime; } 125
126 // Event creation timestamp in milliseconds. If |HiResEventTimeStamp|
127 // runtime feature is enabled it returns a DOMHighResTimeStamp using the
128 // platform timestamp (see |m_platformTimeStamp|) otherwise it returns a
129 // DOMTimeStamp that represents the current object's construction time (see
130 // |m_createTime|). For more info see http://crbug.com/160524
131 double timeStamp(ScriptState*) const;
132 double platformTimeStamp() const { return m_platformTimeStamp; }
133 void setPlatformTimeStamp(double platformTimeStamp) { m_platformTimeStamp = platformTimeStamp; }
126 134
127 void stopPropagation() { m_propagationStopped = true; } 135 void stopPropagation() { m_propagationStopped = true; }
128 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } 136 void stopImmediatePropagation() { m_immediatePropagationStopped = true; }
129 137
130 // IE Extensions 138 // IE Extensions
131 EventTarget* srcElement() const { return target(); } // MSIE extension - "th e object that fired the event" 139 EventTarget* srcElement() const { return target(); } // MSIE extension - "th e object that fired the event"
132 140
133 bool legacyReturnValue(ExecutionContext*) const; 141 bool legacyReturnValue(ExecutionContext*) const;
134 void setLegacyReturnValue(ExecutionContext*, bool returnValue); 142 void setLegacyReturnValue(ExecutionContext*, bool returnValue);
135 143
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 Event* underlyingEvent() const { return m_underlyingEvent.get(); } 184 Event* underlyingEvent() const { return m_underlyingEvent.get(); }
177 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>); 185 void setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event>);
178 186
179 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } 187 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; }
180 void initEventPath(Node&); 188 void initEventPath(Node&);
181 189
182 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; 190 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const;
183 191
184 bool isBeingDispatched() const { return eventPhase(); } 192 bool isBeingDispatched() const { return eventPhase(); }
185 193
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 194 // Events that must not leak across isolated world, similar to how
190 // ErrorEvent behaves, can override this method. 195 // ErrorEvent behaves, can override this method.
191 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t rue; } 196 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t rue; }
192 197
193 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator(); 198 virtual PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator();
194 199
195 bool isTrusted() const { return m_isTrusted; } 200 bool isTrusted() const { return m_isTrusted; }
196 void setTrusted(bool value) { m_isTrusted = value; } 201 void setTrusted(bool value) { m_isTrusted = value; }
197 202
198 DECLARE_VIRTUAL_TRACE(); 203 DECLARE_VIRTUAL_TRACE();
(...skipping 19 matching lines...) Expand all
218 unsigned m_defaultHandled:1; 223 unsigned m_defaultHandled:1;
219 unsigned m_cancelBubble:1; 224 unsigned m_cancelBubble:1;
220 unsigned m_isTrusted : 1; 225 unsigned m_isTrusted : 1;
221 226
222 unsigned short m_eventPhase; 227 unsigned short m_eventPhase;
223 RefPtrWillBeMember<EventTarget> m_currentTarget; 228 RefPtrWillBeMember<EventTarget> m_currentTarget;
224 RefPtrWillBeMember<EventTarget> m_target; 229 RefPtrWillBeMember<EventTarget> m_target;
225 DOMTimeStamp m_createTime; 230 DOMTimeStamp m_createTime;
226 RefPtrWillBeMember<Event> m_underlyingEvent; 231 RefPtrWillBeMember<Event> m_underlyingEvent;
227 OwnPtrWillBeMember<EventPath> m_eventPath; 232 OwnPtrWillBeMember<EventPath> m_eventPath;
228 double m_uiCreateTime; // For input events, the time the event was recorded by the UI. 233 // The monotonic platform time in seconds, for input events it is the
234 // event timestamp provided by the host OS and reported in the original
235 // WebInputEvent instance.
236 double m_platformTimeStamp;
229 }; 237 };
230 238
231 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ 239 #define DEFINE_EVENT_TYPE_CASTS(typeName) \
232 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t ypeName()) 240 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t ypeName())
233 241
234 } // namespace blink 242 } // namespace blink
235 243
236 #endif // Event_h 244 #endif // Event_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698