Index: chrome/browser/resources/chromeos/chromevox/common/chromevox.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/common/chromevox.js b/chrome/browser/resources/chromeos/chromevox/common/chromevox.js |
index 04c0bd36673cc89711223f085dbb9f4a50e18593..db20382a06ab570fa42197ec1f4209f701e5b685 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/common/chromevox.js |
+++ b/chrome/browser/resources/chromeos/chromevox/common/chromevox.js |
@@ -275,3 +275,20 @@ function $(id) { |
* @param {Array} tabs |
*/ |
cvox.ChromeVox.injectChromeVoxIntoTabs = function(tabs) {}; |
+ |
+/** |
+ * Returns whether the document has focus, taking into account whether |
+ * it's hidden and also that if an iframe or webview element has focus, |
+ * the focus is really inside that frame and not in this document. |
+ * @return {boolean} True if the document has focus. |
+ */ |
+cvox.ChromeVox.documentHasFocus = function() { |
+ if (!document.hasFocus() || document.hidden) { |
+ return false; |
+ } |
+ if (document.activeElement.tagName == 'IFRAME' || |
+ document.activeElement.tagName == 'WEBVIEW') { |
+ return false; |
+ } |
+ return true; |
+}; |