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

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

Issue 1885453002: Rename Node::treeScope() to Node::treeScopeOrDocument() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 void EventPath::calculateAdjustedTargets() 209 void EventPath::calculateAdjustedTargets()
210 { 210 {
211 const TreeScope* lastTreeScope = nullptr; 211 const TreeScope* lastTreeScope = nullptr;
212 212
213 TreeScopeEventContextMap treeScopeEventContextMap; 213 TreeScopeEventContextMap treeScopeEventContextMap;
214 TreeScopeEventContext* lastTreeScopeEventContext = nullptr; 214 TreeScopeEventContext* lastTreeScopeEventContext = nullptr;
215 215
216 for (size_t i = 0; i < size(); ++i) { 216 for (size_t i = 0; i < size(); ++i) {
217 Node* currentNode = at(i).node(); 217 Node* currentNode = at(i).node();
218 TreeScope& currentTreeScope = currentNode->treeScope(); 218 TreeScope& currentTreeScope = currentNode->treeScopeOrDocument();
219 if (lastTreeScope != &currentTreeScope) { 219 if (lastTreeScope != &currentTreeScope) {
220 lastTreeScopeEventContext = ensureTreeScopeEventContext(currentNode, &currentTreeScope, treeScopeEventContextMap); 220 lastTreeScopeEventContext = ensureTreeScopeEventContext(currentNode, &currentTreeScope, treeScopeEventContextMap);
221 } 221 }
222 ASSERT(lastTreeScopeEventContext); 222 ASSERT(lastTreeScopeEventContext);
223 at(i).setTreeScopeEventContext(lastTreeScopeEventContext); 223 at(i).setTreeScopeEventContext(lastTreeScopeEventContext);
224 lastTreeScope = &currentTreeScope; 224 lastTreeScope = &currentTreeScope;
225 } 225 }
226 m_treeScopeEventContexts.appendRange(treeScopeEventContextMap.values().begin (), treeScopeEventContextMap.values().end()); 226 m_treeScopeEventContexts.appendRange(treeScopeEventContextMap.values().begin (), treeScopeEventContextMap.values().end());
227 } 227 }
228 228
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 shrinkIfNeeded(target, *relatedTarget); 283 shrinkIfNeeded(target, *relatedTarget);
284 } 284 }
285 285
286 void EventPath::shrinkIfNeeded(const Node& target, const EventTarget& relatedTar get) 286 void EventPath::shrinkIfNeeded(const Node& target, const EventTarget& relatedTar get)
287 { 287 {
288 // Synthetic mouse events can have a relatedTarget which is identical to the target. 288 // Synthetic mouse events can have a relatedTarget which is identical to the target.
289 bool targetIsIdenticalToToRelatedTarget = (&target == &relatedTarget); 289 bool targetIsIdenticalToToRelatedTarget = (&target == &relatedTarget);
290 290
291 for (size_t i = 0; i < size(); ++i) { 291 for (size_t i = 0; i < size(); ++i) {
292 if (targetIsIdenticalToToRelatedTarget) { 292 if (targetIsIdenticalToToRelatedTarget) {
293 if (target.treeScope().rootNode() == at(i).node()) { 293 if (target.treeScopeOrDocument().rootNode() == at(i).node()) {
294 shrink(i + 1); 294 shrink(i + 1);
295 break; 295 break;
296 } 296 }
297 } else if (at(i).target() == at(i).relatedTarget()) { 297 } else if (at(i).target() == at(i).relatedTarget()) {
298 // Event dispatching should be stopped here. 298 // Event dispatching should be stopped here.
299 shrink(i); 299 shrink(i);
300 break; 300 break;
301 } 301 }
302 } 302 }
303 } 303 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 { 363 {
364 ASSERT(m_event); 364 ASSERT(m_event);
365 if (!m_windowEventContext) 365 if (!m_windowEventContext)
366 m_windowEventContext = new WindowEventContext(*m_event, topNodeEventCont ext()); 366 m_windowEventContext = new WindowEventContext(*m_event, topNodeEventCont ext());
367 } 367 }
368 368
369 #if ENABLE(ASSERT) 369 #if ENABLE(ASSERT)
370 void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList) 370 void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList)
371 { 371 {
372 for (size_t i = 0; i < touchList.length(); ++i) 372 for (size_t i = 0; i < touchList.length(); ++i)
373 ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOld erSiblingShadowRootOrAncestorTreeScopeOf(treeScope)); 373 ASSERT(touchList.item(i)->target()->toNode()->treeScopeOrDocument().isIn clusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope));
374 } 374 }
375 #endif 375 #endif
376 376
377 DEFINE_TRACE(EventPath) 377 DEFINE_TRACE(EventPath)
378 { 378 {
379 visitor->trace(m_nodeEventContexts); 379 visitor->trace(m_nodeEventContexts);
380 visitor->trace(m_node); 380 visitor->trace(m_node);
381 visitor->trace(m_event); 381 visitor->trace(m_event);
382 visitor->trace(m_treeScopeEventContexts); 382 visitor->trace(m_treeScopeEventContexts);
383 visitor->trace(m_windowEventContext); 383 visitor->trace(m_windowEventContext);
384 } 384 }
385 385
386 } // namespace blink 386 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698