| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| index da64659431a329a71c387d760519abdc9b841ff6..9003210b1e7b9b58a188961e7f90369f529359ff 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| @@ -38,6 +38,7 @@ var AutomationNode = chrome.automation.AutomationNode;
|
| var Dir = constants.Dir;
|
| var EventType = chrome.automation.EventType;
|
| var RoleType = chrome.automation.RoleType;
|
| +var StateType = chrome.automation.StateType;
|
|
|
| /**
|
| * ChromeVox2 background page.
|
| @@ -252,11 +253,12 @@ Background.prototype = {
|
| return useNext ? ChromeVoxMode.FORCE_NEXT :
|
| ChromeVoxMode.CLASSIC_COMPAT;
|
|
|
| - var nextSite = this.isWhitelistedForNext_(topLevelRoot.docUrl);
|
| - var nextCompat = this.nextCompatRegExp_.test(topLevelRoot.docUrl) &&
|
| + var docUrl = topLevelRoot.docUrl || '';
|
| + var nextSite = this.isWhitelistedForNext_(docUrl);
|
| + var nextCompat = this.nextCompatRegExp_.test(docUrl) &&
|
| this.chromeChannel_ != 'dev';
|
| var classicCompat =
|
| - this.isWhitelistedForClassicCompat_(topLevelRoot.docUrl);
|
| + this.isWhitelistedForClassicCompat_(docUrl);
|
| if (nextCompat && useNext)
|
| return ChromeVoxMode.NEXT_COMPAT;
|
| else if (classicCompat && !useNext)
|
| @@ -411,7 +413,7 @@ Background.prototype = {
|
| start.makeVisible();
|
|
|
| var root = start.root;
|
| - if (!root || root.role == RoleType.desktop)
|
| + if (!root || root.role == RoleType.DESKTOP)
|
| return;
|
|
|
| var position = {};
|
| @@ -494,7 +496,8 @@ Background.prototype = {
|
| lca = AutomationUtil.getLeastCommonAncestor(prevRange.start.node,
|
| range.start.node);
|
| }
|
| - if (!lca || lca.state.editable || !range.start.node.state.editable)
|
| + if (!lca || lca.state[StateType.EDITABLE] ||
|
| + !range.start.node.state[StateType.EDITABLE])
|
| range.select();
|
| }
|
|
|
| @@ -588,9 +591,9 @@ Background.prototype = {
|
| * @return {boolean}
|
| */
|
| isWhitelistedForClassicCompat_: function(url) {
|
| - return this.isBlacklistedForClassic_(url) || (this.getCurrentRange() &&
|
| + return (this.isBlacklistedForClassic_(url) || (this.getCurrentRange() &&
|
| !this.getCurrentRange().isWebRange() &&
|
| - this.getCurrentRange().start.node.state.focused);
|
| + this.getCurrentRange().start.node.state[StateType.FOCUSED])) || false;
|
| },
|
|
|
| /**
|
| @@ -667,7 +670,7 @@ Background.prototype = {
|
| if (!actionNodeSpan)
|
| return;
|
| var actionNode = actionNodeSpan.node;
|
| - if (actionNode.role === RoleType.inlineTextBox)
|
| + if (actionNode.role === RoleType.INLINE_TEXT_BOX)
|
| actionNode = actionNode.parent;
|
| actionNode.doDefault();
|
| if (selectionSpan) {
|
| @@ -787,28 +790,28 @@ Background.prototype = {
|
| var entered = AutomationUtil.getUniqueAncestors(
|
| prevRange.start.node, start);
|
| var embeddedObject = entered.find(function(f) {
|
| - return f.role == RoleType.embeddedObject; });
|
| - if (embeddedObject && !embeddedObject.state.focused)
|
| + return f.role == RoleType.EMBEDDED_OBJECT; });
|
| + if (embeddedObject && !embeddedObject.state[StateType.FOCUSED])
|
| embeddedObject.focus();
|
| }
|
|
|
| - if (start.state.focused || end.state.focused)
|
| + if (start.state[StateType.FOCUSED] || end.state[StateType.FOCUSED])
|
| return;
|
|
|
| var isFocusableLinkOrControl = function(node) {
|
| - return node.state.focusable &&
|
| + return node.state[StateType.FOCUSABLE] &&
|
| AutomationPredicate.linkOrControl(node);
|
| };
|
|
|
| // Next, try to focus the start or end node.
|
| if (!AutomationPredicate.structuralContainer(start) &&
|
| - start.state.focusable) {
|
| - if (!start.state.focused)
|
| + start.state[StateType.FOCUSABLE]) {
|
| + if (!start.state[StateType.FOCUSED])
|
| start.focus();
|
| return;
|
| } else if (!AutomationPredicate.structuralContainer(end) &&
|
| - end.state.focusable) {
|
| - if (!end.state.focused)
|
| + end.state[StateType.FOCUSABLE]) {
|
| + if (!end.state[StateType.FOCUSED])
|
| end.focus();
|
| return;
|
| }
|
| @@ -817,7 +820,7 @@ Background.prototype = {
|
| var ancestor = AutomationUtil.getLeastCommonAncestor(start, end);
|
| while (ancestor && ancestor.root == start.root) {
|
| if (isFocusableLinkOrControl(ancestor)) {
|
| - if (!ancestor.state.focused)
|
| + if (!ancestor.state[StateType.FOCUSED])
|
| ancestor.focus();
|
| return;
|
| }
|
| @@ -827,7 +830,7 @@ Background.prototype = {
|
| // If nothing is focusable, set the sequential focus navigation starting
|
| // point, which ensures that the next time you press Tab, you'll reach
|
| // the next or previous focusable node from |start|.
|
| - if (!start.state.offscreen)
|
| + if (!start.state[StateType.OFFSCREEN])
|
| start.setSequentialFocusNavigationStartingPoint();
|
| }
|
| };
|
|
|