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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 const AtomicString& dirnameAttrValue = fastGetAttribute(dirnameAttr); 214 const AtomicString& dirnameAttrValue = fastGetAttribute(dirnameAttr);
215 if (!dirnameAttrValue.isNull()) 215 if (!dirnameAttrValue.isNull())
216 encoding.appendData(dirnameAttrValue, directionForFormData()); 216 encoding.appendData(dirnameAttrValue, directionForFormData());
217 return true; 217 return true;
218 } 218 }
219 219
220 void HTMLTextAreaElement::resetImpl() 220 void HTMLTextAreaElement::resetImpl()
221 { 221 {
222 setNonDirtyValue(defaultValue()); 222 setNonDirtyValue(defaultValue());
223 unsigned endOfString = m_value.length();
224 setSelectionRange(endOfString, endOfString, SelectionHasNoDirection, NotChan geSelection);
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
223 } 225 }
224 226
225 bool HTMLTextAreaElement::hasCustomFocusLogic() const 227 bool HTMLTextAreaElement::hasCustomFocusLogic() const
226 { 228 {
227 return true; 229 return true;
228 } 230 }
229 231
230 bool HTMLTextAreaElement::isKeyboardFocusable() const 232 bool HTMLTextAreaElement::isKeyboardFocusable() const
231 { 233 {
232 // If a given text area can be focused at all, then it will always be keyboa rd focusable. 234 // If a given text area can be focused at all, then it will always be keyboa rd focusable.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 return; 366 return;
365 367
366 m_value = normalizedValue; 368 m_value = normalizedValue;
367 setInnerEditorValue(m_value); 369 setInnerEditorValue(m_value);
368 if (eventBehavior == DispatchNoEvent) 370 if (eventBehavior == DispatchNoEvent)
369 setLastChangeWasNotUserEdit(); 371 setLastChangeWasNotUserEdit();
370 updatePlaceholderVisibility(false); 372 updatePlaceholderVisibility(false);
371 setNeedsStyleRecalc(SubtreeStyleChange); 373 setNeedsStyleRecalc(SubtreeStyleChange);
372 m_suggestedValue = String(); 374 m_suggestedValue = String();
373 375
374 // Set the caret to the end of the text value. 376 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.
375 if (document().focusedElement() == this) { 377 // Set the caret to the end of the text value except for initialize.
376 unsigned endOfString = m_value.length(); 378 unsigned endOfString = m_value.length();
377 setSelectionRange(endOfString, endOfString); 379 setSelectionRange(endOfString, endOfString, SelectionHasNoDirection, Not ChangeSelection);
378 } 380 }
379 381
380 notifyFormStateChanged(); 382 notifyFormStateChanged();
381 if (eventBehavior == DispatchNoEvent) { 383 if (eventBehavior == DispatchNoEvent) {
382 setTextAsOfLastFormControlChangeEvent(normalizedValue); 384 setTextAsOfLastFormControlChangeEvent(normalizedValue);
383 } else { 385 } else {
384 if (eventBehavior == DispatchInputAndChangeEvent) 386 if (eventBehavior == DispatchInputAndChangeEvent)
385 dispatchFormControlInputEvent(); 387 dispatchFormControlInputEvent();
386 dispatchFormControlChangeEvent(); 388 dispatchFormControlChangeEvent();
387 } 389 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 { 558 {
557 return true; 559 return true;
558 } 560 }
559 561
560 bool HTMLTextAreaElement::supportsAutofocus() const 562 bool HTMLTextAreaElement::supportsAutofocus() const
561 { 563 {
562 return true; 564 return true;
563 } 565 }
564 566
565 } 567 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698