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

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: Update validity before updatelayout 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..ff34db902f8a27abda936542d8531f09308037fa 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -220,6 +220,8 @@ bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool)
void HTMLTextAreaElement::resetImpl()
{
setNonDirtyValue(defaultValue());
+ unsigned endOfString = m_value.length();
+ setSelectionRange(endOfString, endOfString, SelectionHasNoDirection, NotChangeSelection);
tkent 2014/07/24 01:04:22 Why only resetImpl() has this though childrenChang
yoichio 2014/07/24 03:06:06 I found also childrenChanged and setDefaultValue n
}
bool HTMLTextAreaElement::hasCustomFocusLogic() const
@@ -371,10 +373,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()) {
tkent 2014/07/24 01:04:22 Checking renderer() is not correct. We should cal
yoichio 2014/07/24 03:06:07 Done.
+ // Set the caret to the end of the text value except for initialize.
unsigned endOfString = m_value.length();
- setSelectionRange(endOfString, endOfString);
+ setSelectionRange(endOfString, endOfString, SelectionHasNoDirection, NotChangeSelection);
}
notifyFormStateChanged();

Powered by Google App Engine
This is Rietveld 408576698