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

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

Issue 2301323002: Merge "Do not scroll by input.select()." to M54 branch (Closed)
Patch Set: Created 4 years, 3 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 | « third_party/WebKit/LayoutTests/fast/forms/text/text-select-noscroll-expected.html ('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 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 void HTMLTextFormControlElement::setSelectionDirection(const String& direction) 185 void HTMLTextFormControlElement::setSelectionDirection(const String& direction)
186 { 186 {
187 setSelectionRangeForBinding(selectionStart(), selectionEnd(), direction); 187 setSelectionRangeForBinding(selectionStart(), selectionEnd(), direction);
188 } 188 }
189 189
190 void HTMLTextFormControlElement::select() 190 void HTMLTextFormControlElement::select()
191 { 191 {
192 setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirectio n, DispatchSelectEvent); 192 setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirectio n, DispatchSelectEvent);
193 focus(); 193 // Avoid SelectionBehaviorOnFocus::Restore, which scrolls containers to show
194 // the selection.
195 focus(FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr) );
196 restoreCachedSelection();
194 } 197 }
195 198
196 bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& ol dValue, String& newValue) 199 bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& ol dValue, String& newValue)
197 { 200 {
198 return !equalIgnoringNullity(oldValue, newValue); 201 return !equalIgnoringNullity(oldValue, newValue);
199 } 202 }
200 203
201 void HTMLTextFormControlElement::dispatchFormControlChangeEvent() 204 void HTMLTextFormControlElement::dispatchFormControlChangeEvent()
202 { 205 {
203 String newValue = value(); 206 String newValue = value();
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 } 1024 }
1022 1025
1023 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele ment& source) 1026 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele ment& source)
1024 { 1027 {
1025 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText FormControlElement&>(source); 1028 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText FormControlElement&>(source);
1026 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 1029 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
1027 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 1030 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
1028 } 1031 }
1029 1032
1030 } // namespace blink 1033 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/text/text-select-noscroll-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698