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

Unified Diff: third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp

Issue 1785603002: TEXTAREA: Cutting last line without EOL should not remove the remaining EOL in the previous line. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove an ASSERT, update a comment Created 4 years, 9 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/html/HTMLTextAreaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
index 3cb4c6e774b708b134af2de98f96c7aa9e8731ed..7d1782c48ec5bfc0e61b3cdb0e78c22eefd48664 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
@@ -273,6 +273,19 @@ void HTMLTextAreaElement::handleFocusEvent(Element*, WebFocusType)
void HTMLTextAreaElement::subtreeHasChanged()
{
+#if ENABLE(ASSERT)
+ // The innerEditor should have either Text nodes or a placeholder break
+ // element. If we see other nodes, it's a bug in editing code and we should
+ // fix it.
+ Element* innerEditor = innerEditorElement();
+ for (Node& node : NodeTraversal::descendantsOf(*innerEditor)) {
+ if (node.isTextNode())
+ continue;
+ ASSERT(isHTMLBRElement(node));
+ ASSERT(&node == innerEditor->lastChild());
+ }
+#endif
+ addPlaceholderBreakElementIfNecessary();
setChangedSinceLastFormControlChangeEvent(true);
m_valueIsUpToDate = false;
setNeedsValidityCheck();

Powered by Google App Engine
This is Rietveld 408576698