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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 { | 250 { |
251 if (!m_eventPath) { | 251 if (!m_eventPath) { |
252 m_eventPath = adoptPtrWillBeNoop(new EventPath(node, this)); | 252 m_eventPath = adoptPtrWillBeNoop(new EventPath(node, this)); |
253 } else { | 253 } else { |
254 m_eventPath->initializeWith(node, this); | 254 m_eventPath->initializeWith(node, this); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> Event::path(ScriptState* scrip
tState) const | 258 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> Event::path(ScriptState* scrip
tState) const |
259 { | 259 { |
| 260 return pathInternal(scriptState, NonEmptyAfterDispatch); |
| 261 } |
| 262 |
| 263 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> Event::deepPath(ScriptState* s
criptState) const |
| 264 { |
| 265 return pathInternal(scriptState, EmptyAfterDispatch); |
| 266 } |
| 267 |
| 268 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> Event::pathInternal(ScriptStat
e* scriptState, EventPathMode mode) const |
| 269 { |
260 if (m_target) | 270 if (m_target) |
261 OriginsUsingFeatures::countOriginOrIsolatedWorldHumanReadableName(script
State, *m_target, OriginsUsingFeatures::Feature::EventPath); | 271 OriginsUsingFeatures::countOriginOrIsolatedWorldHumanReadableName(script
State, *m_target, OriginsUsingFeatures::Feature::EventPath); |
262 | 272 |
263 if (!m_currentTarget) { | 273 if (!m_currentTarget) { |
264 ASSERT(m_eventPhase == Event::NONE); | 274 ASSERT(m_eventPhase == Event::NONE); |
265 if (!m_eventPath) { | 275 if (!m_eventPath) { |
266 // Before dispatching the event | 276 // Before dispatching the event |
267 return WillBeHeapVector<RefPtrWillBeMember<EventTarget>>(); | 277 return WillBeHeapVector<RefPtrWillBeMember<EventTarget>>(); |
268 } | 278 } |
269 ASSERT(!m_eventPath->isEmpty()); | 279 ASSERT(!m_eventPath->isEmpty()); |
270 // After dispatching the event | 280 // After dispatching the event |
| 281 if (mode == EmptyAfterDispatch) |
| 282 return WillBeHeapVector<RefPtrWillBeMember<EventTarget>>(); |
271 return m_eventPath->last().treeScopeEventContext().ensureEventPath(*m_ev
entPath); | 283 return m_eventPath->last().treeScopeEventContext().ensureEventPath(*m_ev
entPath); |
272 } | 284 } |
273 | 285 |
274 if (Node* node = m_currentTarget->toNode()) { | 286 if (Node* node = m_currentTarget->toNode()) { |
275 ASSERT(m_eventPath); | 287 ASSERT(m_eventPath); |
276 size_t eventPathSize = m_eventPath->size(); | 288 size_t eventPathSize = m_eventPath->size(); |
277 for (size_t i = 0; i < eventPathSize; ++i) { | 289 for (size_t i = 0; i < eventPathSize; ++i) { |
278 if (node == (*m_eventPath)[i].node()) { | 290 if (node == (*m_eventPath)[i].node()) { |
279 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath
(*m_eventPath); | 291 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath
(*m_eventPath); |
280 } | 292 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 339 |
328 DEFINE_TRACE(Event) | 340 DEFINE_TRACE(Event) |
329 { | 341 { |
330 visitor->trace(m_currentTarget); | 342 visitor->trace(m_currentTarget); |
331 visitor->trace(m_target); | 343 visitor->trace(m_target); |
332 visitor->trace(m_underlyingEvent); | 344 visitor->trace(m_underlyingEvent); |
333 visitor->trace(m_eventPath); | 345 visitor->trace(m_eventPath); |
334 } | 346 } |
335 | 347 |
336 } // namespace blink | 348 } // namespace blink |
OLD | NEW |