OLD | NEW |
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 goog.provide('cvox.TraverseMath'); | 5 goog.provide('cvox.TraverseMath'); |
6 | 6 |
7 goog.require('cvox.ChromeVox'); | 7 goog.require('cvox.ChromeVox'); |
8 goog.require('cvox.DomUtil'); | 8 goog.require('cvox.DomUtil'); |
9 goog.require('cvox.SemanticTree'); | 9 goog.require('cvox.SemanticTree'); |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 this.activeMath = null; | 23 this.activeMath = null; |
24 | 24 |
25 /** | 25 /** |
26 * The node currently under inspection. | 26 * The node currently under inspection. |
27 * @type {Node} | 27 * @type {Node} |
28 */ | 28 */ |
29 this.activeNode = null; | 29 this.activeNode = null; |
30 | 30 |
31 /** | 31 /** |
32 * Dictionary of all LaTeX elements in the page if there are any. | 32 * Dictionary of all LaTeX elements in the page if there are any. |
33 * @type {!Object.<string, !Node>} | 33 * @type {!Object<string, !Node>} |
34 * @private | 34 * @private |
35 */ | 35 */ |
36 this.allTexs_ = {}; | 36 this.allTexs_ = {}; |
37 | 37 |
38 /** | 38 /** |
39 * Dictionary of all MathJaxs elements in the page if there are any. | 39 * Dictionary of all MathJaxs elements in the page if there are any. |
40 * @type {!Object.<string, !Node>} | 40 * @type {!Object<string, !Node>} |
41 * @private | 41 * @private |
42 */ | 42 */ |
43 this.allMathjaxs_ = {}; | 43 this.allMathjaxs_ = {}; |
44 | 44 |
45 /** | 45 /** |
46 * Dictionary of all MathJaxs elements that have not yet been translated at | 46 * Dictionary of all MathJaxs elements that have not yet been translated at |
47 * page load or during MathJax rendering. | 47 * page load or during MathJax rendering. |
48 * @type {!Object.<string, !Node>} | 48 * @type {!Object<string, !Node>} |
49 * @private | 49 * @private |
50 */ | 50 */ |
51 this.todoMathjaxs_ = {}; | 51 this.todoMathjaxs_ = {}; |
52 | 52 |
53 /** | 53 /** |
54 * When traversing a Mathjax node this will contain the internal | 54 * When traversing a Mathjax node this will contain the internal |
55 * MathML representation of the node. | 55 * MathML representation of the node. |
56 * @type {Node} | 56 * @type {Node} |
57 */ | 57 */ |
58 this.activeMathmlHost = null; | 58 this.activeMathmlHost = null; |
59 | 59 |
60 /** | 60 /** |
61 * Semantic representation of the current node. | 61 * Semantic representation of the current node. |
62 * @type {Node} | 62 * @type {Node} |
63 */ | 63 */ |
64 this.activeSemanticHost = null; | 64 this.activeSemanticHost = null; |
65 | 65 |
66 /** | 66 /** |
67 * List of domain names. | 67 * List of domain names. |
68 * @type {Array.<string>} | 68 * @type {Array<string>} |
69 */ | 69 */ |
70 this.allDomains = []; | 70 this.allDomains = []; |
71 | 71 |
72 /** | 72 /** |
73 * List of style names. | 73 * List of style names. |
74 * @type {Array.<string>} | 74 * @type {Array<string>} |
75 */ | 75 */ |
76 this.allStyles = []; | 76 this.allStyles = []; |
77 | 77 |
78 /** | 78 /** |
79 * Current domain. | 79 * Current domain. |
80 * @type {string} | 80 * @type {string} |
81 */ | 81 */ |
82 this.domain = 'default'; | 82 this.domain = 'default'; |
83 | 83 |
84 /** | 84 /** |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 if (!node) { | 330 if (!node) { |
331 return null; | 331 return null; |
332 } | 332 } |
333 this.activeNode = node; | 333 this.activeNode = node; |
334 return this.activeNode; | 334 return this.activeNode; |
335 }; | 335 }; |
336 | 336 |
337 | 337 |
338 /** | 338 /** |
339 * Adds a list of domains and styles to the existing one. | 339 * Adds a list of domains and styles to the existing one. |
340 * @param {Array.<string>} domains List of domain names. | 340 * @param {Array<string>} domains List of domain names. |
341 * @param {Array.<string>} styles List of style names. | 341 * @param {Array<string>} styles List of style names. |
342 */ | 342 */ |
343 cvox.TraverseMath.prototype.addDomainsAndStyles = function(domains, styles) { | 343 cvox.TraverseMath.prototype.addDomainsAndStyles = function(domains, styles) { |
344 this.allDomains.push.apply( | 344 this.allDomains.push.apply( |
345 this.allDomains, | 345 this.allDomains, |
346 domains.filter( | 346 domains.filter( |
347 goog.bind(function(x) {return this.allDomains.indexOf(x) < 0;}, | 347 goog.bind(function(x) {return this.allDomains.indexOf(x) < 0;}, |
348 this))); | 348 this))); |
349 this.allStyles.push.apply( | 349 this.allStyles.push.apply( |
350 this.allStyles, | 350 this.allStyles, |
351 styles.filter( | 351 styles.filter( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 * @return {Node} The active node, if it exists. | 437 * @return {Node} The active node, if it exists. |
438 */ | 438 */ |
439 cvox.TraverseMath.prototype.getAttachedActiveNode = function() { | 439 cvox.TraverseMath.prototype.getAttachedActiveNode = function() { |
440 var node = this.activeNode; | 440 var node = this.activeNode; |
441 if (!node || node.nodeType != Node.ELEMENT_NODE) { | 441 if (!node || node.nodeType != Node.ELEMENT_NODE) { |
442 return null; | 442 return null; |
443 } | 443 } |
444 var id = node.getAttribute('spanID'); | 444 var id = node.getAttribute('spanID'); |
445 return document.getElementById(id); | 445 return document.getElementById(id); |
446 }; | 446 }; |
OLD | NEW |