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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/walkers/abstract_walker.js

Issue 2943193002: Run clang-format on .js files in c/b/r/chromeos/chromevox (Closed)
Patch Set: Created 3 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 5 /**
6 * @fileoverview An interface (and partial implementation) for the basic 6 * @fileoverview An interface (and partial implementation) for the basic
7 * traversal through some piece of the dom. 7 * traversal through some piece of the dom.
8 * For each different ordered (either in dom or by any other metric) set 8 * For each different ordered (either in dom or by any other metric) set
9 * of "valid selections" (just set from now on), a new 9 * of "valid selections" (just set from now on), a new
10 * base class should be defined that implements this interface. For example, 10 * base class should be defined that implements this interface. For example,
(...skipping 28 matching lines...) Expand all
39 39
40 40
41 goog.provide('cvox.AbstractWalker'); 41 goog.provide('cvox.AbstractWalker');
42 42
43 goog.require('cvox.CursorSelection'); 43 goog.require('cvox.CursorSelection');
44 goog.require('cvox.NavBraille'); 44 goog.require('cvox.NavBraille');
45 45
46 /** 46 /**
47 * @constructor 47 * @constructor
48 */ 48 */
49 cvox.AbstractWalker = function() { 49 cvox.AbstractWalker = function() {};
50 };
51 50
52 51
53 /** 52 /**
54 * This takes a valid CursorSelection and returns the directed-next 53 * This takes a valid CursorSelection and returns the directed-next
55 * valid CursorSelection in the dom, or null. For example, if the walker 54 * valid CursorSelection in the dom, or null. For example, if the walker
56 * navigates across sentences, this would return the selection of the sentence 55 * navigates across sentences, this would return the selection of the sentence
57 * following the selection passed in. If sel is at the "end" of a section, 56 * following the selection passed in. If sel is at the "end" of a section,
58 * this method may return null. In the example above, if we try to next on 57 * this method may return null. In the example above, if we try to next on
59 * the last sentence in the dom, we would return null. 58 * the last sentence in the dom, we would return null.
60 * Note that sel must be a valid selection. Undefined behavior if it isn't. 59 * Note that sel must be a valid selection. Undefined behavior if it isn't.
(...skipping 18 matching lines...) Expand all
79 * Syncs and returns the first or last valid, non-null selection in the 78 * Syncs and returns the first or last valid, non-null selection in the
80 * this walker's linearization of the DOM. 79 * this walker's linearization of the DOM.
81 * @param {{reversed: (undefined|boolean)}=} kwargs Extra arguments. 80 * @param {{reversed: (undefined|boolean)}=} kwargs Extra arguments.
82 * reversed: If true, syncs to the end and returns a reversed selection. 81 * reversed: If true, syncs to the end and returns a reversed selection.
83 * False by default. 82 * False by default.
84 * @return {!cvox.CursorSelection} The valid selection. 83 * @return {!cvox.CursorSelection} The valid selection.
85 */ 84 */
86 cvox.AbstractWalker.prototype.begin = function(kwargs) { 85 cvox.AbstractWalker.prototype.begin = function(kwargs) {
87 kwargs = kwargs || {reversed: false}; 86 kwargs = kwargs || {reversed: false};
88 87
89 return /** @type {!cvox.CursorSelection} */ (this.sync( 88 return /** @type {!cvox.CursorSelection} */ (
90 cvox.CursorSelection.fromBody().setReversed(kwargs.reversed))); 89 this.sync(cvox.CursorSelection.fromBody().setReversed(kwargs.reversed)));
91 }; 90 };
92 91
93 92
94 /** 93 /**
95 * This takes an arbitrary CursorSelection and returns a valid CursorSelection, 94 * This takes an arbitrary CursorSelection and returns a valid CursorSelection,
96 * or null. For example, if the walker navigates across 95 * or null. For example, if the walker navigates across
97 * text nodes, and the selection passed in is for a single character within a 96 * text nodes, and the selection passed in is for a single character within a
98 * larger text node, this method should return a text node. No restrictions 97 * larger text node, this method should return a text node. No restrictions
99 * are made as to exactly what selection should be returned, but it should be 98 * are made as to exactly what selection should be returned, but it should be
100 * something "reasonable", and from the user's point of view, "close" to the 99 * something "reasonable", and from the user's point of view, "close" to the
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return this[name](sel); 167 return this[name](sel);
169 } 168 }
170 return null; 169 return null;
171 }; 170 };
172 171
173 /** 172 /**
174 * Returns message string of the walker's granularity. 173 * Returns message string of the walker's granularity.
175 * @return {string} The message string. 174 * @return {string} The message string.
176 */ 175 */
177 cvox.AbstractWalker.prototype.getGranularityMsg = goog.abstractMethod; 176 cvox.AbstractWalker.prototype.getGranularityMsg = goog.abstractMethod;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698