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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/editable_text_area_shadow.js

Issue 924083004: Shorten Closure template notation from Array.<*> to Array<*> in cvox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 Defines the EditableTextAreaShadow class. 6 * @fileoverview Defines the EditableTextAreaShadow class.
7 */ 7 */
8 8
9 goog.provide('cvox.EditableTextAreaShadow'); 9 goog.provide('cvox.EditableTextAreaShadow');
10 10
11 /** 11 /**
12 * Creates a shadow element for an editable text area used to compute line 12 * Creates a shadow element for an editable text area used to compute line
13 * numbers. 13 * numbers.
14 * @constructor 14 * @constructor
15 */ 15 */
16 cvox.EditableTextAreaShadow = function() { 16 cvox.EditableTextAreaShadow = function() {
17 /** 17 /**
18 * @type {Element} 18 * @type {Element}
19 * @private 19 * @private
20 */ 20 */
21 this.shadowElement_ = document.createElement('div'); 21 this.shadowElement_ = document.createElement('div');
22 22
23 /** 23 /**
24 * Map from line index to a data structure containing the start 24 * Map from line index to a data structure containing the start
25 * and end index within the line. 25 * and end index within the line.
26 * @type {Object.<number, {startIndex: number, endIndex: number}>} 26 * @type {Object<number, {startIndex: number, endIndex: number}>}
27 * @private 27 * @private
28 */ 28 */
29 this.lines_ = {}; 29 this.lines_ = {};
30 30
31 /** 31 /**
32 * Map from 0-based character index to 0-based line index. 32 * Map from 0-based character index to 0-based line index.
33 * @type {Array.<number>} 33 * @type {Array<number>}
34 * @private 34 * @private
35 */ 35 */
36 this.characterToLineMap_ = []; 36 this.characterToLineMap_ = [];
37 }; 37 };
38 38
39 /** 39 /**
40 * Update the shadow element. 40 * Update the shadow element.
41 * @param {Element} element The textarea element. 41 * @param {Element} element The textarea element.
42 */ 42 */
43 cvox.EditableTextAreaShadow.prototype.update = function(element) { 43 cvox.EditableTextAreaShadow.prototype.update = function(element) {
(...skipping 21 matching lines...) Expand all
65 * none of the characters are newlines and they're all at the same 65 * none of the characters are newlines and they're all at the same
66 * vertical position, we don't have to examine each one. If not, 66 * vertical position, we don't have to examine each one. If not,
67 * fall back to moving by one character at a time. 67 * fall back to moving by one character at a time.
68 * @const 68 * @const
69 */ 69 */
70 var SKIP = 8; 70 var SKIP = 8;
71 71
72 /** 72 /**
73 * Map from line index to a data structure containing the start 73 * Map from line index to a data structure containing the start
74 * and end index within the line. 74 * and end index within the line.
75 * @type {Object.<number, {startIndex: number, endIndex: number}>} 75 * @type {Object<number, {startIndex: number, endIndex: number}>}
76 */ 76 */
77 var lines = {0: {startIndex: 0, endIndex: 0}}; 77 var lines = {0: {startIndex: 0, endIndex: 0}};
78 78
79 var range = document.createRange(); 79 var range = document.createRange();
80 var offset = 0; 80 var offset = 0;
81 var lastGoodOffset = 0; 81 var lastGoodOffset = 0;
82 var lineIndex = 0; 82 var lineIndex = 0;
83 var lastBottom = null; 83 var lastBottom = null;
84 var nearNewline = false; 84 var nearNewline = false;
85 var rect; 85 var rect;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 }; 181 };
182 182
183 /** 183 /**
184 * Get the end character index of a line. 184 * Get the end character index of a line.
185 * @param {number} index The 0-based line index. 185 * @param {number} index The 0-based line index.
186 * @return {number} The 0-based index of the end of this line. 186 * @return {number} The 0-based index of the end of this line.
187 */ 187 */
188 cvox.EditableTextAreaShadow.prototype.getLineEnd = function(index) { 188 cvox.EditableTextAreaShadow.prototype.getLineEnd = function(index) {
189 return this.lines_[index].endIndex; 189 return this.lines_[index].endIndex;
190 }; 190 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698