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

Unified Diff: third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp

Issue 2125553002: Fix an assertion failure in HTMLTextAreaElement::subtreeHasChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
index ccd2ef56ce0b0e5dbc30425c025cc2db4bd6a0d7..f125ac00380230540fb8c300d28d02d8432f703f 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
@@ -105,11 +105,15 @@ void InsertLineBreakCommand::doApply(EditingState* editingState)
if (needExtraLineBreak) {
Node* extraNode;
// TODO(tkent): Can we remove HTMLTextFormControlElement dependency?
- if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(nodeToInsert))
+ if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(nodeToInsert)) {
extraNode = textControl->createPlaceholderBreakElement();
- else
+ // The placeholder BR should be the last child. There might be
+ // empty Text nodes at |pos|.
+ appendNode(extraNode, nodeToInsert->parentNode(), editingState);
+ } else {
extraNode = nodeToInsert->cloneNode(false);
- insertNodeAfter(extraNode, nodeToInsert, editingState);
+ insertNodeAfter(extraNode, nodeToInsert, editingState);
+ }
if (editingState->isAborted())
return;
nodeToInsert = extraNode;

Powered by Google App Engine
This is Rietveld 408576698