summaryrefslogtreecommitdiffstats
path: root/WebCore/editing/CompositeEditCommand.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-10-22 13:02:20 +0100
committerBen Murdoch <benm@google.com>2010-10-26 15:21:41 +0100
commita94275402997c11dd2e778633dacf4b7e630a35d (patch)
treee66f56c67e3b01f22c9c23cd932271ee9ac558ed /WebCore/editing/CompositeEditCommand.cpp
parent09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff)
downloadexternal_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip
external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz
external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'WebCore/editing/CompositeEditCommand.cpp')
-rw-r--r--WebCore/editing/CompositeEditCommand.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp
index 356a717..a00db36 100644
--- a/WebCore/editing/CompositeEditCommand.cpp
+++ b/WebCore/editing/CompositeEditCommand.cpp
@@ -77,6 +77,10 @@ CompositeEditCommand::CompositeEditCommand(Document *document)
{
}
+CompositeEditCommand::~CompositeEditCommand()
+{
+}
+
void CompositeEditCommand::doUnapply()
{
size_t size = m_commands.size();
@@ -212,12 +216,12 @@ void CompositeEditCommand::removeNodePreservingChildren(PassRefPtr<Node> node)
void CompositeEditCommand::removeNodeAndPruneAncestors(PassRefPtr<Node> node)
{
- RefPtr<Node> parent = node->parentNode();
+ RefPtr<ContainerNode> parent = node->parentNode();
removeNode(node);
prune(parent.release());
}
-HTMLElement* CompositeEditCommand::replaceNodeWithSpanPreservingChildrenAndAttributes(PassRefPtr<Node> node)
+HTMLElement* CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes(PassRefPtr<HTMLElement> node)
{
// It would also be possible to implement all of ReplaceNodeWithSpanCommand
// as a series of existing smaller edit commands. Someone who wanted to
@@ -250,7 +254,7 @@ void CompositeEditCommand::prune(PassRefPtr<Node> node)
if (renderer && (!renderer->canHaveChildren() || hasARenderedDescendant(node.get()) || node->rootEditableElement() == node))
return;
- RefPtr<Node> next = node->parentNode();
+ RefPtr<ContainerNode> next = node->parentNode();
removeNode(node);
node = next;
}
@@ -859,7 +863,8 @@ void CompositeEditCommand::moveParagraphWithClones(const VisiblePosition& startO
beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent());
afterParagraph = VisiblePosition(afterParagraph.deepEquivalent());
- if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().node()) && (!isEndOfParagraph(beforeParagraph) || beforeParagraph == afterParagraph)) {
+ if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().node())
+ && ((!isEndOfParagraph(beforeParagraph) && !isStartOfParagraph(beforeParagraph)) || beforeParagraph == afterParagraph)) {
// FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
}
@@ -1000,7 +1005,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(endingSelection().start(), IncludeTypingStyle);
- Node* listNode = emptyListItem->parentNode();
+ ContainerNode* listNode = emptyListItem->parentNode();
// FIXME: Can't we do something better when the immediate parent wasn't a list node?
if (!listNode
|| (!listNode->hasTagName(ulTag) && !listNode->hasTagName(olTag))
@@ -1009,7 +1014,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
return false;
RefPtr<Element> newBlock = 0;
- if (Node* blockEnclosingList = listNode->parentNode()) {
+ if (ContainerNode* blockEnclosingList = listNode->parentNode()) {
if (blockEnclosingList->hasTagName(liTag)) { // listNode is inside another list item
if (visiblePositionAfterNode(blockEnclosingList) == visiblePositionAfterNode(listNode)) {
// If listNode appears at the end of the outer list item, then move listNode outside of this list item
@@ -1100,7 +1105,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
} else {
ASSERT(caretPos.deprecatedEditingOffset() == 0);
Text* textNode = static_cast<Text*>(caretPos.node());
- Node* parentNode = textNode->parentNode();
+ ContainerNode* parentNode = textNode->parentNode();
// The preserved newline must be the first thing in the node, since otherwise the previous
// paragraph would be quoted, and we verified that it wasn't above.
deleteTextFromNode(textNode, 0, 1);