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

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

Issue 1437813002: Set selection to INPUT/TEXTAREA before dispatching 'focus' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve selection-functions.html Created 5 years, 1 month 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 | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | no next file » | 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void HTMLTextAreaElement::updateFocusAppearance(SelectionBehaviorOnFocus selecti onBehavior) 244 void HTMLTextAreaElement::updateFocusAppearance(SelectionBehaviorOnFocus selecti onBehavior)
245 { 245 {
246 switch (selectionBehavior) { 246 switch (selectionBehavior) {
247 case SelectionBehaviorOnFocus::Reset: 247 case SelectionBehaviorOnFocus::Reset:
248 setSelectionRange(0, 0, SelectionHasNoDirection, NotDispatchSelectEvent) ; 248 setSelectionRange(0, 0, SelectionHasNoDirection, NotDispatchSelectEvent) ;
249 break; 249 break;
250 case SelectionBehaviorOnFocus::Restore: 250 case SelectionBehaviorOnFocus::Restore:
251 restoreCachedSelection(); 251 restoreCachedSelection();
252 break; 252 break;
253 case SelectionBehaviorOnFocus::None: 253 case SelectionBehaviorOnFocus::None:
254 // |None| is used only for FocusController::setFocusedElement and 254 return;
255 // Document::setFocusedElement, and they don't call
256 // updateFocusAppearance().
257 ASSERT_NOT_REACHED();
258 } 255 }
259 if (document().frame()) 256 if (document().frame())
260 document().frame()->selection().revealSelection(); 257 document().frame()->selection().revealSelection();
261 } 258 }
262 259
263 void HTMLTextAreaElement::defaultEventHandler(Event* event) 260 void HTMLTextAreaElement::defaultEventHandler(Event* event)
264 { 261 {
265 if (layoutObject() && (event->isMouseEvent() || event->isDragEvent() || even t->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur )) 262 if (layoutObject() && (event->isMouseEvent() || event->isDragEvent() || even t->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur ))
266 forwardEvent(event); 263 forwardEvent(event);
267 else if (layoutObject() && event->isBeforeTextInsertedEvent()) 264 else if (layoutObject() && event->isBeforeTextInsertedEvent())
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 651
655 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s ource) 652 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s ource)
656 { 653 {
657 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle ment&>(source); 654 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle ment&>(source);
658 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); 655 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion);
659 m_isDirty = sourceElement.m_isDirty; 656 m_isDirty = sourceElement.m_isDirty;
660 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); 657 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
661 } 658 }
662 659
663 } // namespace blink 660 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698