Chromium Code Reviews| 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())); |