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

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

Issue 2733783003: TEXTAREA element: Updating child nodes without updating textContent should do nothing (Closed)
Patch Set: Created 3 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/Source/core/html/HTMLTextAreaElement.h ('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/HTMLTextAreaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
index c85a2a35dc89818bbbb1815650782794b465f824..14546b547b875c7a7505eece485454917b82db7d 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
@@ -383,34 +383,24 @@ void HTMLTextAreaElement::setValue(const String& value,
}
void HTMLTextAreaElement::setNonDirtyValue(const String& value) {
- setValueCommon(value, DispatchNoEvent, SetSeletion);
+ setValueCommon(value, DispatchNoEvent);
m_isDirty = false;
}
void HTMLTextAreaElement::setValueCommon(const String& newValue,
- TextFieldEventBehavior eventBehavior,
- SetValueCommonOption setValueOption) {
+ TextFieldEventBehavior eventBehavior) {
// Code elsewhere normalizes line endings added by the user via the keyboard
// or pasting. We normalize line endings coming from JavaScript here.
String normalizedValue = newValue.isNull() ? "" : newValue;
normalizedValue.replace("\r\n", "\n");
normalizedValue.replace('\r', '\n');
- // Return early because we don't want to trigger other side effects
- // when the value isn't changing.
- // FIXME: Simple early return doesn't match the Firefox ever.
- // Remove these lines.
- if (normalizedValue == value()) {
- if (setValueOption == SetSeletion) {
- setNeedsValidityCheck();
- if (isFinishedParsingChildren()) {
- // Set the caret to the end of the text value except for initialize.
- unsigned endOfString = m_value.length();
- setSelectionRange(endOfString, endOfString);
- }
- }
+ // Return early because we don't want to trigger other side effects when the
+ // value isn't changing. This is interoperable though the specification
+ // doesn't define so.
+ // https://github.com/whatwg/html/issues/2412
+ if (normalizedValue == value())
return;
- }
m_value = normalizedValue;
setInnerEditorValue(m_value);
@@ -642,7 +632,7 @@ void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(
const Element& source) {
const HTMLTextAreaElement& sourceElement =
static_cast<const HTMLTextAreaElement&>(source);
- setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion);
+ setValueCommon(sourceElement.value(), DispatchNoEvent);
m_isDirty = sourceElement.m_isDirty;
TextControlElement::copyNonAttributePropertiesFromElement(source);
}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextAreaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698