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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 return HeapVector<Member<EventTarget>>(1, window); | 319 return HeapVector<Member<EventTarget>>(1, window); |
320 | 320 |
321 return HeapVector<Member<EventTarget>>(); | 321 return HeapVector<Member<EventTarget>>(); |
322 } | 322 } |
323 | 323 |
324 EventDispatchMediator* Event::createMediator() | 324 EventDispatchMediator* Event::createMediator() |
325 { | 325 { |
326 return EventDispatchMediator::create(this); | 326 return EventDispatchMediator::create(this); |
327 } | 327 } |
328 | 328 |
329 EventTarget* Event::currentTarget() const | |
330 { | |
331 if (!m_currentTarget) | |
332 return nullptr; | |
333 Node* node = m_currentTarget->toNode(); | |
334 if (node && node->isSVGElement()) { | |
335 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) | |
336 return svgElement; | |
337 } | |
338 return m_currentTarget.get(); | |
339 } | |
340 | |
341 double Event::timeStamp(ScriptState* scriptState) const | 329 double Event::timeStamp(ScriptState* scriptState) const |
342 { | 330 { |
343 double timeStamp = 0; | 331 double timeStamp = 0; |
344 // TODO(majidvp): Get rid of m_createTime once the flag is enabled by defaul
t; | 332 // TODO(majidvp): Get rid of m_createTime once the flag is enabled by defaul
t; |
345 if (UNLIKELY(RuntimeEnabledFeatures::hiResEventTimeStampEnabled())) { | 333 if (UNLIKELY(RuntimeEnabledFeatures::hiResEventTimeStampEnabled())) { |
346 // Only expose monotonic time after changing its origin to its target | 334 // Only expose monotonic time after changing its origin to its target |
347 // document's time origin. | 335 // document's time origin. |
348 if (scriptState && scriptState->domWindow()) { | 336 if (scriptState && scriptState->domWindow()) { |
349 Performance* performance = DOMWindowPerformance::performance(*script
State->domWindow()); | 337 Performance* performance = DOMWindowPerformance::performance(*script
State->domWindow()); |
350 timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platfo
rmTimeStamp); | 338 timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platfo
rmTimeStamp); |
(...skipping 16 matching lines...) Expand all Loading... |
367 | 355 |
368 DEFINE_TRACE(Event) | 356 DEFINE_TRACE(Event) |
369 { | 357 { |
370 visitor->trace(m_currentTarget); | 358 visitor->trace(m_currentTarget); |
371 visitor->trace(m_target); | 359 visitor->trace(m_target); |
372 visitor->trace(m_underlyingEvent); | 360 visitor->trace(m_underlyingEvent); |
373 visitor->trace(m_eventPath); | 361 visitor->trace(m_eventPath); |
374 } | 362 } |
375 | 363 |
376 } // namespace blink | 364 } // namespace blink |
OLD | NEW |