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

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScope.cpp

Issue 2327743002: Rename Node::shadowHost() to Node::ownerShadowHost() (Closed)
Patch Set: fix Created 4 years, 3 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) 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 Node* TreeScope::ancestorInThisScope(Node* node) const 157 Node* TreeScope::ancestorInThisScope(Node* node) const
158 { 158 {
159 while (node) { 159 while (node) {
160 if (node->treeScope() == this) 160 if (node->treeScope() == this)
161 return node; 161 return node;
162 if (!node->isInShadowTree()) 162 if (!node->isInShadowTree())
163 return nullptr; 163 return nullptr;
164 164
165 node = node->shadowHost(); 165 node = node->ownerShadowHost();
166 } 166 }
167 167
168 return nullptr; 168 return nullptr;
169 } 169 }
170 170
171 void TreeScope::addImageMap(HTMLMapElement* imageMap) 171 void TreeScope::addImageMap(HTMLMapElement* imageMap)
172 { 172 {
173 const AtomicString& name = imageMap->getName(); 173 const AtomicString& name = imageMap->getName();
174 if (!name) 174 if (!name)
175 return; 175 return;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ScriptForbiddenScope forbidScript; 362 ScriptForbiddenScope forbidScript;
363 DCHECK(this); 363 DCHECK(this);
364 DCHECK(!node.isDocumentNode()); 364 DCHECK(!node.isDocumentNode());
365 TreeScopeAdopter adopter(node, *this); 365 TreeScopeAdopter adopter(node, *this);
366 if (adopter.needsScopeChange()) 366 if (adopter.needsScopeChange())
367 adopter.execute(); 367 adopter.execute();
368 } 368 }
369 369
370 Element* TreeScope::retarget(const Element& target) const 370 Element* TreeScope::retarget(const Element& target) const
371 { 371 {
372 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) { 372 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->owner ShadowHost()) {
373 if (this == ancestor->treeScope()) 373 if (this == ancestor->treeScope())
374 return const_cast<Element*>(ancestor); 374 return const_cast<Element*>(ancestor);
375 } 375 }
376 return nullptr; 376 return nullptr;
377 } 377 }
378 378
379 Element* TreeScope::adjustedFocusedElement() const 379 Element* TreeScope::adjustedFocusedElement() const
380 { 380 {
381 Document& document = rootNode().document(); 381 Document& document = rootNode().document();
382 Element* element = document.focusedElement(); 382 Element* element = document.focusedElement();
(...skipping 19 matching lines...) Expand all
402 // So, it's safe to do toElement(). 402 // So, it's safe to do toElement().
403 return toElement(eventPath->at(i).target()->toNode()); 403 return toElement(eventPath->at(i).target()->toNode());
404 } 404 }
405 } 405 }
406 return nullptr; 406 return nullptr;
407 } 407 }
408 408
409 Element* TreeScope::adjustedElement(const Element& target) const 409 Element* TreeScope::adjustedElement(const Element& target) const
410 { 410 {
411 const Element* adjustedTarget = &target; 411 const Element* adjustedTarget = &target;
412 for (const Element* ancestor = &target; ancestor; ancestor = ancestor->shado wHost()) { 412 for (const Element* ancestor = &target; ancestor; ancestor = ancestor->owner ShadowHost()) {
413 // This adjustment is done only for V1 shadows, and is skipped for V0 or UA shadows, 413 // This adjustment is done only for V1 shadows, and is skipped for V0 or UA shadows,
414 // because .pointerLockElement and .(webkit)fullscreenElement is not ava ilable for 414 // because .pointerLockElement and .(webkit)fullscreenElement is not ava ilable for
415 // non-V1 shadow roots. 415 // non-V1 shadow roots.
416 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl ement for V1. 416 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl ement for V1.
417 if (ancestor->shadowRootIfV1()) 417 if (ancestor->shadowRootIfV1())
418 adjustedTarget = ancestor; 418 adjustedTarget = ancestor;
419 if (this == ancestor->treeScope()) 419 if (this == ancestor->treeScope())
420 return const_cast<Element*>(adjustedTarget); 420 return const_cast<Element*>(adjustedTarget);
421 } 421 }
422 return nullptr; 422 return nullptr;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 visitor->trace(m_parentTreeScope); 535 visitor->trace(m_parentTreeScope);
536 visitor->trace(m_idTargetObserverRegistry); 536 visitor->trace(m_idTargetObserverRegistry);
537 visitor->trace(m_selection); 537 visitor->trace(m_selection);
538 visitor->trace(m_elementsById); 538 visitor->trace(m_elementsById);
539 visitor->trace(m_imageMapsByName); 539 visitor->trace(m_imageMapsByName);
540 visitor->trace(m_scopedStyleResolver); 540 visitor->trace(m_scopedStyleResolver);
541 visitor->trace(m_radioButtonGroupScope); 541 visitor->trace(m_radioButtonGroupScope);
542 } 542 }
543 543
544 } // namespace blink 544 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698