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

Side by Side Diff: Source/core/dom/Event.cpp

Issue 15063004: Make Event.path() return a pre-calculated NodeList rather than calculating it dynamically. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add an include. Created 7 years, 7 months 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 | Annotate | Revision Log
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 for (Event* e = ue.get(); e; e = e->underlyingEvent()) 199 for (Event* e = ue.get(); e; e = e->underlyingEvent())
200 if (e == this) 200 if (e == this)
201 return; 201 return;
202 m_underlyingEvent = ue; 202 m_underlyingEvent = ue;
203 } 203 }
204 204
205 PassRefPtr<NodeList> Event::path() const 205 PassRefPtr<NodeList> Event::path() const
206 { 206 {
207 if (!m_currentTarget || !m_currentTarget->toNode()) 207 if (!m_currentTarget || !m_currentTarget->toNode())
208 return StaticNodeList::createEmpty(); 208 return StaticNodeList::createEmpty();
209 TreeScope* currentScope = m_currentTarget->toNode()->treeScope(); 209 Node* node = m_currentTarget->toNode();
210 Vector<RefPtr<Node> > nodes;
211 size_t eventPathSize = m_eventPath.size(); 210 size_t eventPathSize = m_eventPath.size();
212 for (size_t i = 0; i < eventPathSize; ++i) { 211 for (size_t i = 0; i < eventPathSize; ++i) {
213 Node* node = m_eventPath[i]->node(); 212 if (node == m_eventPath[i]->node()) {
214 ASSERT(node); 213 ASSERT(m_eventPath[i]->eventPath());
215 if (node->treeScope()->isInclusiveAncestorOf(currentScope)) 214 return m_eventPath[i]->eventPath();
216 nodes.append(node); 215 }
217 } 216 }
218 return StaticNodeList::adopt(nodes); 217 return StaticNodeList::createEmpty();
219 } 218 }
220 219
221 } // namespace WebCore 220 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/event-path-with-dom-mutation-expected.txt ('k') | Source/core/dom/EventContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698