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

Unified Diff: Source/core/dom/TreeScope.cpp

Issue 23890025: WIP (Introduce WTF::NonNullPtr<T>.) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/TreeScope.h ('k') | Source/core/dom/TreeScopeAdopter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TreeScope.cpp
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index e20240f8ad312206fee3c68fbe27965a354593ad..88a9815a4610a4bea619344e23938a4c9c98074b 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -170,7 +170,7 @@ void TreeScope::removeElementById(const AtomicString& elementId, Element* elemen
Node* TreeScope::ancestorInThisScope(Node* node) const
{
while (node) {
- if (&node->treeScope() == this)
+ if (node->treeScope() == this)
return node;
if (!node->isInShadowTree())
return 0;
@@ -379,9 +379,9 @@ Element* TreeScope::adjustedFocusedElement()
return 0;
}
-unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const
+unsigned short TreeScope::comparePosition(NonNullPtr<const TreeScope> otherScope) const
{
- if (&otherScope == this)
+ if (otherScope == this)
return Node::DOCUMENT_POSITION_EQUIVALENT;
Vector<const TreeScope*, 16> chain1;
@@ -389,7 +389,7 @@ unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const
const TreeScope* current;
for (current = this; current; current = current->parentTreeScope())
chain1.append(current);
- for (current = &otherScope; current; current = current->parentTreeScope())
+ for (current = otherScope.get(); current; current = current->parentTreeScope())
chain2.append(current);
unsigned index1 = chain1.size();
@@ -424,7 +424,7 @@ unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const
static void listTreeScopes(Node* node, Vector<TreeScope*, 5>& treeScopes)
{
while (true) {
- treeScopes.append(&node->treeScope());
+ treeScopes.append(node->treeScope().get());
Element* ancestor = node->shadowHost();
if (!ancestor)
break;
@@ -437,8 +437,8 @@ TreeScope* commonTreeScope(Node* nodeA, Node* nodeB)
if (!nodeA || !nodeB)
return 0;
- if (&nodeA->treeScope() == &nodeB->treeScope())
- return &nodeA->treeScope();
+ if (nodeA->treeScope() == nodeB->treeScope())
+ return nodeA->treeScope().get();
Vector<TreeScope*, 5> treeScopesA;
listTreeScopes(nodeA, treeScopesA);
@@ -474,9 +474,9 @@ int TreeScope::refCount() const
return 0;
}
-bool TreeScope::isInclusiveAncestorOf(const TreeScope& scope) const
+bool TreeScope::isInclusiveAncestorOf(NonNullPtr<const TreeScope> scope) const
{
- for (const TreeScope* current = &scope; current; current = current->parentTreeScope()) {
+ for (const TreeScope* current = scope.get(); current; current = current->parentTreeScope()) {
if (current == this)
return true;
}
« no previous file with comments | « Source/core/dom/TreeScope.h ('k') | Source/core/dom/TreeScopeAdopter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698