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

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

Issue 2343923003: Make event.composedPath() on window behave the same way as that on document (Closed)
Patch Set: rebased Created 4 years, 2 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 size_t eventPathSize = m_eventPath->size(); 320 size_t eventPathSize = m_eventPath->size();
321 for (size_t i = 0; i < eventPathSize; ++i) { 321 for (size_t i = 0; i < eventPathSize; ++i) {
322 if (node == (*m_eventPath)[i].node()) { 322 if (node == (*m_eventPath)[i].node()) {
323 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath( 323 return (*m_eventPath)[i].treeScopeEventContext().ensureEventPath(
324 *m_eventPath); 324 *m_eventPath);
325 } 325 }
326 } 326 }
327 NOTREACHED(); 327 NOTREACHED();
328 } 328 }
329 329
330 // Returns [window] for events that are directly dispatched to the window obje ct; 330 if (LocalDOMWindow* window = m_currentTarget->toLocalDOMWindow()) {
331 // e.g., window.load, pageshow, etc. 331 if (m_eventPath && !m_eventPath->isEmpty()) {
332 if (LocalDOMWindow* window = m_currentTarget->toLocalDOMWindow()) 332 return m_eventPath->topNodeEventContext()
333 .treeScopeEventContext()
334 .ensureEventPath(*m_eventPath);
335 }
333 return HeapVector<Member<EventTarget>>(1, window); 336 return HeapVector<Member<EventTarget>>(1, window);
337 }
334 338
335 return HeapVector<Member<EventTarget>>(); 339 return HeapVector<Member<EventTarget>>();
336 } 340 }
337 341
338 EventDispatchMediator* Event::createMediator() { 342 EventDispatchMediator* Event::createMediator() {
339 return EventDispatchMediator::create(this); 343 return EventDispatchMediator::create(this);
340 } 344 }
341 345
342 double Event::timeStamp(ScriptState* scriptState) const { 346 double Event::timeStamp(ScriptState* scriptState) const {
343 double timeStamp = 0; 347 double timeStamp = 0;
(...skipping 16 matching lines...) Expand all
360 } 364 }
361 365
362 DEFINE_TRACE(Event) { 366 DEFINE_TRACE(Event) {
363 visitor->trace(m_currentTarget); 367 visitor->trace(m_currentTarget);
364 visitor->trace(m_target); 368 visitor->trace(m_target);
365 visitor->trace(m_underlyingEvent); 369 visitor->trace(m_underlyingEvent);
366 visitor->trace(m_eventPath); 370 visitor->trace(m_eventPath);
367 } 371 }
368 372
369 } // namespace blink 373 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/event-composed-path.html ('k') | third_party/WebKit/Source/core/events/EventPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698