Index: Source/WebCore/html/HTMLElement.cpp |
=================================================================== |
--- Source/WebCore/html/HTMLElement.cpp (revision 109464) |
+++ Source/WebCore/html/HTMLElement.cpp (working copy) |
@@ -335,10 +335,11 @@ |
return hasOneChild(node) && node->firstChild()->isTextNode(); |
} |
-static void replaceChildrenWithFragment(HTMLElement* element, PassRefPtr<DocumentFragment> fragment, ExceptionCode& ec) |
+static void replaceChildrenWithFragment(HTMLElement* elementNode, PassRefPtr<DocumentFragment> fragment, ExceptionCode& ec) |
{ |
+ RefPtr<HTMLElement> element(elementNode); |
#if ENABLE(MUTATION_OBSERVERS) |
- ChildListMutationScope mutation(element); |
+ ChildListMutationScope mutation(element.get()); |
#endif |
if (!fragment->firstChild()) { |
@@ -346,12 +347,12 @@ |
return; |
} |
- if (hasOneTextChild(element) && hasOneTextChild(fragment.get())) { |
+ if (hasOneTextChild(element.get()) && hasOneTextChild(fragment.get())) { |
static_cast<Text*>(element->firstChild())->setData(static_cast<Text*>(fragment->firstChild())->data(), ec); |
return; |
} |
- if (hasOneChild(element)) { |
+ if (hasOneChild(element.get())) { |
element->replaceChild(fragment, element->firstChild(), ec); |
return; |
} |
@@ -360,20 +361,21 @@ |
element->appendChild(fragment, ec); |
} |
-static void replaceChildrenWithText(HTMLElement* element, const String& text, ExceptionCode& ec) |
+static void replaceChildrenWithText(HTMLElement* elementNode, const String& text, ExceptionCode& ec) |
{ |
+ RefPtr<HTMLElement> element(elementNode); |
#if ENABLE(MUTATION_OBSERVERS) |
- ChildListMutationScope mutation(element); |
+ ChildListMutationScope mutation(element.get()); |
#endif |
- if (hasOneTextChild(element)) { |
+ if (hasOneTextChild(element.get())) { |
static_cast<Text*>(element->firstChild())->setData(text, ec); |
return; |
} |
RefPtr<Text> textNode = Text::create(element->document(), text); |
- if (hasOneChild(element)) { |
+ if (hasOneChild(element.get())) { |
element->replaceChild(textNode.release(), element->firstChild(), ec); |
return; |
} |