| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (node && node->isSVGElement()) { | 326 if (node && node->isSVGElement()) { |
| 328 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) | 327 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) |
| 329 return svgElement; | 328 return svgElement; |
| 330 } | 329 } |
| 331 return m_currentTarget.get(); | 330 return m_currentTarget.get(); |
| 332 } | 331 } |
| 333 | 332 |
| 334 double Event::timeStamp(ScriptState* scriptState) const | 333 double Event::timeStamp(ScriptState* scriptState) const |
| 335 { | 334 { |
| 336 double timeStamp = 0; | 335 double timeStamp = 0; |
| 337 // TODO(majidvp): Get rid of m_createTime once the flag is enabled by defaul
t; | 336 if (scriptState && scriptState->domWindow()) { |
| 338 if (UNLIKELY(RuntimeEnabledFeatures::hiResEventTimeStampEnabled())) { | 337 Performance* performance = DOMWindowPerformance::performance(*scriptStat
e->domWindow()); |
| 339 // Only expose monotonic time after changing its origin to its target | 338 timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platformTi
meStamp); |
| 340 // document's time origin. | |
| 341 if (scriptState && scriptState->domWindow()) { | |
| 342 Performance* performance = DOMWindowPerformance::performance(*script
State->domWindow()); | |
| 343 timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platfo
rmTimeStamp); | |
| 344 } | |
| 345 } else { | |
| 346 timeStamp = m_createTime; | |
| 347 } | 339 } |
| 348 | 340 |
| 349 return timeStamp; | 341 return timeStamp; |
| 350 } | 342 } |
| 351 | 343 |
| 352 void Event::setCancelBubble(ExecutionContext* context, bool cancel) | 344 void Event::setCancelBubble(ExecutionContext* context, bool cancel) |
| 353 { | 345 { |
| 354 if (!m_cancelBubble && cancel) | 346 if (!m_cancelBubble && cancel) |
| 355 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToTrue
); | 347 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToTrue
); |
| 356 else if (m_cancelBubble && !cancel) | 348 else if (m_cancelBubble && !cancel) |
| 357 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToFals
e); | 349 UseCounter::count(context, UseCounter::EventCancelBubbleWasChangedToFals
e); |
| 358 m_cancelBubble = cancel; | 350 m_cancelBubble = cancel; |
| 359 } | 351 } |
| 360 | 352 |
| 361 DEFINE_TRACE(Event) | 353 DEFINE_TRACE(Event) |
| 362 { | 354 { |
| 363 visitor->trace(m_currentTarget); | 355 visitor->trace(m_currentTarget); |
| 364 visitor->trace(m_target); | 356 visitor->trace(m_target); |
| 365 visitor->trace(m_underlyingEvent); | 357 visitor->trace(m_underlyingEvent); |
| 366 visitor->trace(m_eventPath); | 358 visitor->trace(m_eventPath); |
| 367 } | 359 } |
| 368 | 360 |
| 369 } // namespace blink | 361 } // namespace blink |
| OLD | NEW |