DeleteSelectionCommand.cpp [plain text]
#include "config.h"
#include "DeleteSelectionCommand.h"
#include "CSSMutableStyleDeclaration.h"
#include "Document.h"
#include "DocumentFragment.h"
#include "Editor.h"
#include "EditorClient.h"
#include "Element.h"
#include "Frame.h"
#include "Logging.h"
#include "CSSComputedStyleDeclaration.h"
#include "htmlediting.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "markup.h"
#include "RenderTableCell.h"
#include "ReplaceSelectionCommand.h"
#include "Text.h"
#include "TextIterator.h"
#include "visible_units.h"
namespace WebCore {
using namespace HTMLNames;
static bool isTableRow(const Node* node)
{
return node && node->hasTagName(trTag);
}
static bool isTableCellEmpty(Node* cell)
{
ASSERT(isTableCell(cell));
return VisiblePosition(firstDeepEditingPositionForNode(cell)) == VisiblePosition(lastDeepEditingPositionForNode(cell));
}
static bool isTableRowEmpty(Node* row)
{
if (!isTableRow(row))
return false;
for (Node* child = row->firstChild(); child; child = child->nextSibling())
if (isTableCell(child) && !isTableCellEmpty(child))
return false;
return true;
}
DeleteSelectionCommand::DeleteSelectionCommand(Document *document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
: CompositeEditCommand(document),
m_hasSelectionToDelete(false),
m_smartDelete(smartDelete),
m_mergeBlocksAfterDelete(mergeBlocksAfterDelete),
m_replace(replace),
m_expandForSpecialElements(expandForSpecialElements),
m_pruneStartBlockIfNecessary(false),
m_startsAtEmptyLine(false),
m_startBlock(0),
m_endBlock(0),
m_typingStyle(0),
m_deleteIntoBlockquoteStyle(0)
{
}
DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
: CompositeEditCommand(selection.start().node()->document()),
m_hasSelectionToDelete(true),
m_smartDelete(smartDelete),
m_mergeBlocksAfterDelete(mergeBlocksAfterDelete),
m_replace(replace),
m_expandForSpecialElements(expandForSpecialElements),
m_pruneStartBlockIfNecessary(false),
m_startsAtEmptyLine(false),
m_selectionToDelete(selection),
m_startBlock(0),
m_endBlock(0),
m_typingStyle(0),
m_deleteIntoBlockquoteStyle(0)
{
}
void DeleteSelectionCommand::initializeStartEnd(Position& start, Position& end)
{
Node* startSpecialContainer = 0;
Node* endSpecialContainer = 0;
start = m_selectionToDelete.start();
end = m_selectionToDelete.end();
if (start.node()->hasTagName(hrTag))
start = Position(start.node(), 0);
else if (end.node()->hasTagName(hrTag))
end = Position(end.node(), 1);
if (!m_expandForSpecialElements)
return;
while (1) {
startSpecialContainer = 0;
endSpecialContainer = 0;
Position s = positionBeforeContainingSpecialElement(start, &startSpecialContainer);
Position e = positionAfterContainingSpecialElement(end, &endSpecialContainer);
if (!startSpecialContainer && !endSpecialContainer)
break;
if (VisiblePosition(start) != m_selectionToDelete.visibleStart() || VisiblePosition(end) != m_selectionToDelete.visibleEnd())
break;
if (startSpecialContainer && !endSpecialContainer && comparePositions(positionAfterNode(startSpecialContainer), end) > -1)
break;
if (endSpecialContainer && !startSpecialContainer && comparePositions(start, positionBeforeNode(endSpecialContainer)) > -1)
break;
if (startSpecialContainer && startSpecialContainer->isDescendantOf(endSpecialContainer))
start = s;
else if (endSpecialContainer && endSpecialContainer->isDescendantOf(startSpecialContainer))
end = e;
else {
start = s;
end = e;
}
}
}
void DeleteSelectionCommand::initializePositionData()
{
Position start, end;
initializeStartEnd(start, end);
m_upstreamStart = start.upstream();
m_downstreamStart = start.downstream();
m_upstreamEnd = end.upstream();
m_downstreamEnd = end.downstream();
m_startRoot = editableRootForPosition(start);
m_endRoot = editableRootForPosition(end);
m_startTableRow = enclosingNodeOfType(start, &isTableRow);
m_endTableRow = enclosingNodeOfType(end, &isTableRow);
Node* startCell = enclosingNodeOfType(m_upstreamStart, &isTableCell, false);
Node* endCell = enclosingNodeOfType(m_downstreamEnd, &isTableCell, false);
if (endCell && endCell != startCell)
m_mergeBlocksAfterDelete = false;
VisiblePosition visibleEnd(m_downstreamEnd);
if (m_mergeBlocksAfterDelete && !isEndOfParagraph(visibleEnd))
m_endingPosition = m_downstreamEnd;
else
m_endingPosition = m_downstreamStart;
if (numEnclosingMailBlockquotes(start) != numEnclosingMailBlockquotes(end)
&& isStartOfParagraph(visibleEnd) && isStartOfParagraph(VisiblePosition(start))
&& endingSelection().isRange()) {
m_mergeBlocksAfterDelete = false;
m_pruneStartBlockIfNecessary = true;
}
m_leadingWhitespace = m_upstreamStart.leadingWhitespacePosition(m_selectionToDelete.affinity());
m_trailingWhitespace = m_downstreamEnd.trailingWhitespacePosition(VP_DEFAULT_AFFINITY);
if (m_smartDelete) {
Position pos = VisiblePosition(m_upstreamStart, m_selectionToDelete.affinity()).deepEquivalent();
bool skipSmartDelete = pos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNotNull();
if (!skipSmartDelete)
skipSmartDelete = m_downstreamEnd.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNotNull();
bool hasLeadingWhitespaceBeforeAdjustment = m_upstreamStart.leadingWhitespacePosition(m_selectionToDelete.affinity(), true).isNotNull();
if (!skipSmartDelete && hasLeadingWhitespaceBeforeAdjustment) {
VisiblePosition visiblePos = VisiblePosition(m_upstreamStart, VP_DEFAULT_AFFINITY).previous();
pos = visiblePos.deepEquivalent();
m_upstreamStart = pos.upstream();
m_downstreamStart = pos.downstream();
m_leadingWhitespace = m_upstreamStart.leadingWhitespacePosition(visiblePos.affinity());
}
if (!skipSmartDelete && !hasLeadingWhitespaceBeforeAdjustment && m_downstreamEnd.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNotNull()) {
pos = VisiblePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY).next().deepEquivalent();
m_upstreamEnd = pos.upstream();
m_downstreamEnd = pos.downstream();
m_trailingWhitespace = m_downstreamEnd.trailingWhitespacePosition(VP_DEFAULT_AFFINITY);
}
}
m_startBlock = enclosingNodeOfType(rangeCompliantEquivalent(m_downstreamStart), &isBlock, false);
m_endBlock = enclosingNodeOfType(rangeCompliantEquivalent(m_upstreamEnd), &isBlock, false);
}
static void removeEnclosingAnchorStyle(CSSMutableStyleDeclaration* style, const Position& position)
{
Node* enclosingAnchor = enclosingAnchorElement(position);
if (!enclosingAnchor || !enclosingAnchor->parentNode())
return;
RefPtr<CSSMutableStyleDeclaration> parentStyle = Position(enclosingAnchor->parentNode(), 0).computedStyle()->copyInheritableProperties();
RefPtr<CSSMutableStyleDeclaration> anchorStyle = Position(enclosingAnchor, 0).computedStyle()->copyInheritableProperties();
parentStyle->diff(anchorStyle.get());
anchorStyle->diff(style);
}
void DeleteSelectionCommand::saveTypingStyleState()
{
if (m_upstreamStart.node() == m_downstreamEnd.node() && m_upstreamStart.node()->isTextNode())
return;
RefPtr<CSSComputedStyleDeclaration> computedStyle = positionBeforeTabSpan(m_selectionToDelete.start()).computedStyle();
m_typingStyle = computedStyle->copyInheritableProperties();
removeEnclosingAnchorStyle(m_typingStyle.get(), m_selectionToDelete.start());
if (nearestMailBlockquote(m_selectionToDelete.start().node())) {
computedStyle = m_selectionToDelete.end().computedStyle();
m_deleteIntoBlockquoteStyle = computedStyle->copyInheritableProperties();
} else
m_deleteIntoBlockquoteStyle = 0;
}
bool DeleteSelectionCommand::handleSpecialCaseBRDelete()
{
bool upstreamStartIsBR = m_upstreamStart.node()->hasTagName(brTag);
bool downstreamStartIsBR = m_downstreamStart.node()->hasTagName(brTag);
bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && m_downstreamStart.node() == m_upstreamEnd.node();
if (isBROnLineByItself) {
removeNode(m_downstreamStart.node());
return true;
}
if (upstreamStartIsBR && downstreamStartIsBR) {
m_startsAtEmptyLine = true;
m_endingPosition = m_downstreamEnd;
}
return false;
}
static void updatePositionForNodeRemoval(Node* node, Position& position)
{
if (position.isNull())
return;
if (node->parent() == position.node() && node->nodeIndex() < (unsigned)position.deprecatedEditingOffset())
position = Position(position.node(), position.deprecatedEditingOffset() - 1);
if (position.node() == node || position.node()->isDescendantOf(node))
position = positionBeforeNode(node);
}
void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node)
{
if (!node)
return;
if (m_startRoot != m_endRoot && !(node->isDescendantOf(m_startRoot.get()) && node->isDescendantOf(m_endRoot.get()))) {
if (!node->parentNode()->isContentEditable()) {
if (!node->firstChild())
return;
RefPtr<Node> child = node->firstChild();
while (child) {
RefPtr<Node> nextChild = child->nextSibling();
removeNode(child.get());
if (nextChild && nextChild->parentNode() != node)
return;
child = nextChild;
}
return;
}
}
if (isTableStructureNode(node.get()) || node == node->rootEditableElement()) {
Node* child = node->firstChild();
while (child) {
Node* remove = child;
child = child->nextSibling();
removeNode(remove);
}
updateLayout();
RenderObject *r = node->renderer();
if (r && r->isTableCell() && static_cast<RenderTableCell*>(r)->contentHeight() <= 0)
insertBlockPlaceholder(Position(node,0));
return;
}
if (node == m_startBlock && !isEndOfBlock(VisiblePosition(firstDeepEditingPositionForNode(m_startBlock.get())).previous()))
m_needPlaceholder = true;
else if (node == m_endBlock && !isStartOfBlock(VisiblePosition(lastDeepEditingPositionForNode(m_startBlock.get())).next()))
m_needPlaceholder = true;
updatePositionForNodeRemoval(node.get(), m_endingPosition);
updatePositionForNodeRemoval(node.get(), m_leadingWhitespace);
updatePositionForNodeRemoval(node.get(), m_trailingWhitespace);
CompositeEditCommand::removeNode(node);
}
static void updatePositionForTextRemoval(Node* node, int offset, int count, Position& position)
{
if (position.node() == node) {
if (position.deprecatedEditingOffset() > offset + count)
position = Position(position.node(), position.deprecatedEditingOffset() - count);
else if (position.deprecatedEditingOffset() > offset)
position = Position(position.node(), offset);
}
}
void DeleteSelectionCommand::deleteTextFromNode(PassRefPtr<Text> node, unsigned offset, unsigned count)
{
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);
CompositeEditCommand::deleteTextFromNode(node, offset, count);
}
void DeleteSelectionCommand::handleGeneralDelete()
{
int startOffset = m_upstreamStart.deprecatedEditingOffset();
Node* startNode = m_upstreamStart.node();
if (startNode == m_startBlock && startOffset == 0 && canHaveChildrenForEditing(startNode) && !startNode->hasTagName(tableTag)) {
startOffset = 0;
startNode = startNode->traverseNextNode();
}
if (startOffset >= caretMaxOffset(startNode) && startNode->isTextNode()) {
Text *text = static_cast<Text *>(startNode);
if (text->length() > (unsigned)caretMaxOffset(startNode))
deleteTextFromNode(text, caretMaxOffset(startNode), text->length() - caretMaxOffset(startNode));
}
if (startOffset >= lastOffsetForEditing(startNode)) {
startNode = startNode->traverseNextSibling();
startOffset = 0;
}
if (!startNode)
return;
if (startNode == m_downstreamEnd.node()) {
if (!startNode->renderer() || (startOffset == 0 && m_downstreamEnd.atLastEditingPositionForNode())) {
removeNode(startNode);
} else if (m_downstreamEnd.deprecatedEditingOffset() - startOffset > 0) {
if (startNode->isTextNode()) {
Text* text = static_cast<Text*>(startNode);
deleteTextFromNode(text, startOffset, m_downstreamEnd.deprecatedEditingOffset() - startOffset);
} else {
removeChildrenInRange(startNode, startOffset, m_downstreamEnd.deprecatedEditingOffset());
m_endingPosition = m_upstreamStart;
}
}
}
else {
bool startNodeWasDescendantOfEndNode = m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node());
RefPtr<Node> node(startNode);
if (startOffset > 0) {
if (startNode->isTextNode()) {
Text *text = static_cast<Text *>(node.get());
deleteTextFromNode(text, startOffset, text->length() - startOffset);
node = node->traverseNextNode();
} else {
node = startNode->childNode(startOffset);
}
}
while (node && node != m_downstreamEnd.node()) {
if (comparePositions(Position(node.get(), 0), m_downstreamEnd) >= 0) {
node = 0;
} else if (!m_downstreamEnd.node()->isDescendantOf(node.get())) {
RefPtr<Node> nextNode = node->traverseNextSibling();
if (node->parentNode() == m_downstreamEnd.node()) {
ASSERT(node->nodeIndex() < (unsigned)m_downstreamEnd.deprecatedEditingOffset());
m_downstreamEnd = Position(m_downstreamEnd.node(), m_downstreamEnd.deprecatedEditingOffset() - 1);
}
removeNode(node.get());
node = nextNode.get();
} else {
Node* n = node->lastDescendant();
if (m_downstreamEnd.node() == n && m_downstreamEnd.deprecatedEditingOffset() >= caretMaxOffset(n)) {
removeNode(node.get());
node = 0;
} else
node = node->traverseNextNode();
}
}
if (m_downstreamEnd.node() != startNode && !m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node()) && m_downstreamEnd.node()->inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(m_downstreamEnd.node())) {
if (m_downstreamEnd.atLastEditingPositionForNode() && !canHaveChildrenForEditing(m_downstreamEnd.node())) {
removeNode(m_downstreamEnd.node());
} else {
if (m_downstreamEnd.node()->isTextNode()) {
Text *text = static_cast<Text *>(m_downstreamEnd.node());
if (m_downstreamEnd.deprecatedEditingOffset() > 0) {
deleteTextFromNode(text, 0, m_downstreamEnd.deprecatedEditingOffset());
}
} else if (!(startNodeWasDescendantOfEndNode && !m_upstreamStart.node()->inDocument())) {
int offset = 0;
if (m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node())) {
Node *n = m_upstreamStart.node();
while (n && n->parentNode() != m_downstreamEnd.node())
n = n->parentNode();
if (n)
offset = n->nodeIndex() + 1;
}
removeChildrenInRange(m_downstreamEnd.node(), offset, m_downstreamEnd.deprecatedEditingOffset());
m_downstreamEnd = Position(m_downstreamEnd.node(), offset);
}
}
}
}
}
void DeleteSelectionCommand::fixupWhitespace()
{
updateLayout();
if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharacter()) {
Text* textNode = static_cast<Text*>(m_leadingWhitespace.node());
ASSERT(!textNode->renderer() || textNode->renderer()->style()->collapseWhiteSpace());
replaceTextInNode(textNode, m_leadingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
}
if (m_trailingWhitespace.isNotNull() && !m_trailingWhitespace.isRenderedCharacter()) {
Text* textNode = static_cast<Text*>(m_trailingWhitespace.node());
ASSERT(!textNode->renderer() ||textNode->renderer()->style()->collapseWhiteSpace());
replaceTextInNode(textNode, m_trailingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
}
}
void DeleteSelectionCommand::mergeParagraphs()
{
if (!m_mergeBlocksAfterDelete) {
if (m_pruneStartBlockIfNecessary) {
m_endingPosition = m_downstreamEnd;
prune(m_startBlock);
m_needPlaceholder = false;
}
return;
}
ASSERT(!m_pruneStartBlockIfNecessary);
if (!m_downstreamEnd.node()->inDocument() || !m_upstreamStart.node()->inDocument())
return;
if (comparePositions(m_upstreamStart, m_downstreamEnd) > 0)
return;
if (m_upstreamStart == m_downstreamEnd)
return;
VisiblePosition startOfParagraphToMove(m_downstreamEnd);
VisiblePosition mergeDestination(m_upstreamStart);
Element* endBlock = static_cast<Element*>(enclosingBlock(m_downstreamEnd.node()));
if (!startOfParagraphToMove.deepEquivalent().node() || !endBlock->contains(startOfParagraphToMove.deepEquivalent().node())) {
removeNode(enclosingBlock(m_downstreamEnd.node()));
return;
}
if (!mergeDestination.deepEquivalent().node() || !mergeDestination.deepEquivalent().node()->isDescendantOf(m_upstreamStart.node()->enclosingBlockFlowElement()) || m_startsAtEmptyLine) {
insertNodeAt(createBreakElement(document()).get(), m_upstreamStart);
mergeDestination = VisiblePosition(m_upstreamStart);
}
if (mergeDestination == startOfParagraphToMove)
return;
VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove);
if (mergeDestination == endOfParagraphToMove)
return;
if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfParagraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds().x()) {
ASSERT(mergeDestination.deepEquivalent().downstream().node()->hasTagName(brTag));
removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downstream().node());
m_endingPosition = startOfParagraphToMove.deepEquivalent();
return;
}
RefPtr<Range> range = Range::create(document(), rangeCompliantEquivalent(startOfParagraphToMove.deepEquivalent()), rangeCompliantEquivalent(endOfParagraphToMove.deepEquivalent()));
RefPtr<Range> rangeToBeReplaced = Range::create(document(), rangeCompliantEquivalent(mergeDestination.deepEquivalent()), rangeCompliantEquivalent(mergeDestination.deepEquivalent()));
if (!document()->frame()->editor()->client()->shouldMoveRangeAfterDelete(range.get(), rangeToBeReplaced.get()))
return;
bool needPlaceholder = m_needPlaceholder;
moveParagraph(startOfParagraphToMove, endOfParagraphToMove, mergeDestination);
m_needPlaceholder = needPlaceholder;
m_endingPosition = endingSelection().start();
}
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();
if (isTableRowEmpty(row))
CompositeEditCommand::removeNode(row);
row = previousRow.get();
}
}
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();
if (isTableRowEmpty(row))
CompositeEditCommand::removeNode(row);
row = nextRow.get();
}
}
if (m_endTableRow && m_endTableRow->inDocument() && m_endTableRow != m_startTableRow)
if (isTableRowEmpty(m_endTableRow.get())) {
if (!m_endingPosition.node()->isDescendantOf(m_endTableRow.get())) {
CompositeEditCommand::removeNode(m_endTableRow.get());
}
}
}
void DeleteSelectionCommand::calculateTypingStyleAfterDelete()
{
if (!m_typingStyle)
return;
if (m_deleteIntoBlockquoteStyle && !nearestMailBlockquote(m_endingPosition.node()))
m_typingStyle = m_deleteIntoBlockquoteStyle;
m_deleteIntoBlockquoteStyle = 0;
RefPtr<CSSComputedStyleDeclaration> endingStyle = computedStyle(m_endingPosition.node());
endingStyle->diff(m_typingStyle.get());
if (!m_typingStyle->length())
m_typingStyle = 0;
VisiblePosition visibleEnd(m_endingPosition);
if (m_typingStyle &&
isStartOfParagraph(visibleEnd) &&
isEndOfParagraph(visibleEnd) &&
lineBreakExistsAtVisiblePosition(visibleEnd)) {
setEndingSelection(visibleEnd);
applyStyle(m_typingStyle.get(), EditActionUnspecified);
m_endingPosition = endingSelection().start();
m_typingStyle = 0;
}
document()->frame()->setTypingStyle(m_typingStyle.get());
}
void DeleteSelectionCommand::clearTransientState()
{
m_selectionToDelete = VisibleSelection();
m_upstreamStart.clear();
m_downstreamStart.clear();
m_upstreamEnd.clear();
m_downstreamEnd.clear();
m_endingPosition.clear();
m_leadingWhitespace.clear();
m_trailingWhitespace.clear();
}
void DeleteSelectionCommand::doApply()
{
if (!m_hasSelectionToDelete)
m_selectionToDelete = endingSelection();
if (!m_selectionToDelete.isRange())
return;
if (!m_replace) {
Node* startNode = m_selectionToDelete.start().node();
Node* ancestorNode = startNode ? startNode->shadowAncestorNode() : 0;
if (ancestorNode && ancestorNode->hasTagName(inputTag)
&& static_cast<HTMLInputElement*>(ancestorNode)->isTextField()
&& ancestorNode->focused())
document()->frame()->textWillBeDeletedInTextField(static_cast<Element*>(ancestorNode));
}
EAffinity affinity = m_selectionToDelete.affinity();
Position downstreamEnd = m_selectionToDelete.end().downstream();
m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart()) &&
isEndOfParagraph(m_selectionToDelete.visibleEnd()) &&
!lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd());
if (m_needPlaceholder) {
if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleStart()))
if (m_selectionToDelete.end().node()->isDescendantOf(table))
m_needPlaceholder = false;
}
initializePositionData();
deleteInsignificantTextDownstream(m_trailingWhitespace);
saveTypingStyleState();
if (handleSpecialCaseBRDelete()) {
calculateTypingStyleAfterDelete();
setEndingSelection(VisibleSelection(m_endingPosition, affinity));
clearTransientState();
rebalanceWhitespace();
return;
}
handleGeneralDelete();
fixupWhitespace();
mergeParagraphs();
removePreviouslySelectedEmptyTableRows();
RefPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(document()).get() : 0;
if (placeholder)
insertNodeAt(placeholder.get(), m_endingPosition);
rebalanceWhitespaceAt(m_endingPosition);
calculateTypingStyleAfterDelete();
setEndingSelection(VisibleSelection(m_endingPosition, affinity));
clearTransientState();
}
EditAction DeleteSelectionCommand::editingAction() const
{
return EditActionCut;
}
bool DeleteSelectionCommand::preservesTypingStyle() const
{
return m_typingStyle;
}
}