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

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

Issue 392573002: HTMLTextAreaElement.setSelectionRange should not change focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Call setSelectionRange inside setValueCommon Created 6 years, 5 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/html/HTMLTextAreaElement.cpp
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index fd7ad6434bc60392e35ebe11871ee0c35cb2c472..9058c5e9ea5fa0ad64959cbb4f4fb8c85dd22f41 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -371,10 +371,10 @@ void HTMLTextAreaElement::setValueCommon(const String& newValue, TextFieldEventB
setNeedsStyleRecalc(SubtreeStyleChange);
m_suggestedValue = String();
- // Set the caret to the end of the text value.
- if (document().focusedElement() == this) {
+ if (renderer() && valid()) {
tkent 2014/07/23 02:25:24 I don't understand this code at all. Why valid()
yoichio 2014/07/23 10:39:07 Move validity check to setSelectionRange. HTMLTex
tkent 2014/07/24 01:04:22 ok, I understand that setNeedsValidityCheck() in s
+ // Set the caret to the end of the text value.
unsigned endOfString = m_value.length();
- setSelectionRange(endOfString, endOfString);
+ setSelectionRange(endOfString, endOfString, SelectionHasNoDirection, NotChangeSelection);
}
notifyFormStateChanged();
« no previous file with comments | « LayoutTests/fast/text/international/mixed-directionality-selection.html ('k') | Source/core/html/HTMLTextFormControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698