| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
|
| index 584adc37d76a446f1beb703010e9c73fa0e67852..ae5450bd058ba0d9cbc3745eba90c460c48218b6 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
|
| @@ -43,61 +43,46 @@ DesktopAutomationHandler = function(node) {
|
| */
|
| this.lastValueChanged_ = new Date(0);
|
|
|
| - this.addListener_(EventType.ACTIVEDESCENDANTCHANGED,
|
| - this.onActiveDescendantChanged);
|
| - this.addListener_(EventType.ALERT,
|
| - this.onAlert);
|
| - this.addListener_(EventType.ARIA_ATTRIBUTE_CHANGED,
|
| - this.onAriaAttributeChanged);
|
| - this.addListener_(EventType.AUTOCORRECTION_OCCURED,
|
| - this.onEventIfInRange);
|
| - this.addListener_(EventType.BLUR,
|
| - this.onBlur);
|
| - this.addListener_(EventType.CHECKED_STATE_CHANGED,
|
| - this.onCheckedStateChanged);
|
| - this.addListener_(EventType.CHILDREN_CHANGED,
|
| - this.onChildrenChanged);
|
| - this.addListener_(EventType.EXPANDED_CHANGED,
|
| - this.onEventIfInRange);
|
| - this.addListener_(EventType.FOCUS,
|
| - this.onFocus);
|
| - this.addListener_(EventType.HOVER,
|
| - this.onHover);
|
| - this.addListener_(EventType.INVALID_STATUS_CHANGED,
|
| - this.onEventIfInRange);
|
| - this.addListener_(EventType.LOAD_COMPLETE,
|
| - this.onLoadComplete);
|
| - this.addListener_(EventType.MENU_END,
|
| - this.onMenuEnd);
|
| - this.addListener_(EventType.MENU_LIST_ITEM_SELECTED,
|
| - this.onEventIfSelected);
|
| - this.addListener_(EventType.MENU_START,
|
| - this.onMenuStart);
|
| - this.addListener_(EventType.ROW_COLLAPSED,
|
| - this.onEventIfInRange);
|
| - this.addListener_(EventType.ROW_EXPANDED,
|
| - this.onEventIfInRange);
|
| - this.addListener_(EventType.SCROLL_POSITION_CHANGED,
|
| - this.onScrollPositionChanged);
|
| - this.addListener_(EventType.SELECTION,
|
| - this.onSelection);
|
| - this.addListener_(EventType.TEXT_CHANGED,
|
| - this.onTextChanged);
|
| - this.addListener_(EventType.TEXT_SELECTION_CHANGED,
|
| - this.onTextSelectionChanged);
|
| - this.addListener_(EventType.VALUE_CHANGED,
|
| - this.onValueChanged);
|
| + this.addListener_(
|
| + EventType.ACTIVEDESCENDANTCHANGED, this.onActiveDescendantChanged);
|
| + this.addListener_(EventType.ALERT, this.onAlert);
|
| + this.addListener_(
|
| + EventType.ARIA_ATTRIBUTE_CHANGED, this.onAriaAttributeChanged);
|
| + this.addListener_(EventType.AUTOCORRECTION_OCCURED, this.onEventIfInRange);
|
| + this.addListener_(EventType.BLUR, this.onBlur);
|
| + this.addListener_(
|
| + EventType.CHECKED_STATE_CHANGED, this.onCheckedStateChanged);
|
| + this.addListener_(EventType.CHILDREN_CHANGED, this.onChildrenChanged);
|
| + this.addListener_(EventType.EXPANDED_CHANGED, this.onEventIfInRange);
|
| + this.addListener_(EventType.FOCUS, this.onFocus);
|
| + this.addListener_(EventType.HOVER, this.onHover);
|
| + this.addListener_(EventType.INVALID_STATUS_CHANGED, this.onEventIfInRange);
|
| + this.addListener_(EventType.LOAD_COMPLETE, this.onLoadComplete);
|
| + this.addListener_(EventType.MENU_END, this.onMenuEnd);
|
| + this.addListener_(EventType.MENU_LIST_ITEM_SELECTED, this.onEventIfSelected);
|
| + this.addListener_(EventType.MENU_START, this.onMenuStart);
|
| + this.addListener_(EventType.ROW_COLLAPSED, this.onEventIfInRange);
|
| + this.addListener_(EventType.ROW_EXPANDED, this.onEventIfInRange);
|
| + this.addListener_(
|
| + EventType.SCROLL_POSITION_CHANGED, this.onScrollPositionChanged);
|
| + this.addListener_(EventType.SELECTION, this.onSelection);
|
| + this.addListener_(EventType.TEXT_CHANGED, this.onTextChanged);
|
| + this.addListener_(
|
| + EventType.TEXT_SELECTION_CHANGED, this.onTextSelectionChanged);
|
| + this.addListener_(EventType.VALUE_CHANGED, this.onValueChanged);
|
|
|
| AutomationObjectConstructorInstaller.init(node, function() {
|
| - chrome.automation.getFocus((function(focus) {
|
| - if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT)
|
| - return;
|
| -
|
| - if (focus) {
|
| - var event = new CustomAutomationEvent(EventType.FOCUS, focus, 'page');
|
| - this.onFocus(event);
|
| - }
|
| - }).bind(this));
|
| + chrome.automation.getFocus(
|
| + (function(focus) {
|
| + if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT)
|
| + return;
|
| +
|
| + if (focus) {
|
| + var event =
|
| + new CustomAutomationEvent(EventType.FOCUS, focus, 'page');
|
| + this.onFocus(event);
|
| + }
|
| + }).bind(this));
|
| }.bind(this));
|
| };
|
|
|
| @@ -142,8 +127,7 @@ DesktopAutomationHandler.prototype = {
|
| return;
|
|
|
| // Don't output if focused node hasn't changed.
|
| - if (prevRange &&
|
| - evt.type == 'focus' &&
|
| + if (prevRange && evt.type == 'focus' &&
|
| ChromeVoxState.instance.currentRange.equals(prevRange))
|
| return;
|
|
|
| @@ -176,9 +160,9 @@ DesktopAutomationHandler.prototype = {
|
|
|
| // Intentionally skip setting range.
|
| new Output()
|
| - .withRichSpeechAndBraille(cursors.Range.fromNode(evt.target),
|
| - prev,
|
| - Output.EventType.NAVIGATE)
|
| + .withRichSpeechAndBraille(
|
| + cursors.Range.fromNode(evt.target), prev,
|
| + Output.EventType.NAVIGATE)
|
| .go();
|
| }
|
| },
|
| @@ -290,7 +274,8 @@ DesktopAutomationHandler.prototype = {
|
|
|
| // Always refresh the braille contents.
|
| if (curRange && curRange.equals(cursors.Range.fromNode(evt.target))) {
|
| - new Output().withBraille(curRange, curRange, Output.EventType.NAVIGATE)
|
| + new Output()
|
| + .withBraille(curRange, curRange, Output.EventType.NAVIGATE)
|
| .go();
|
| }
|
|
|
| @@ -325,9 +310,9 @@ DesktopAutomationHandler.prototype = {
|
| var prevRange = ChromeVoxState.instance.currentRange;
|
| var prevNode = prevRange ? prevRange.start.node : null;
|
| if (prevNode) {
|
| - var prevRoot = AutomationUtil.getTopLevelRoot(prevNode);
|
| + var prevRoot = AutomationUtil.getTopLevelRoot(prevNode);
|
| if (prevRoot && prevRoot !== root)
|
| - ChromeVoxState.instance.focusRecoveryMap.set(prevRoot, prevRange);
|
| + ChromeVoxState.instance.focusRecoveryMap.set(prevRoot, prevRange);
|
| }
|
| // If a previous node was saved for this focus, restore it.
|
| var savedRange = ChromeVoxState.instance.focusRecoveryMap.get(root);
|
| @@ -354,10 +339,12 @@ DesktopAutomationHandler.prototype = {
|
| // ChromeVox.
|
| this.createTextEditHandlerIfNeeded_(focus);
|
|
|
| - // If auto read is set, skip focus recovery and start reading from the top.
|
| + // If auto read is set, skip focus recovery and start reading from the
|
| + // top.
|
| if (localStorage['autoRead'] == 'true' &&
|
| AutomationUtil.getTopLevelRoot(evt.target) == evt.target) {
|
| - ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(evt.target));
|
| + ChromeVoxState.instance.setCurrentRange(
|
| + cursors.Range.fromNode(evt.target));
|
| cvox.ChromeVox.tts.stop();
|
| CommandHandler.onCommand('readFromHere');
|
| return;
|
| @@ -388,7 +375,8 @@ DesktopAutomationHandler.prototype = {
|
|
|
| Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
|
| o.withRichSpeechAndBraille(
|
| - ChromeVoxState.instance.currentRange, null, evt.type).go();
|
| + ChromeVoxState.instance.currentRange, null, evt.type)
|
| + .go();
|
| }.bind(this));
|
| },
|
|
|
| @@ -418,9 +406,7 @@ DesktopAutomationHandler.prototype = {
|
| onEditableChanged_: function(evt) {
|
| var topRoot = AutomationUtil.getTopLevelRoot(evt.target);
|
| if (!evt.target.state.focused ||
|
| - (topRoot &&
|
| - topRoot.parent &&
|
| - !topRoot.parent.state.focused))
|
| + (topRoot && topRoot.parent && !topRoot.parent.state.focused))
|
| return;
|
|
|
| if (!ChromeVoxState.instance.currentRange) {
|
| @@ -466,8 +452,7 @@ DesktopAutomationHandler.prototype = {
|
| return;
|
|
|
| var t = evt.target;
|
| - if (t.state.focused ||
|
| - t.root.role == RoleType.DESKTOP ||
|
| + if (t.state.focused || t.root.role == RoleType.DESKTOP ||
|
| AutomationUtil.isDescendantOf(
|
| ChromeVoxState.instance.currentRange.start.node, t)) {
|
| if (new Date() - this.lastValueChanged_ <=
|
| @@ -517,7 +502,7 @@ DesktopAutomationHandler.prototype = {
|
| // that focus is an ancestor of a selection target.
|
| var override = evt.target.role == RoleType.MENU_ITEM ||
|
| (evt.target.root == focus.root &&
|
| - focus.root.role == RoleType.DESKTOP);
|
| + focus.root.role == RoleType.DESKTOP);
|
| Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
|
| if (override || AutomationUtil.isDescendantOf(evt.target, focus))
|
| this.onEventDefault(evt);
|
| @@ -555,8 +540,7 @@ DesktopAutomationHandler.prototype = {
|
| * @param {!AutomationNode} node
|
| */
|
| createTextEditHandlerIfNeeded_: function(node) {
|
| - if (!this.textEditHandler_ ||
|
| - this.textEditHandler_.node !== node) {
|
| + if (!this.textEditHandler_ || this.textEditHandler_.node !== node) {
|
| this.textEditHandler_ = editing.TextEditHandler.createForNode(node);
|
| }
|
| },
|
| @@ -570,8 +554,7 @@ DesktopAutomationHandler.prototype = {
|
| var mode = ChromeVoxState.instance.mode;
|
| // Only output desktop rooted nodes or web nodes for next engine modes.
|
| return evt.target.root.role == RoleType.DESKTOP ||
|
| - (mode == ChromeVoxMode.NEXT ||
|
| - mode == ChromeVoxMode.FORCE_NEXT ||
|
| + (mode == ChromeVoxMode.NEXT || mode == ChromeVoxMode.FORCE_NEXT ||
|
| mode == ChromeVoxMode.CLASSIC_COMPAT);
|
| }
|
| };
|
|
|