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

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScope.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/Event.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 return nullptr; 403 return nullptr;
404 404
405 if (rootNode().isInV1ShadowTree()) { 405 if (rootNode().isInV1ShadowTree()) {
406 if (Element* retargeted = retarget(*element)) { 406 if (Element* retargeted = retarget(*element)) {
407 return (this == &retargeted->treeScope()) ? retargeted : nullptr; 407 return (this == &retargeted->treeScope()) ? retargeted : nullptr;
408 } 408 }
409 return nullptr; 409 return nullptr;
410 } 410 }
411 411
412 EventPath* eventPath = new EventPath(*element); 412 EventPath* eventPath = new EventPath(*element);
413 for (size_t i = 0; i < eventPath->size(); ++i) { 413 for (const auto& context : eventPath->nodeEventContexts()) {
414 if (eventPath->at(i).node() == rootNode()) { 414 if (context.node() == rootNode()) {
415 // eventPath->at(i).target() is one of the followings: 415 // context.target() is one of the followings:
416 // - InsertionPoint 416 // - InsertionPoint
417 // - shadow host 417 // - shadow host
418 // - Document::focusedElement() 418 // - Document::focusedElement()
419 // So, it's safe to do toElement(). 419 // So, it's safe to do toElement().
420 return toElement(eventPath->at(i).target()->toNode()); 420 return toElement(context.target()->toNode());
421 } 421 }
422 } 422 }
423 return nullptr; 423 return nullptr;
424 } 424 }
425 425
426 Element* TreeScope::adjustedElement(const Element& target) const { 426 Element* TreeScope::adjustedElement(const Element& target) const {
427 const Element* adjustedTarget = &target; 427 const Element* adjustedTarget = &target;
428 for (const Element* ancestor = &target; ancestor; 428 for (const Element* ancestor = &target; ancestor;
429 ancestor = ancestor->ownerShadowHost()) { 429 ancestor = ancestor->ownerShadowHost()) {
430 // This adjustment is done only for V1 shadows, and is skipped for V0 or UA 430 // This adjustment is done only for V1 shadows, and is skipped for V0 or UA
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 visitor->trace(m_parentTreeScope); 562 visitor->trace(m_parentTreeScope);
563 visitor->trace(m_idTargetObserverRegistry); 563 visitor->trace(m_idTargetObserverRegistry);
564 visitor->trace(m_selection); 564 visitor->trace(m_selection);
565 visitor->trace(m_elementsById); 565 visitor->trace(m_elementsById);
566 visitor->trace(m_imageMapsByName); 566 visitor->trace(m_imageMapsByName);
567 visitor->trace(m_scopedStyleResolver); 567 visitor->trace(m_scopedStyleResolver);
568 visitor->trace(m_radioButtonGroupScope); 568 visitor->trace(m_radioButtonGroupScope);
569 } 569 }
570 570
571 } // namespace blink 571 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/Event.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698