Index: Source/core/editing/TypingCommand.cpp |
diff --git a/Source/core/editing/TypingCommand.cpp b/Source/core/editing/TypingCommand.cpp |
index 924d58a0116caa746e532107a6dc19f813eb2b6c..709bb88f8757841a0b4bf1c4ad2236c66d74cee8 100644 |
--- a/Source/core/editing/TypingCommand.cpp |
+++ b/Source/core/editing/TypingCommand.cpp |
@@ -29,6 +29,7 @@ |
#include "HTMLNames.h" |
#include "core/dom/Document.h" |
#include "core/dom/Element.h" |
+#include "core/dom/ElementTraversal.h" |
#include "core/editing/BreakBlockquoteCommand.h" |
#include "core/editing/Editor.h" |
#include "core/editing/FrameSelection.h" |
@@ -381,10 +382,13 @@ bool TypingCommand::makeEditableRootEmpty() |
if (!root || !root->firstChild()) |
return false; |
- if (root->firstChild() == root->lastChild() && root->firstElementChild() && root->firstElementChild()->hasTagName(brTag)) { |
- // If there is a single child and it could be a placeholder, leave it alone. |
- if (root->renderer() && root->renderer()->isRenderBlockFlow()) |
- return false; |
+ if (root->firstChild() == root->lastChild()) { |
+ Element* firstElementChild = ElementTraversal::firstWithin(*root); |
+ if (firstElementChild && firstElementChild->hasTagName(brTag)) { |
+ // If there is a single child and it could be a placeholder, leave it alone. |
+ if (root->renderer() && root->renderer()->isRenderBlockFlow()) |
+ return false; |
+ } |
} |
while (Node* child = root->firstChild()) |