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

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

Issue 2555743005: Add iterator support to blink::EventPath. (Closed)
Patch Set: Exposed the vector Created 4 years 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, 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 DCHECK(!m_eventPath->isEmpty()); 294 DCHECK(!m_eventPath->isEmpty());
295 // After dispatching the event 295 // After dispatching the event
296 if (mode == EmptyAfterDispatch) 296 if (mode == EmptyAfterDispatch)
297 return HeapVector<Member<EventTarget>>(); 297 return HeapVector<Member<EventTarget>>();
298 return m_eventPath->last().treeScopeEventContext().ensureEventPath( 298 return m_eventPath->last().treeScopeEventContext().ensureEventPath(
299 *m_eventPath); 299 *m_eventPath);
300 } 300 }
301 301
302 if (Node* node = m_currentTarget->toNode()) { 302 if (Node* node = m_currentTarget->toNode()) {
303 DCHECK(m_eventPath); 303 DCHECK(m_eventPath);
304 size_t eventPathSize = m_eventPath->size(); 304 for (auto& context : m_eventPath->nodeEventContexts()) {
305 for (size_t i = 0; i < eventPathSize; ++i) { 305 if (node == context.node())
306 if (node == (*m_eventPath)[i].node()) { 306 return context.treeScopeEventContext().ensureEventPath(*m_eventPath);
307 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath(
308 *m_eventPath);
309 }
310 } 307 }
311 NOTREACHED(); 308 NOTREACHED();
312 } 309 }
313 310
314 if (LocalDOMWindow* window = m_currentTarget->toLocalDOMWindow()) { 311 if (LocalDOMWindow* window = m_currentTarget->toLocalDOMWindow()) {
315 if (m_eventPath && !m_eventPath->isEmpty()) { 312 if (m_eventPath && !m_eventPath->isEmpty()) {
316 return m_eventPath->topNodeEventContext() 313 return m_eventPath->topNodeEventContext()
317 .treeScopeEventContext() 314 .treeScopeEventContext()
318 .ensureEventPath(*m_eventPath); 315 .ensureEventPath(*m_eventPath);
319 } 316 }
(...skipping 28 matching lines...) Expand all
348 } 345 }
349 346
350 DEFINE_TRACE(Event) { 347 DEFINE_TRACE(Event) {
351 visitor->trace(m_currentTarget); 348 visitor->trace(m_currentTarget);
352 visitor->trace(m_target); 349 visitor->trace(m_target);
353 visitor->trace(m_underlyingEvent); 350 visitor->trace(m_underlyingEvent);
354 visitor->trace(m_eventPath); 351 visitor->trace(m_eventPath);
355 } 352 }
356 353
357 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/TreeScope.cpp ('k') | third_party/WebKit/Source/core/events/EventPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698