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

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 1361633003: Work around <webview> focus bugs by enforcing focus event invariants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | content/renderer/accessibility/blink_ax_enum_conversion.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 70d4c926b718e8164eef0ff5a4741d555616e643..c9e84ed3cdcb7b61527fd6c7ddea5cea161a4837 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -483,19 +483,24 @@ Background.prototype = {
var node = evt.target;
+
+ // Discard focus events on embeddedObject nodes.
+ if (node.role == RoleType.embeddedObject)
+ return;
+
// It almost never makes sense to place focus directly on a rootWebArea.
if (node.role == RoleType.rootWebArea) {
+ // Discard focus events for root web areas when focus was previously
+ // placed on a descendant.
+ if (this.currentRange_.start.node.root == node)
+ return;
+
+ // Discard focused root nodes without focused state set.
+ if (!node.state.focused)
+ return;
+
// Try to find a focusable descendant.
- node = AutomationUtil.findNodePost(node,
- Dir.FORWARD,
- AutomationPredicate.focused) || node;
-
- // Fall back to the first leaf node in the document.
- if (node.role == RoleType.rootWebArea) {
- node = AutomationUtil.findNodePost(node,
- Dir.FORWARD,
- AutomationPredicate.leaf);
- }
+ node = node.find({state: {focused: true}}) || node;
}
if (evt.target.role == RoleType.textField)
@@ -558,6 +563,9 @@ Background.prototype = {
if (!evt.target.state.focused)
return;
+ if (evt.target.role != RoleType.textField)
+ return;
+
if (!this.currentRange_) {
this.onEventDefault(evt);
this.currentRange_ = cursors.Range.fromNode(evt.target);
« no previous file with comments | « no previous file | content/renderer/accessibility/blink_ax_enum_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698