Chromium Code Reviews| Index: Source/core/editing/markup.cpp |
| diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp |
| index f7240ebcdd02b76de91fe266e63a858ff9c5b6e0..e29f2ca9cc010433129589d80b4043c508d2d9e2 100644 |
| --- a/Source/core/editing/markup.cpp |
| +++ b/Source/core/editing/markup.cpp |
| @@ -1006,11 +1006,13 @@ void replaceChildrenWithFragment(ContainerNode* container, PassRefPtr<DocumentFr |
| return; |
| } |
| + // FIXME: This is wrong if containerNode->firstChild() has more than one ref! |
|
Julien - ping for review
2014/03/18 22:55:55
I am not sure I understand this comment. All refer
|
| if (containerNode->hasOneTextChild() && fragment->hasOneTextChild()) { |
| toText(containerNode->firstChild())->setData(toText(fragment->firstChild())->data()); |
| return; |
| } |
| + // FIXME: No need to replace the child it is a text node and its contents are already == text. |
| if (containerNode->hasOneChild()) { |
| containerNode->replaceChild(fragment, containerNode->firstChild(), exceptionState); |
| return; |
| @@ -1027,13 +1029,16 @@ void replaceChildrenWithText(ContainerNode* container, const String& text, Excep |
| ChildListMutationScope mutation(*containerNode); |
| + // FIXME: This is wrong if containerNode->firstChild() has more than one ref! |
| if (containerNode->hasOneTextChild()) { |
| toText(containerNode->firstChild())->setData(text); |
| return; |
| } |
| + // NOTE: This method currently always creates a text node, even if that text node will be empty. |
| RefPtr<Text> textNode = Text::create(containerNode->document(), text); |
| + // FIXME: No need to replace the child it is a text node and its contents are already == text. |
| if (containerNode->hasOneChild()) { |
| containerNode->replaceChild(textNode.release(), containerNode->firstChild(), exceptionState); |
| return; |