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

Side by Side Diff: ui/webui/resources/js/cr/ui/focus_manager.js

Issue 2603443002: Clang format JS: Disallow single line functions, conditionals, loops, and switch statements (Closed)
Patch Set: update c/b/r/ as well Created 3 years, 12 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 // 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('cr.ui', function() { 5 cr.define('cr.ui', function() {
6 /** 6 /**
7 * Constructor for FocusManager singleton. Checks focus of elements to ensure 7 * Constructor for FocusManager singleton. Checks focus of elements to ensure
8 * that elements in "background" pages (i.e., those in a dialog that is not 8 * that elements in "background" pages (i.e., those in a dialog that is not
9 * the topmost overlay) do not receive focus. 9 * the topmost overlay) do not receive focus.
10 * @constructor 10 * @constructor
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 isDescendantOf_: function(parent, child) { 30 isDescendantOf_: function(parent, child) {
31 return !!parent && !(parent === child) && parent.contains(child); 31 return !!parent && !(parent === child) && parent.contains(child);
32 }, 32 },
33 33
34 /** 34 /**
35 * Returns the parent element containing all elements which should be 35 * Returns the parent element containing all elements which should be
36 * allowed to receive focus. 36 * allowed to receive focus.
37 * @return {Element} The element containing focusable elements. 37 * @return {Element} The element containing focusable elements.
38 */ 38 */
39 getFocusParent: function() { return document.body; }, 39 getFocusParent: function() {
40 return document.body;
41 },
40 42
41 /** 43 /**
42 * Returns the elements on the page capable of receiving focus. 44 * Returns the elements on the page capable of receiving focus.
43 * @return {Array<Element>} The focusable elements. 45 * @return {Array<Element>} The focusable elements.
44 */ 46 */
45 getFocusableElements_: function() { 47 getFocusableElements_: function() {
46 var focusableDiv = this.getFocusParent(); 48 var focusableDiv = this.getFocusParent();
47 49
48 // Create a TreeWalker object to traverse the DOM from |focusableDiv|. 50 // Create a TreeWalker object to traverse the DOM from |focusableDiv|.
49 var treeWalker = document.createTreeWalker( 51 var treeWalker = document.createTreeWalker(
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 'focus', this.onDocumentFocus_.bind(this), true); 189 'focus', this.onDocumentFocus_.bind(this), true);
188 document.addEventListener( 190 document.addEventListener(
189 'keydown', this.onDocumentKeyDown_.bind(this), true); 191 'keydown', this.onDocumentKeyDown_.bind(this), true);
190 }, 192 },
191 }; 193 };
192 194
193 return { 195 return {
194 FocusManager: FocusManager, 196 FocusManager: FocusManager,
195 }; 197 };
196 }); 198 });
OLDNEW
« no previous file with comments | « ui/webui/resources/js/cr/ui/focus_grid.js ('k') | ui/webui/resources/js/cr/ui/focus_outline_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698