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, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 , m_propagationStopped(false) | 76 , m_propagationStopped(false) |
77 , m_immediatePropagationStopped(false) | 77 , m_immediatePropagationStopped(false) |
78 , m_defaultPrevented(false) | 78 , m_defaultPrevented(false) |
79 , m_defaultHandled(false) | 79 , m_defaultHandled(false) |
80 , m_cancelBubble(false) | 80 , m_cancelBubble(false) |
81 , m_wasInitialized(true) | 81 , m_wasInitialized(true) |
82 , m_isTrusted(false) | 82 , m_isTrusted(false) |
83 , m_handlingPassive(false) | 83 , m_handlingPassive(false) |
84 , m_eventPhase(0) | 84 , m_eventPhase(0) |
85 , m_currentTarget(nullptr) | 85 , m_currentTarget(nullptr) |
86 , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) | |
87 , m_platformTimeStamp(platformTimeStamp) | 86 , m_platformTimeStamp(platformTimeStamp) |
88 { | 87 { |
89 } | 88 } |
90 | 89 |
91 Event::Event(const AtomicString& eventType, const EventInit& initializer) | 90 Event::Event(const AtomicString& eventType, const EventInit& initializer) |
92 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali
zer.composed() ? ComposedMode::Composed : ComposedMode::Scoped, monotonicallyInc
reasingTime()) | 91 : Event(eventType, initializer.bubbles(), initializer.cancelable(), initiali
zer.composed() ? ComposedMode::Composed : ComposedMode::Scoped, monotonicallyInc
reasingTime()) |
93 { | 92 { |
94 } | 93 } |
95 | 94 |
96 Event::~Event() | 95 Event::~Event() |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 if (node && node->isSVGElement()) { | 333 if (node && node->isSVGElement()) { |
335 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) | 334 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) |
336 return svgElement; | 335 return svgElement; |
337 } | 336 } |
338 return m_currentTarget.get(); | 337 return m_currentTarget.get(); |
339 } | 338 } |
340 | 339 |
341 double Event::timeStamp(ScriptState* scriptState) const | 340 double Event::timeStamp(ScriptState* scriptState) const |
342 { | 341 { |
343 double timeStamp = 0; | 342 double timeStamp = 0; |
344 // TODO(majidvp): Get rid of m_createTime once the flag is enabled by defaul
t; | 343 if (scriptState && scriptState->domWindow()) { |
345 if (UNLIKELY(RuntimeEnabledFeatures::hiResEventTimeStampEnabled())) { | 344 Performance* performance = DOMWindowPerformance::performance(*scriptStat
e->domWindow()); |
346 // Only expose monotonic time after changing its origin to its target | 345 timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platformTi
meStamp); |
347 // document's time origin. | |
348 if (scriptState && scriptState->domWindow()) { | |
349 Performance* performance = DOMWindowPerformance::performance(*script
State->domWindow()); | |
350 timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platfo
rmTimeStamp); | |
351 } | |
352 } else { | |
353 timeStamp = m_createTime; | |
354 } | 346 } |
355 | 347 |
356 return timeStamp; | 348 return timeStamp; |
357 } | 349 } |
358 | 350 |
359 void Event::setCancelBubble(ExecutionContext* context, bool cancel) | 351 void Event::setCancelBubble(ExecutionContext* context, bool cancel) |
360 { | 352 { |
361 if (!m_cancelBubble && cancel) | 353 if (!m_cancelBubble && cancel) |
362 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToTrue
); | 354 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToTrue
); |
363 else if (m_cancelBubble && !cancel) | 355 else if (m_cancelBubble && !cancel) |
364 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToFals
e); | 356 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToFals
e); |
365 m_cancelBubble = cancel; | 357 m_cancelBubble = cancel; |
366 } | 358 } |
367 | 359 |
368 DEFINE_TRACE(Event) | 360 DEFINE_TRACE(Event) |
369 { | 361 { |
370 visitor->trace(m_currentTarget); | 362 visitor->trace(m_currentTarget); |
371 visitor->trace(m_target); | 363 visitor->trace(m_target); |
372 visitor->trace(m_underlyingEvent); | 364 visitor->trace(m_underlyingEvent); |
373 visitor->trace(m_eventPath); | 365 visitor->trace(m_eventPath); |
374 } | 366 } |
375 | 367 |
376 } // namespace blink | 368 } // namespace blink |
OLD | NEW |