OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" | 5 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 | 141 |
142 if (!context) { | 142 if (!context) { |
143 LOG(WARNING) << "Accessibility notification but no browser context"; | 143 LOG(WARNING) << "Accessibility notification but no browser context"; |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 if (processing_events_) { | 147 if (processing_events_) { |
148 pending_events_.push_back(std::make_pair(aura_obj, event_type)); | 148 pending_events_.push_back(std::make_pair(aura_obj, event_type)); |
149 return; | 149 return; |
150 } | 150 } |
151 | |
152 // Avoid sending events on objects that aren't connected via a chain | |
153 // 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.
| |
154 // case we're trying to avoid is where an object is part of an | |
155 // 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
| |
156 // of its ancestors is invisible so not part of the automation | |
157 // tree. If we don't do this check, we can end up serializing an | |
158 // update that can't be unserialized. | |
159 views::AXAuraObjWrapper* root = current_tree_->GetRoot(); | |
160 views::AXAuraObjWrapper* walker = aura_obj; | |
161 while (walker != root) { | |
162 views::AXAuraObjWrapper* parent = walker->GetParent(); | |
163 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
| |
164 return; | |
165 std::vector<views::AXAuraObjWrapper*> children; | |
166 walker->GetChildren(&children); | |
167 bool found = false; | |
168 for (size_t i = 0; i < children.size(); ++i) { | |
169 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
| |
170 found = true; | |
171 break; | |
172 } | |
173 } | |
174 if (!found) | |
175 return; | |
176 } | |
177 | |
151 processing_events_ = true; | 178 processing_events_ = true; |
152 | 179 |
153 ExtensionMsg_AccessibilityEventParams params; | 180 ExtensionMsg_AccessibilityEventParams params; |
154 if (!current_tree_serializer_->SerializeChanges(aura_obj, ¶ms.update)) { | 181 if (!current_tree_serializer_->SerializeChanges(aura_obj, ¶ms.update)) { |
155 LOG(ERROR) << "Unable to serialize one accessibility event."; | 182 LOG(ERROR) << "Unable to serialize one accessibility event."; |
156 return; | 183 return; |
157 } | 184 } |
158 | 185 |
159 // Make sure the focused node is serialized. | 186 // Make sure the focused node is serialized. |
160 views::AXAuraObjWrapper* focus = | 187 views::AXAuraObjWrapper* focus = |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 } | 255 } |
229 } | 256 } |
230 | 257 |
231 // Otherwise, fire the event directly on the Window. | 258 // Otherwise, fire the event directly on the Window. |
232 views::AXAuraObjWrapper* window_wrapper = | 259 views::AXAuraObjWrapper* window_wrapper = |
233 views::AXAuraObjCache::GetInstance()->GetOrCreate(window); | 260 views::AXAuraObjCache::GetInstance()->GetOrCreate(window); |
234 if (window_wrapper) | 261 if (window_wrapper) |
235 SendEvent(nullptr, window_wrapper, action.hit_test_event_to_fire); | 262 SendEvent(nullptr, window_wrapper, action.hit_test_event_to_fire); |
236 #endif | 263 #endif |
237 } | 264 } |
OLD | NEW |