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

Unified Diff: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc

Issue 2929673002: Add null check when reporting changed nodes to an AX tree. (Closed)
Patch Set: Fix underlying issue too Created 3 years, 6 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 | ui/accessibility/ax_tree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
index 658012d2832988eae1ce7ea71a9ef32547901417..494127d75afca9552e01d11a57b33c1132f5c18a 100644
--- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
+++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
@@ -148,6 +148,33 @@ void AutomationManagerAura::SendEvent(BrowserContext* context,
pending_events_.push_back(std::make_pair(aura_obj, event_type));
return;
}
+
+ // Avoid sending events on objects that aren't connected via a chain
+ // of ancestors all the way the root desktop node. The most common
David Tseng 2017/06/21 15:44:46 nit: to the
dmazzoni 2017/06/23 19:48:51 Done.
+ // case we're trying to avoid is where an object is part of an
+ // invisible subtree; the object itself thinks it's visible, but one
David Tseng 2017/06/21 16:09:50 One more note: if this is true, then I think View:
dmazzoni 2017/06/23 19:48:51 I don't think that's robust. The problem is that
+ // of its ancestors is invisible so not part of the automation
+ // tree. If we don't do this check, we can end up serializing an
+ // update that can't be unserialized.
+ views::AXAuraObjWrapper* root = current_tree_->GetRoot();
+ views::AXAuraObjWrapper* walker = aura_obj;
+ while (walker != root) {
+ views::AXAuraObjWrapper* parent = walker->GetParent();
+ if (!parent)
David Tseng 2017/06/21 15:44:46 I can see why this happens, but I think the detach
dmazzoni 2017/06/23 19:48:51 Yes, this was the location change, but I think it
+ return;
+ std::vector<views::AXAuraObjWrapper*> children;
+ walker->GetChildren(&children);
+ bool found = false;
+ for (size_t i = 0; i < children.size(); ++i) {
+ if (children[i] == walker) {
David Tseng 2017/06/21 16:09:50 Also, this doesn't make sense to me. Did you mean
dmazzoni 2017/06/23 19:48:51 You're right. The code above should have called pa
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ return;
+ }
+
processing_events_ = true;
ExtensionMsg_AccessibilityEventParams params;
« no previous file with comments | « no previous file | ui/accessibility/ax_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698