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

Unified Diff: Source/core/editing/Caret.cpp

Issue 48803004: Have Document::nodeWillBeRemoved() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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/Caret.h ('k') | Source/core/editing/FrameSelection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/Caret.cpp
diff --git a/Source/core/editing/Caret.cpp b/Source/core/editing/Caret.cpp
index 258d7e118dec8c28f2b9383b83a3b188190ebf61..21de4d25d824433015c5d1b0d1a37c0831644124 100644
--- a/Source/core/editing/Caret.cpp
+++ b/Source/core/editing/Caret.cpp
@@ -78,7 +78,7 @@ void DragCaretController::setCaretPosition(const VisiblePosition& position)
updateCaretRect(document, m_position);
}
-static bool removingNodeRemovesPosition(Node* node, const Position& position)
+static bool removingNodeRemovesPosition(Node& node, const Position& position)
{
if (!position.anchorNode())
return false;
@@ -86,11 +86,11 @@ static bool removingNodeRemovesPosition(Node* node, const Position& position)
if (position.anchorNode() == node)
return true;
- if (!node->isElementNode())
+ if (!node.isElementNode())
return false;
- Element* element = toElement(node);
- return element->containsIncludingShadowDOM(position.anchorNode());
+ Element& element = toElement(node);
+ return element.containsIncludingShadowDOM(position.anchorNode());
}
static void clearRenderViewSelection(const Position& position)
@@ -101,9 +101,9 @@ static void clearRenderViewSelection(const Position& position)
view->clearSelection();
}
-void DragCaretController::nodeWillBeRemoved(Node* node)
+void DragCaretController::nodeWillBeRemoved(Node& node)
{
- if (!hasCaret() || (node && !node->inDocument()))
+ if (!hasCaret() || !node.inDocument())
return;
if (!removingNodeRemovesPosition(node, m_position.deepEquivalent()))
« no previous file with comments | « Source/core/editing/Caret.h ('k') | Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698