2009-03-12 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Darin Adler.
Bug 24110: cloneNode should call cloneElement and not the reverse
- Splitted the code from cloneNode into cloneElementWithChildren and cloneElementWithChildren.
Now cloneNode calls one of the 2 previous methods.
- Renamed cloneElement to cloneElementWithoutChildren as it was the previous behaviour.
- Moved cloneNode to the Element private section so that WebCore callers cannot use it.
- Removed Element::cloneNode usage through WebCore.
* dom/Element.cpp:
(WebCore::Element::cloneNode): Moved to Element's private section and it
now calls the two next methods.
(WebCore::Element::cloneElementWithChildren): Added.
(WebCore::Element::cloneElementWithoutChildren): Renamed from cloneElement
to avoid ambiguity.
* dom/Element.h:
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded): Changed call to cloneElement
to call to cloneElementWithoutChildren.
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply): Ditto.
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::indentRegion): Ditto.
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
* editing/ModifySelectionListLevel.cpp:
(WebCore::IncreaseSelectionListLevelCommand::doApply): Ditto.
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::doApply): Ditto.
* editing/markup.cpp:
(WebCore::createFragmentFromText): Ditto.
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::buildShadowTree): Ditto.
(WebCore::SVGUseElement::expandUseElementsInShadowTree): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/editing/BreakBlockquoteCommand.cpp b/WebCore/editing/BreakBlockquoteCommand.cpp
index 909efdd..2a513a5 100644
--- a/WebCore/editing/BreakBlockquoteCommand.cpp
+++ b/WebCore/editing/BreakBlockquoteCommand.cpp
@@ -107,7 +107,7 @@
ancestors.append(node);
// Insert a clone of the top blockquote after the break.
- RefPtr<Element> clonedBlockquote = topBlockquote->cloneElement();
+ RefPtr<Element> clonedBlockquote = topBlockquote->cloneElementWithoutChildren();
insertNodeAfter(clonedBlockquote.get(), breakNode.get());
// Clone startNode's ancestors into the cloned blockquote.
@@ -116,7 +116,7 @@
// or clonedBlockquote if ancestors is empty).
RefPtr<Element> clonedAncestor = clonedBlockquote;
for (size_t i = ancestors.size(); i != 0; --i) {
- RefPtr<Element> clonedChild = ancestors[i - 1]->cloneElement(); // shallow clone
+ RefPtr<Element> clonedChild = ancestors[i - 1]->cloneElementWithoutChildren();
// Preserve list item numbering in cloned lists.
if (clonedChild->isElementNode() && clonedChild->hasTagName(olTag)) {
Node* listChildNode = i > 1 ? ancestors[i - 2] : startNode;