| Index: Source/core/editing/ReplaceNodeWithSpanCommand.cpp
|
| diff --git a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
|
| index 7a6162e67dbe1f574edc50817e49265d7e1ae703..0e3088b0983b379c7455126549bb5bcd02e655ac 100644
|
| --- a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
|
| +++ b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/HTMLNames.h"
|
| #include "core/editing/htmlediting.h"
|
| #include "core/html/HTMLElement.h"
|
| +#include "core/html/HTMLSpanElement.h"
|
| #include "wtf/Assertions.h"
|
|
|
| namespace blink {
|
| @@ -48,21 +49,21 @@ ReplaceNodeWithSpanCommand::ReplaceNodeWithSpanCommand(PassRefPtrWillBeRawPtr<HT
|
| ASSERT(m_elementToReplace);
|
| }
|
|
|
| -static void swapInNodePreservingAttributesAndChildren(HTMLElement* newNode, HTMLElement& nodeToReplace)
|
| +static void swapInNodePreservingAttributesAndChildren(HTMLElement* newElement, HTMLElement& elementToReplace)
|
| {
|
| - ASSERT(nodeToReplace.inDocument());
|
| - RefPtrWillBeRawPtr<ContainerNode> parentNode = nodeToReplace.parentNode();
|
| - parentNode->insertBefore(newNode, &nodeToReplace);
|
| + ASSERT(elementToReplace.inDocument());
|
| + RefPtrWillBeRawPtr<ContainerNode> parentNode = elementToReplace.parentNode();
|
| + parentNode->insertBefore(newElement, &elementToReplace);
|
|
|
| NodeVector children;
|
| - getChildNodes(nodeToReplace, children);
|
| + getChildNodes(elementToReplace, children);
|
| for (size_t i = 0; i < children.size(); ++i)
|
| - newNode->appendChild(children[i]);
|
| + newElement->appendChild(children[i]);
|
|
|
| // FIXME: Fix this to send the proper MutationRecords when MutationObservers are present.
|
| - newNode->cloneDataFromElement(nodeToReplace);
|
| + newElement->cloneDataFromElement(elementToReplace);
|
|
|
| - parentNode->removeChild(&nodeToReplace, ASSERT_NO_EXCEPTION);
|
| + parentNode->removeChild(&elementToReplace, ASSERT_NO_EXCEPTION);
|
| }
|
|
|
| void ReplaceNodeWithSpanCommand::doApply()
|
| @@ -70,7 +71,7 @@ void ReplaceNodeWithSpanCommand::doApply()
|
| if (!m_elementToReplace->inDocument())
|
| return;
|
| if (!m_spanElement)
|
| - m_spanElement = createHTMLElement(m_elementToReplace->document(), spanTag);
|
| + m_spanElement = toHTMLSpanElement(createHTMLElement(m_elementToReplace->document(), spanTag).get());
|
| swapInNodePreservingAttributesAndChildren(m_spanElement.get(), *m_elementToReplace);
|
| }
|
|
|
|
|