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

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: 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 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 return; 364 return;
365 365
366 m_value = normalizedValue; 366 m_value = normalizedValue;
367 setInnerEditorValue(m_value); 367 setInnerEditorValue(m_value);
368 if (eventBehavior == DispatchNoEvent) 368 if (eventBehavior == DispatchNoEvent)
369 setLastChangeWasNotUserEdit(); 369 setLastChangeWasNotUserEdit();
370 updatePlaceholderVisibility(false); 370 updatePlaceholderVisibility(false);
371 setNeedsStyleRecalc(SubtreeStyleChange); 371 setNeedsStyleRecalc(SubtreeStyleChange);
372 m_suggestedValue = String(); 372 m_suggestedValue = String();
373 373
374 // Set the caret to the end of the text value. 374 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
375 if (document().focusedElement() == this) { 375 // Set the caret to the end of the text value.
376 unsigned endOfString = m_value.length(); 376 unsigned endOfString = m_value.length();
377 setSelectionRange(endOfString, endOfString); 377 setSelectionRange(endOfString, endOfString, SelectionHasNoDirection, Not ChangeSelection);
378 } 378 }
379 379
380 notifyFormStateChanged(); 380 notifyFormStateChanged();
381 if (eventBehavior == DispatchNoEvent) { 381 if (eventBehavior == DispatchNoEvent) {
382 setTextAsOfLastFormControlChangeEvent(normalizedValue); 382 setTextAsOfLastFormControlChangeEvent(normalizedValue);
383 } else { 383 } else {
384 if (eventBehavior == DispatchInputAndChangeEvent) 384 if (eventBehavior == DispatchInputAndChangeEvent)
385 dispatchFormControlInputEvent(); 385 dispatchFormControlInputEvent();
386 dispatchFormControlChangeEvent(); 386 dispatchFormControlChangeEvent();
387 } 387 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 { 556 {
557 return true; 557 return true;
558 } 558 }
559 559
560 bool HTMLTextAreaElement::supportsAutofocus() const 560 bool HTMLTextAreaElement::supportsAutofocus() const
561 { 561 {
562 return true; 562 return true;
563 } 563 }
564 564
565 } 565 }
OLDNEW
« 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