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

Unified Diff: Source/core/editing/VisibleSelection.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/editing/FrameSelection.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelection.cpp
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index 96ae7ec131164fceecc3237eaddb76c1f3565a66..31d3a7288d4d636a902a12e2952549e190623b99 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -470,17 +470,17 @@ void VisibleSelection::setWithoutValidation(const Position& base, const Position
static Position adjustPositionForEnd(const Position& currentPosition, Node* startContainerNode)
{
- TreeScope& treeScope = startContainerNode->treeScope();
+ NonNullPtr<TreeScope> treeScope = startContainerNode->treeScope();
- ASSERT(&currentPosition.containerNode()->treeScope() != &treeScope);
+ ASSERT(currentPosition.containerNode()->treeScope() != treeScope);
- if (Node* ancestor = treeScope.ancestorInThisScope(currentPosition.containerNode())) {
+ if (Node* ancestor = treeScope->ancestorInThisScope(currentPosition.containerNode())) {
if (ancestor->contains(startContainerNode))
return positionAfterNode(ancestor);
return positionBeforeNode(ancestor);
}
- if (Node* lastChild = treeScope.rootNode()->lastChild())
+ if (Node* lastChild = treeScope->rootNode()->lastChild())
return positionAfterNode(lastChild);
return Position();
@@ -488,17 +488,17 @@ static Position adjustPositionForEnd(const Position& currentPosition, Node* star
static Position adjustPositionForStart(const Position& currentPosition, Node* endContainerNode)
{
- TreeScope& treeScope = endContainerNode->treeScope();
+ NonNullPtr<TreeScope> treeScope = endContainerNode->treeScope();
- ASSERT(&currentPosition.containerNode()->treeScope() != &treeScope);
+ ASSERT(currentPosition.containerNode()->treeScope() != treeScope);
- if (Node* ancestor = treeScope.ancestorInThisScope(currentPosition.containerNode())) {
+ if (Node* ancestor = treeScope->ancestorInThisScope(currentPosition.containerNode())) {
if (ancestor->contains(endContainerNode))
return positionBeforeNode(ancestor);
return positionAfterNode(ancestor);
}
- if (Node* firstChild = treeScope.rootNode()->firstChild())
+ if (Node* firstChild = treeScope->rootNode()->firstChild())
return positionBeforeNode(firstChild);
return Position();
@@ -509,7 +509,7 @@ void VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries()
if (m_base.isNull() || m_start.isNull() || m_end.isNull())
return;
- if (&m_start.anchorNode()->treeScope() == &m_end.anchorNode()->treeScope())
+ if (m_start.anchorNode()->treeScope() == m_end.anchorNode()->treeScope())
return;
if (m_baseIsFirst) {
@@ -520,7 +520,7 @@ void VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries()
m_start = m_extent;
}
- ASSERT(&m_start.anchorNode()->treeScope() == &m_end.anchorNode()->treeScope());
+ ASSERT(m_start.anchorNode()->treeScope() == m_end.anchorNode()->treeScope());
}
void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698