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

Side by Side Diff: chrome/browser/resources/options/options_page.js

Issue 12226110: Fixed unexpected scroll when removing profiles in settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 ///////////////////////////////////////////////////////////////////////////// 6 /////////////////////////////////////////////////////////////////////////////
7 // OptionsPage class: 7 // OptionsPage class:
8 8
9 /** 9 /**
10 * Base class for options page. 10 * Base class for options page.
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 /** 752 /**
753 * Initializes page content. 753 * Initializes page content.
754 */ 754 */
755 initializePage: function() {}, 755 initializePage: function() {},
756 756
757 /** 757 /**
758 * Sets focus on the first focusable element. Override for a custom focus 758 * Sets focus on the first focusable element. Override for a custom focus
759 * strategy. 759 * strategy.
760 */ 760 */
761 focus: function() { 761 focus: function() {
762 // Do not change focus if any control on this page is already focused.
763 if (this.pageDiv.contains(document.activeElement))
764 return;
765
762 var elements = this.pageDiv.querySelectorAll( 766 var elements = this.pageDiv.querySelectorAll(
763 'input, list, select, textarea, button'); 767 'input, list, select, textarea, button');
764 for (var i = 0; i < elements.length; i++) { 768 for (var i = 0; i < elements.length; i++) {
765 var element = elements[i]; 769 var element = elements[i];
766 // Try to focus. If fails, then continue. 770 // Try to focus. If fails, then continue.
767 element.focus(); 771 element.focus();
768 if (document.activeElement == element) 772 if (document.activeElement == element)
769 return; 773 return;
770 } 774 }
771 }, 775 },
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 canShowPage: function() { 955 canShowPage: function() {
952 return true; 956 return true;
953 }, 957 },
954 }; 958 };
955 959
956 // Export 960 // Export
957 return { 961 return {
958 OptionsPage: OptionsPage 962 OptionsPage: OptionsPage
959 }; 963 };
960 }); 964 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698