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

Side by Side Diff: Source/core/html/HTMLTextAreaElement.cpp

Issue 222023002: focus() behaviour differs depending on how value is set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebasing Created 6 years, 8 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
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | Source/core/html/HTMLTextFormControlElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return isFocusable(); 233 return isFocusable();
234 } 234 }
235 235
236 bool HTMLTextAreaElement::shouldShowFocusRingOnMouseFocus() const 236 bool HTMLTextAreaElement::shouldShowFocusRingOnMouseFocus() const
237 { 237 {
238 return true; 238 return true;
239 } 239 }
240 240
241 void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) 241 void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection)
242 { 242 {
243 if (!restorePreviousSelection || !hasCachedSelection()) { 243 if (!restorePreviousSelection)
244 // If this is the first focus, set a caret at the beginning of the text.
245 // This matches some browsers' behavior; see bug 11746 Comment #15.
246 // http://bugs.webkit.org/show_bug.cgi?id=11746#c15
247 setSelectionRange(0, 0); 244 setSelectionRange(0, 0);
248 } else 245 else
249 restoreCachedSelection(); 246 restoreCachedSelection();
250 247
251 if (document().frame()) 248 if (document().frame())
252 document().frame()->selection().revealSelection(); 249 document().frame()->selection().revealSelection();
253 } 250 }
254 251
255 void HTMLTextAreaElement::defaultEventHandler(Event* event) 252 void HTMLTextAreaElement::defaultEventHandler(Event* event)
256 { 253 {
257 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur)) 254 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur))
258 forwardEvent(event); 255 forwardEvent(event);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 { 561 {
565 return true; 562 return true;
566 } 563 }
567 564
568 bool HTMLTextAreaElement::supportsAutofocus() const 565 bool HTMLTextAreaElement::supportsAutofocus() const
569 { 566 {
570 return true; 567 return true;
571 } 568 }
572 569
573 } 570 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | Source/core/html/HTMLTextFormControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698