Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1350)

Unified Diff: chrome/browser/resources/chromeos/chromevox/common/dom_util.js

Issue 517853002: ChromeVox should not speak live regions that aren't in the document. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/common/dom_util_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/common/dom_util.js
diff --git a/chrome/browser/resources/chromeos/chromevox/common/dom_util.js b/chrome/browser/resources/chromeos/chromevox/common/dom_util.js
index 14df858e64f89dc9d52a08215ef797b8b113205f..6f9ba4add259e7f2fbef60755eec61d5deca8143 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/dom_util.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/dom_util.js
@@ -193,7 +193,8 @@ cvox.DomUtil.computeIsVisible_ = function(
/**
* Checks the ancestor chain for the given node for invisibility. If an
* ancestor is invisible and this cannot be overriden by a descendant,
- * we return true.
+ * we return true. If the element is not a descendant of the document
+ * element it will return true (invisible).
* @param {Node} node The node to check the ancestor chain for.
* @return {boolean} True if a descendant is invisible.
* @private
@@ -205,8 +206,15 @@ cvox.DomUtil.hasInvisibleAncestor_ = function(node) {
if (cvox.DomUtil.isInvisibleStyle(style, true)) {
return true;
}
+ // Once we reach the document element and we haven't found anything
+ // invisible yet, we're done. If we exit the while loop and never found
+ // the document element, the element wasn't part of the DOM and thus it's
+ // invisible.
+ if (ancestor == document.documentElement) {
+ return false;
+ }
}
- return false;
+ return true;
};
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/common/dom_util_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698