Index: Source/WebCore/editing/ReplaceSelectionCommand.cpp |
=================================================================== |
--- Source/WebCore/editing/ReplaceSelectionCommand.cpp (revision 120113) |
+++ Source/WebCore/editing/ReplaceSelectionCommand.cpp (working copy) |
@@ -81,7 +81,7 @@ |
bool hasInterchangeNewlineAtEnd() const { return m_hasInterchangeNewlineAtEnd; } |
void removeNode(PassRefPtr<Node>); |
- void removeNodePreservingChildren(Node*); |
+ void removeNodePreservingChildren(PassRefPtr<Node>); |
private: |
PassRefPtr<StyledElement> insertFragmentForTestRendering(Node* rootEditableNode); |
@@ -211,14 +211,14 @@ |
return m_fragment ? m_fragment->lastChild() : 0; |
} |
-void ReplacementFragment::removeNodePreservingChildren(Node *node) |
+void ReplacementFragment::removeNodePreservingChildren(PassRefPtr<Node> node) |
{ |
if (!node) |
return; |
while (RefPtr<Node> n = node->firstChild()) { |
removeNode(n); |
- insertNodeBefore(n.release(), node); |
+ insertNodeBefore(n.release(), node.get()); |
} |
removeNode(node); |
} |
@@ -329,18 +329,12 @@ |
node = container->firstChild(); |
while (node) { |
- Node *next = node->traverseNextNode(); |
+ RefPtr<Node> next = node->traverseNextNode(); |
if (isInterchangeConvertedSpaceSpan(node)) { |
- RefPtr<Node> n = 0; |
- while ((n = node->firstChild())) { |
- removeNode(n); |
- insertNodeBefore(n, node); |
- } |
- removeNode(node); |
- if (n) |
- next = n->traverseNextNode(); |
+ next = node->traverseNextSibling(); |
+ removeNodePreservingChildren(node); |
} |
- node = next; |
+ node = next.get(); |
} |
} |