Chromium Code Reviews| 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 The entry point for all ChromeVox2 related code for the | 6 * @fileoverview The entry point for all ChromeVox2 related code for the |
| 7 * background page. | 7 * background page. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 goog.provide('Background'); | 10 goog.provide('Background'); |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 763 // event. This can result in getting stuck when navigating | 763 // event. This can result in getting stuck when navigating |
| 764 // backward. | 764 // backward. |
| 765 var isFocusable = function(node) { | 765 var isFocusable = function(node) { |
| 766 return node.role != RoleType.iframe && | 766 return node.role != RoleType.iframe && |
| 767 node.state.focusable && | 767 node.state.focusable && |
| 768 !node.state.focused && | 768 !node.state.focused && |
| 769 !AutomationPredicate.structuralContainer(node); | 769 !AutomationPredicate.structuralContainer(node); |
| 770 }; | 770 }; |
| 771 if (isFocusable(start)) { | 771 if (isFocusable(start)) { |
| 772 start.focus(); | 772 start.focus(); |
| 773 return; | 773 } else if (isFocusable(end)) { |
| 774 end.focus(); | |
| 775 } else { | |
| 776 start.setSequentialFocusNavigationStartingPoint(); | |
|
David Tseng
2016/10/26 17:03:26
Does this work on in line text boxes?
| |
| 774 } | 777 } |
| 775 if (isFocusable(end)) { | |
| 776 end.focus(); | |
| 777 return; | |
| 778 } | |
| 779 | |
| 780 // TODO(dmazzoni): Set sequential focus. | |
| 781 } | 778 } |
| 782 }; | 779 }; |
| 783 | 780 |
| 784 /** | 781 /** |
| 785 * Converts a list of globs, as used in the extension manifest, to a regular | 782 * Converts a list of globs, as used in the extension manifest, to a regular |
| 786 * expression that matches if and only if any of the globs in the list matches. | 783 * expression that matches if and only if any of the globs in the list matches. |
| 787 * @param {!Array<string>} globs | 784 * @param {!Array<string>} globs |
| 788 * @return {!RegExp} | 785 * @return {!RegExp} |
| 789 * @private | 786 * @private |
| 790 */ | 787 */ |
| 791 Background.globsToRegExp_ = function(globs) { | 788 Background.globsToRegExp_ = function(globs) { |
| 792 return new RegExp('^(' + globs.map(function(glob) { | 789 return new RegExp('^(' + globs.map(function(glob) { |
| 793 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 790 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
| 794 .replace(/\*/g, '.*') | 791 .replace(/\*/g, '.*') |
| 795 .replace(/\?/g, '.'); | 792 .replace(/\?/g, '.'); |
| 796 }).join('|') + ')$'); | 793 }).join('|') + ')$'); |
| 797 }; | 794 }; |
| 798 | 795 |
| 799 new Background(); | 796 new Background(); |
| 800 | 797 |
| 801 }); // goog.scope | 798 }); // goog.scope |
| OLD | NEW |