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 /** | 5 /** |
6 * @fileoverview Defines the initial speech call. | 6 * @fileoverview Defines the initial speech call. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('cvox.InitialSpeech'); | 9 goog.provide('cvox.InitialSpeech'); |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Allow the web author to disable reading the page title on load | 43 // Allow the web author to disable reading the page title on load |
44 // by adding aria-hidden=true to the <title> element. | 44 // by adding aria-hidden=true to the <title> element. |
45 var titleElement = document.querySelector('head > title'); | 45 var titleElement = document.querySelector('head > title'); |
46 if (titleElement && titleElement.getAttribute('aria-hidden') == 'true') { | 46 if (titleElement && titleElement.getAttribute('aria-hidden') == 'true') { |
47 title = null; | 47 title = null; |
48 } | 48 } |
49 | 49 |
50 if (title && !disableSpeak) { | 50 if (title && !disableSpeak) { |
51 cvox.ChromeVox.tts.speak( | 51 cvox.ChromeVox.tts.speak( |
52 title, cvox.AbstractTts.QUEUE_MODE_FLUSH); | 52 title, cvox.QueueMode.FLUSH); |
53 } | 53 } |
54 cvox.BrailleOverlayWidget.getInstance().init(); | 54 cvox.BrailleOverlayWidget.getInstance().init(); |
55 } | 55 } |
56 | 56 |
57 // Initialize live regions and speak alerts. | 57 // Initialize live regions and speak alerts. |
58 cvox.LiveRegions.init( | 58 cvox.LiveRegions.init( |
59 new Date(), cvox.AbstractTts.QUEUE_MODE_QUEUE, disableSpeak); | 59 new Date(), cvox.QueueMode.QUEUE, disableSpeak); |
60 | 60 |
61 // If our activeElement is on body, try to sync to the first element. This | 61 // If our activeElement is on body, try to sync to the first element. This |
62 // actually happens inside of NavigationManager.reset, which doesn't get | 62 // actually happens inside of NavigationManager.reset, which doesn't get |
63 // called until AbstractHost.onPageLoad, but we need to speak and braille the | 63 // called until AbstractHost.onPageLoad, but we need to speak and braille the |
64 // initial node here. | 64 // initial node here. |
65 if (document.hasFocus() && document.activeElement == document.body) { | 65 if (document.hasFocus() && document.activeElement == document.body) { |
66 cvox.ChromeVox.navigationManager.syncToBeginning(); | 66 cvox.ChromeVox.navigationManager.syncToBeginning(); |
67 } | 67 } |
68 | 68 |
69 // If we had a previous position recorded, update to it. | 69 // If we had a previous position recorded, update to it. |
70 if (cvox.ChromeVox.position[document.location.href]) { | 70 if (cvox.ChromeVox.position[document.location.href]) { |
71 var pos = cvox.ChromeVox.position[document.location.href]; | 71 var pos = cvox.ChromeVox.position[document.location.href]; |
72 cvox.ChromeVox.navigationManager.updateSelToArbitraryNode( | 72 cvox.ChromeVox.navigationManager.updateSelToArbitraryNode( |
73 document.elementFromPoint(pos.x, pos.y)); | 73 document.elementFromPoint(pos.x, pos.y)); |
74 } | 74 } |
75 | 75 |
76 // If this iframe has focus, speak and braille the current focused element. | 76 // If this iframe has focus, speak and braille the current focused element. |
77 if (document.hasFocus()) { | 77 if (document.hasFocus()) { |
78 if (!disableSpeak) { | 78 if (!disableSpeak) { |
79 cvox.ChromeVoxEventSuspender.withSuspendedEvents(function() { | 79 cvox.ChromeVoxEventSuspender.withSuspendedEvents(function() { |
80 cvox.ChromeVox.navigationManager.finishNavCommand( | 80 cvox.ChromeVox.navigationManager.finishNavCommand( |
81 '', true, cvox.AbstractTts.QUEUE_MODE_QUEUE); | 81 '', true, cvox.QueueMode.QUEUE); |
82 })(); | 82 })(); |
83 } | 83 } |
84 } | 84 } |
85 }; | 85 }; |
OLD | NEW |