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

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

Issue 1776903003: Do not use setInnerText in INPUT / TEXTAREA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix some test failures 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
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-width-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
index 35b4b14224ae21c79349026f50d490901ceb5510..9d23449d46b8bcd35297a599851842c4013dbab0 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
@@ -38,6 +38,7 @@
#include "core/editing/FrameSelection.h"
#include "core/editing/iterators/CharacterIterator.h"
#include "core/editing/iterators/TextIterator.h"
+#include "core/editing/serializers/Serialization.h"
#include "core/events/Event.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
@@ -635,7 +636,11 @@ void HTMLTextFormControlElement::setInnerEditorValue(const String& value)
if (isHTMLBRElement(innerEditor->lastChild()))
innerEditor->removeChild(innerEditor->lastChild(), ASSERT_NO_EXCEPTION);
- innerEditor->setInnerText(value, ASSERT_NO_EXCEPTION);
+ // We don't use setTextContent. It triggers unnecessary paint.
+ if (value.isEmpty())
tkent 2016/03/10 00:57:02 I added this code after yosin's lgtm. Both of set
+ innerEditor->removeChildren();
+ else
+ replaceChildrenWithText(innerEditor, value, ASSERT_NO_EXCEPTION);
if (value.endsWith('\n') || value.endsWith('\r'))
innerEditor->appendChild(HTMLBRElement::create(document()));
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698