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

Unified Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 13532011: Stop inserting placeholders for TextArea and Input elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Levi's nit Created 7 years, 8 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: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index 6e7f44aa4e64f7268edb7a86c1de52f98bb54ba8..c4686f265da0e2d5675a1ab65521a16666711508 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -36,6 +36,7 @@
#include "Frame.h"
#include "htmlediting.h"
#include "HTMLInputElement.h"
+#include "HTMLTextAreaElement.h"
#include "HTMLNames.h"
#include "NodeTraversal.h"
#include "RenderTableCell.h"
@@ -790,9 +791,9 @@ void DeleteSelectionCommand::doApply()
String originalString = originalStringForAutocorrectionAtBeginningOfSelection();
+ Element* textControl = enclosingTextFormControl(m_selectionToDelete.start());
// If the deletion is occurring in a text field, and we're not deleting to replace the selection, then let the frame call across the bridge to notify the form delegate.
if (!m_replace) {
- Element* textControl = enclosingTextFormControl(m_selectionToDelete.start());
if (textControl && textControl->focused())
document()->frame()->editor()->textWillBeDeletedInTextField(textControl);
}
@@ -803,7 +804,9 @@ void DeleteSelectionCommand::doApply()
Position downstreamEnd = m_selectionToDelete.end().downstream();
m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditingBoundary)
&& isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBoundary)
- && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd());
+ && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd())
+ && !(textControl && (isHTMLTextAreaElement(textControl) || textControl->toInputElement())) ;
+
if (m_needPlaceholder) {
// Don't need a placeholder when deleting a selection that starts just before a table
// and ends inside it (we do need placeholders to hold open empty cells, but that's

Powered by Google App Engine
This is Rietveld 408576698