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

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

Issue 299353004: Oilpan: move editing objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make test wrapper class finalized Created 6 years, 7 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/DeleteSelectionCommand.h ('k') | Source/core/editing/EditCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index f3549f7697071af8268e16a3664c3d29bf7e8fab..7b886c7b906e021ee6878f1542062a7f14ae1e41 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -327,7 +327,7 @@ static Position firstEditablePositionInNode(Node* node)
return next ? firstPositionInOrBeforeNode(next) : Position();
}
-void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
+void DeleteSelectionCommand::removeNode(PassRefPtrWillBeRawPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
{
if (!node)
return;
@@ -339,9 +339,9 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node, ShouldAssumeConte
if (!node->firstChild())
return;
// Search this non-editable region for editable regions to empty.
- RefPtr<Node> child = node->firstChild();
+ RefPtrWillBeRawPtr<Node> child = node->firstChild();
while (child) {
- RefPtr<Node> nextChild = child->nextSibling();
+ RefPtrWillBeRawPtr<Node> nextChild = child->nextSibling();
removeNode(child.get(), shouldAssumeContentIsAlwaysEditable);
// Bail if nextChild is no longer node's child.
if (nextChild && nextChild->parentNode() != node)
@@ -419,12 +419,12 @@ void DeleteSelectionCommand::deleteTextFromNode(PassRefPtrWillBeRawPtr<Text> nod
void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss()
{
RefPtrWillBeRawPtr<Range> range = m_selectionToDelete.toNormalizedRange();
- RefPtr<Node> node = range->firstNode();
+ RefPtrWillBeRawPtr<Node> node = range->firstNode();
while (node && node != range->pastLastNode()) {
- RefPtr<Node> nextNode = NodeTraversal::next(*node);
+ RefPtrWillBeRawPtr<Node> nextNode = NodeTraversal::next(*node);
if ((isHTMLStyleElement(*node) && !(toElement(node)->hasAttribute(scopedAttr))) || isHTMLLinkElement(*node)) {
nextNode = NodeTraversal::nextSkippingChildren(*node);
- RefPtr<ContainerNode> rootEditableElement = node->rootEditableElement();
+ RefPtrWillBeRawPtr<ContainerNode> rootEditableElement = node->rootEditableElement();
if (rootEditableElement.get()) {
removeNode(node);
appendNode(node, rootEditableElement);
@@ -487,7 +487,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
else {
bool startNodeWasDescendantOfEndNode = m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode());
// The selection to delete spans more than one node.
- RefPtr<Node> node(startNode);
+ RefPtrWillBeRawPtr<Node> node(startNode);
if (startOffset > 0) {
if (startNode->isTextNode()) {
@@ -509,7 +509,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
// NodeTraversal::nextSkippingChildren just blew past the end position, so stop deleting
node = nullptr;
} else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(node.get())) {
- RefPtr<Node> nextNode = NodeTraversal::nextSkippingChildren(*node);
+ RefPtrWillBeRawPtr<Node> nextNode = NodeTraversal::nextSkippingChildren(*node);
// if we just removed a node from the end container, update end position so the
// check above will work
updatePositionForNodeRemoval(m_downstreamEnd, *node);
@@ -675,7 +675,7 @@ void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows()
if (m_endTableRow && m_endTableRow->inDocument() && m_endTableRow != m_startTableRow) {
Node* row = m_endTableRow->previousSibling();
while (row && row != m_startTableRow) {
- RefPtr<Node> previousRow = row->previousSibling();
+ RefPtrWillBeRawPtr<Node> previousRow = row->previousSibling();
if (isTableRowEmpty(row))
// Use a raw removeNode, instead of DeleteSelectionCommand's, because
// that won't remove rows, it only empties them in preparation for this function.
@@ -688,7 +688,7 @@ void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows()
if (m_startTableRow && m_startTableRow->inDocument() && m_startTableRow != m_endTableRow) {
Node* row = m_startTableRow->nextSibling();
while (row && row != m_endTableRow) {
- RefPtr<Node> nextRow = row->nextSibling();
+ RefPtrWillBeRawPtr<Node> nextRow = row->nextSibling();
if (isTableRowEmpty(row))
CompositeEditCommand::removeNode(row);
row = nextRow.get();
@@ -832,7 +832,7 @@ void DeleteSelectionCommand::doApply()
m_needPlaceholder = hasPlaceholder && lineBreakBeforeStart && !lineBreakAtEndOfSelectionToDelete;
}
- RefPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(document()).get() : 0;
+ RefPtrWillBeRawPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(document()) : nullptr;
if (placeholder) {
if (m_sanitizeMarkup)
@@ -864,4 +864,26 @@ bool DeleteSelectionCommand::preservesTypingStyle() const
return m_typingStyle;
}
+void DeleteSelectionCommand::trace(Visitor* visitor)
+{
+ visitor->trace(m_selectionToDelete);
+ visitor->trace(m_upstreamStart);
+ visitor->trace(m_downstreamStart);
+ visitor->trace(m_upstreamEnd);
+ visitor->trace(m_downstreamEnd);
+ visitor->trace(m_endingPosition);
+ visitor->trace(m_leadingWhitespace);
+ visitor->trace(m_trailingWhitespace);
+ visitor->trace(m_startBlock);
+ visitor->trace(m_endBlock);
+ visitor->trace(m_typingStyle);
+ visitor->trace(m_deleteIntoBlockquoteStyle);
+ visitor->trace(m_startRoot);
+ visitor->trace(m_endRoot);
+ visitor->trace(m_startTableRow);
+ visitor->trace(m_endTableRow);
+ visitor->trace(m_temporaryPlaceholder);
+ CompositeEditCommand::trace(visitor);
+}
+
} // namespace WebCore
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.h ('k') | Source/core/editing/EditCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698