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

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

Issue 849783002: Event.path should include Window (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments fixed Created 5 years, 11 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
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (e == this) 229 if (e == this)
230 return; 230 return;
231 m_underlyingEvent = ue; 231 m_underlyingEvent = ue;
232 } 232 }
233 233
234 void Event::initEventPath(Node& node) 234 void Event::initEventPath(Node& node)
235 { 235 {
236 m_eventPath = adoptPtrWillBeNoop(new EventPath(node, this)); 236 m_eventPath = adoptPtrWillBeNoop(new EventPath(node, this));
237 } 237 }
238 238
239 PassRefPtrWillBeRawPtr<StaticNodeList> Event::path() const 239 Vector<RefPtrWillBeRawPtr<EventTarget>> Event::path() const
hayato 2015/01/15 08:27:39 WillBeHeapVector?
kojii 2015/01/16 08:37:23 Done.
240 { 240 {
241 if (!m_currentTarget) { 241 if (!m_currentTarget) {
242 ASSERT(m_eventPhase == Event::NONE); 242 ASSERT(m_eventPhase == Event::NONE);
243 if (!m_eventPath) { 243 if (!m_eventPath) {
244 // Before dispatching the event 244 // Before dispatching the event
245 return StaticNodeList::createEmpty(); 245 return WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>();
246 } 246 }
247 ASSERT(!m_eventPath->isEmpty()); 247 ASSERT(!m_eventPath->isEmpty());
248 // After dispatching the event 248 // After dispatching the event
249 return m_eventPath->last().treeScopeEventContext().ensureEventPath(*m_ev entPath); 249 return m_eventPath->last().treeScopeEventContext().ensureEventPath(*m_ev entPath);
250 } 250 }
251 if (!m_currentTarget->toNode()) 251 if (!m_currentTarget->toNode())
252 return StaticNodeList::createEmpty(); 252 return WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>();
253 Node* node = m_currentTarget->toNode(); 253 Node* node = m_currentTarget->toNode();
254 size_t eventPathSize = m_eventPath->size(); 254 size_t eventPathSize = m_eventPath->size();
255 for (size_t i = 0; i < eventPathSize; ++i) { 255 for (size_t i = 0; i < eventPathSize; ++i) {
256 if (node == (*m_eventPath)[i].node()) { 256 if (node == (*m_eventPath)[i].node()) {
257 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath(*m_ eventPath); 257 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath(*m_ eventPath);
258 } 258 }
259 } 259 }
260 return StaticNodeList::createEmpty(); 260 return WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>();
261 } 261 }
262 262
263 EventTarget* Event::currentTarget() const 263 EventTarget* Event::currentTarget() const
264 { 264 {
265 if (!m_currentTarget) 265 if (!m_currentTarget)
266 return 0; 266 return 0;
267 Node* node = m_currentTarget->toNode(); 267 Node* node = m_currentTarget->toNode();
268 if (node && node->isSVGElement()) { 268 if (node && node->isSVGElement()) {
269 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement()) 269 if (SVGElement* svgElement = toSVGElement(node)->correspondingElement())
270 return svgElement; 270 return svgElement;
271 } 271 }
272 return m_currentTarget.get(); 272 return m_currentTarget.get();
273 } 273 }
274 274
275 void Event::trace(Visitor* visitor) 275 void Event::trace(Visitor* visitor)
276 { 276 {
277 visitor->trace(m_currentTarget); 277 visitor->trace(m_currentTarget);
278 visitor->trace(m_target); 278 visitor->trace(m_target);
279 visitor->trace(m_underlyingEvent); 279 visitor->trace(m_underlyingEvent);
280 visitor->trace(m_eventPath); 280 visitor->trace(m_eventPath);
281 } 281 }
282 282
283 } // namespace blink 283 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698