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; |