Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: Source/WebCore/html/HTMLElement.cpp

Issue 9569046: Merge 109362 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/editing/markup.cpp ('k') | Source/WebCore/html/HTMLOptionElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « Source/WebCore/editing/markup.cpp ('k') | Source/WebCore/html/HTMLOptionElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698