Use PassRefPtr less in CompositeEditCommand
https://bugs.webkit.org/show_bug.cgi?id=171590
Reviewed by Sam Weinig.
Use PassRefPtr less in CompositeEditCommand.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/ApplyStyleCommand.cpp:
(WebCore::hasNoAttributeOrOnlyStyleAttribute):
(WebCore::isStyleSpanOrSpanWithOnlyStyleAttribute):
(WebCore::isSpanWithoutAttributesOrUnstyledStyleSpan):
(WebCore::isEmptyFontTag):
(WebCore::ApplyStyleCommand::doApply):
(WebCore::ApplyStyleCommand::applyBlockStyle):
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::dummySpanAncestorForNode):
(WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::ApplyStyleCommand::applyInlineStyle):
(WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
(WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
(WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
(WebCore::ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes):
(WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
(WebCore::ApplyStyleCommand::removeCSSStyle):
(WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
(WebCore::ApplyStyleCommand::removeInlineStyle):
(WebCore::ApplyStyleCommand::shouldSplitTextElement):
(WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
(WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
(WebCore::ApplyStyleCommand::addBlockStyle):
(WebCore::ApplyStyleCommand::joinChildTextNodes):
* editing/ApplyStyleCommand.h:
(WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::removeChildrenInRange):
(WebCore::CompositeEditCommand::mergeIdenticalElements):
(WebCore::CompositeEditCommand::insertTextIntoNode):
(WebCore::CompositeEditCommand::deleteTextFromNode):
(WebCore::CompositeEditCommand::replaceTextInNode):
(WebCore::CompositeEditCommand::replaceSelectedTextInNode):
(WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
(WebCore::CompositeEditCommand::removeNodeAttribute):
(WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
(WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
(WebCore::CompositeEditCommand::prepareWhitespaceAtPositionForSplit):
(WebCore::CompositeEditCommand::deleteInsignificantText):
(WebCore::CompositeEditCommand::removePlaceholderAt):
(WebCore::CompositeEditCommand::cleanupAfterDeletion):
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/CompositeEditCommand.h:
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
(WebCore::DeleteFromTextNodeCommand::doApply):
(WebCore::DeleteFromTextNodeCommand::doUnapply):
(WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
* editing/DeleteFromTextNodeCommand.h:
(WebCore::DeleteFromTextNodeCommand::create):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::deleteTextFromNode):
(WebCore::DeleteSelectionCommand::handleGeneralDelete):
(WebCore::DeleteSelectionCommand::fixupWhitespace):
* editing/DeleteSelectionCommand.h:
* editing/EditingAllInOne.cpp:
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
(WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl):
(WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
(WebCore::EditingStyle::wrappingStyleForSerialization):
(WebCore::styleFromMatchedRulesForElement):
(WebCore::EditingStyle::mergeStyleFromRules):
(WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
(WebCore::EditingStyle::removeStyleFromRulesAndContext):
(WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
* editing/EditingStyle.h:
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::tryIndentingAsListItem):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
(WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
* editing/InsertIntoTextNodeCommand.h:
(WebCore::InsertIntoTextNodeCommand::create):
* editing/InsertLineBreakCommand.cpp:
(WebCore::InsertLineBreakCommand::doApply):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::mergeWithNeighboringLists):
(WebCore::InsertListCommand::listifyParagraph):
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::performOverwrite):
(WebCore::InsertTextCommand::doApply):
(WebCore::InsertTextCommand::insertTab):
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
(WebCore::MergeIdenticalElementsCommand::doApply):
(WebCore::MergeIdenticalElementsCommand::doUnapply):
(WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
* editing/MergeIdenticalElementsCommand.h:
(WebCore::MergeIdenticalElementsCommand::create):
* editing/RemoveCSSPropertyCommand.cpp: Removed.
* editing/RemoveCSSPropertyCommand.h: Removed.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
(WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendElement):
(WebCore::styleFromMatchedRulesAndInlineDecl):
(WebCore::createMarkupInternal):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@216128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/DeleteSelectionCommand.cpp b/Source/WebCore/editing/DeleteSelectionCommand.cpp
index 7a75e69..c5cee71 100644
--- a/Source/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/Source/WebCore/editing/DeleteSelectionCommand.cpp
@@ -444,13 +444,13 @@
position.moveToOffset(offset);
}
-void DeleteSelectionCommand::deleteTextFromNode(PassRefPtr<Text> node, unsigned offset, unsigned count)
+void DeleteSelectionCommand::deleteTextFromNode(Text& node, unsigned offset, unsigned count)
{
// FIXME: Update the endpoints of the range being deleted.
- updatePositionForTextRemoval(node.get(), offset, count, m_endingPosition);
- updatePositionForTextRemoval(node.get(), offset, count, m_leadingWhitespace);
- updatePositionForTextRemoval(node.get(), offset, count, m_trailingWhitespace);
- updatePositionForTextRemoval(node.get(), offset, count, m_downstreamEnd);
+ updatePositionForTextRemoval(&node, offset, count, m_endingPosition);
+ updatePositionForTextRemoval(&node, offset, count, m_leadingWhitespace);
+ updatePositionForTextRemoval(&node, offset, count, m_trailingWhitespace);
+ updatePositionForTextRemoval(&node, offset, count, m_downstreamEnd);
CompositeEditCommand::deleteTextFromNode(node, offset, count);
}
@@ -495,7 +495,7 @@
if (startOffset >= startNodeCaretMaxOffset && is<Text>(*startNode)) {
Text& text = downcast<Text>(*startNode);
if (text.length() > static_cast<unsigned>(startNodeCaretMaxOffset))
- deleteTextFromNode(&text, startNodeCaretMaxOffset, text.length() - startNodeCaretMaxOffset);
+ deleteTextFromNode(text, startNodeCaretMaxOffset, text.length() - startNodeCaretMaxOffset);
}
if (startOffset >= lastOffsetForEditing(*startNode)) {
@@ -512,9 +512,9 @@
if (is<Text>(*startNode)) {
// in a text node that needs to be trimmed
Text& text = downcast<Text>(*startNode);
- deleteTextFromNode(&text, startOffset, m_downstreamEnd.deprecatedEditingOffset() - startOffset);
+ deleteTextFromNode(text, startOffset, m_downstreamEnd.deprecatedEditingOffset() - startOffset);
} else {
- removeChildrenInRange(startNode, startOffset, m_downstreamEnd.deprecatedEditingOffset());
+ removeChildrenInRange(*startNode, startOffset, m_downstreamEnd.deprecatedEditingOffset());
m_endingPosition = m_upstreamStart;
}
}
@@ -532,14 +532,14 @@
if (is<Text>(*startNode)) {
// in a text node that needs to be trimmed
Text& text = downcast<Text>(*node);
- deleteTextFromNode(&text, startOffset, text.length() - startOffset);
+ deleteTextFromNode(text, startOffset, text.length() - startOffset);
node = NodeTraversal::next(*node);
} else {
node = startNode->traverseToChildAt(startOffset);
}
} else if (startNode == m_upstreamEnd.deprecatedNode() && is<Text>(*startNode)) {
Text& text = downcast<Text>(*m_upstreamEnd.deprecatedNode());
- deleteTextFromNode(&text, 0, m_upstreamEnd.deprecatedEditingOffset());
+ deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset());
}
// handle deleting all nodes that are completely selected
@@ -573,7 +573,7 @@
// in a text node that needs to be trimmed
Text& text = downcast<Text>(*m_downstreamEnd.deprecatedNode());
if (m_downstreamEnd.deprecatedEditingOffset() > 0) {
- deleteTextFromNode(&text, 0, m_downstreamEnd.deprecatedEditingOffset());
+ deleteTextFromNode(text, 0, m_downstreamEnd.deprecatedEditingOffset());
}
// Remove children of m_downstreamEnd.deprecatedNode() that come after m_upstreamStart.
// Don't try to remove children if m_upstreamStart was inside m_downstreamEnd.deprecatedNode()
@@ -590,7 +590,7 @@
if (n)
offset = n->computeNodeIndex() + 1;
}
- removeChildrenInRange(m_downstreamEnd.deprecatedNode(), offset, m_downstreamEnd.deprecatedEditingOffset());
+ removeChildrenInRange(*m_downstreamEnd.deprecatedNode(), offset, m_downstreamEnd.deprecatedEditingOffset());
m_downstreamEnd = createLegacyEditingPosition(m_downstreamEnd.deprecatedNode(), offset);
}
}
@@ -605,12 +605,12 @@
if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharacter() && is<Text>(*m_leadingWhitespace.deprecatedNode())) {
Text& textNode = downcast<Text>(*m_leadingWhitespace.deprecatedNode());
ASSERT(!textNode.renderer() || textNode.renderer()->style().collapseWhiteSpace());
- replaceTextInNodePreservingMarkers(&textNode, m_leadingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
+ replaceTextInNodePreservingMarkers(textNode, m_leadingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
}
if (m_trailingWhitespace.isNotNull() && !m_trailingWhitespace.isRenderedCharacter() && is<Text>(*m_trailingWhitespace.deprecatedNode())) {
Text& textNode = downcast<Text>(*m_trailingWhitespace.deprecatedNode());
ASSERT(!textNode.renderer() || textNode.renderer()->style().collapseWhiteSpace());
- replaceTextInNodePreservingMarkers(&textNode, m_trailingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
+ replaceTextInNodePreservingMarkers(textNode, m_trailingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
}
}