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

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

Issue 182383012: Have positionInParentBeforeNode() / positionInParentAfterNode() take a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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/CompositeEditCommand.h ('k') | Source/core/editing/CreateLinkCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/CompositeEditCommand.cpp
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index 5fbd897755124daa2fcc7ea3e1d974809b63012f..2e0897bea7891c4d74d7ee185db8b4329beabccf 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -394,7 +394,7 @@ void CompositeEditCommand::moveRemainingSiblingsToNewParent(Node* node, Node* pa
}
}
-void CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren(Position& position, Node* node)
+void CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren(Position& position, Node& node)
{
int offset = (position.anchorType() == Position::PositionIsOffsetInAnchor) ? position.offsetInContainerNode() : 0;
updatePositionForNodeRemoval(position, node);
@@ -519,21 +519,22 @@ Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
case Position::PositionIsOffsetInAnchor:
break;
case Position::PositionIsBeforeAnchor:
- return positionInParentBeforeNode(pos.anchorNode());
+ return positionInParentBeforeNode(*pos.anchorNode());
case Position::PositionIsAfterAnchor:
- return positionInParentAfterNode(pos.anchorNode());
+ return positionInParentAfterNode(*pos.anchorNode());
}
Node* tabSpan = tabSpanNode(pos.containerNode());
+ ASSERT(tabSpan);
if (pos.offsetInContainerNode() <= caretMinOffset(pos.containerNode()))
- return positionInParentBeforeNode(tabSpan);
+ return positionInParentBeforeNode(*tabSpan);
if (pos.offsetInContainerNode() >= caretMaxOffset(pos.containerNode()))
- return positionInParentAfterNode(tabSpan);
+ return positionInParentAfterNode(*tabSpan);
splitTextNodeContainingElement(toText(pos.containerNode()), pos.offsetInContainerNode());
- return positionInParentBeforeNode(tabSpan);
+ return positionInParentBeforeNode(*tabSpan);
}
void CompositeEditCommand::insertNodeAtTabSpanPosition(PassRefPtr<Node> node, const Position& pos)
@@ -1271,7 +1272,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
RefPtr<Element> newBlock = nullptr;
if (ContainerNode* blockEnclosingList = listNode->parentNode()) {
if (blockEnclosingList->hasTagName(liTag)) { // listNode is inside another list item
- if (visiblePositionAfterNode(blockEnclosingList) == visiblePositionAfterNode(listNode.get())) {
+ if (visiblePositionAfterNode(*blockEnclosingList) == visiblePositionAfterNode(*listNode)) {
// If listNode appears at the end of the outer list item, then move listNode outside of this list item
// e.g. <ul><li>hello <ul><li><br></li></ul> </li></ul> should become <ul><li>hello</li> <ul><li><br></li></ul> </ul> after this section
// If listNode does NOT appear at the end, then we should consider it as a regular paragraph.
@@ -1408,7 +1409,7 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
if (lineBreakExistsAtVisiblePosition(visiblePos) && downstream.deprecatedNode()->isDescendantOf(enclosingAnchor))
return original;
- result = positionInParentAfterNode(enclosingAnchor);
+ result = positionInParentAfterNode(*enclosingAnchor);
}
// If visually just before an anchor, insert *outside* the anchor unless it's the first
// VisiblePosition in a paragraph, to match NSTextView.
@@ -1422,7 +1423,7 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
if (!enclosingAnchor)
return original;
- result = positionInParentBeforeNode(enclosingAnchor);
+ result = positionInParentBeforeNode(*enclosingAnchor);
}
}
« no previous file with comments | « Source/core/editing/CompositeEditCommand.h ('k') | Source/core/editing/CreateLinkCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698