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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.cc

Issue 2857743006: Re-enable 3 DumpAccessibilityEvents tests that were disabled on windows. (Closed)
Patch Set: Rebase Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_manager.h" 5 #include "content/browser/accessibility/browser_accessibility_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 NotifyAccessibilityEvent( 380 NotifyAccessibilityEvent(
381 BrowserAccessibilityEvent::FromChildFrameLoading, 381 BrowserAccessibilityEvent::FromChildFrameLoading,
382 ui::AX_EVENT_CHILDREN_CHANGED, 382 ui::AX_EVENT_CHILDREN_CHANGED,
383 parent); 383 parent);
384 connected_to_parent_tree_node_ = true; 384 connected_to_parent_tree_node_ = true;
385 } 385 }
386 } else { 386 } else {
387 connected_to_parent_tree_node_ = false; 387 connected_to_parent_tree_node_ = false;
388 } 388 }
389 389
390 // Fire any events related to changes to the tree.
391 for (auto& event : tree_events_) {
392 NotifyAccessibilityEvent(BrowserAccessibilityEvent::FromTreeChange,
393 event.first, event.second);
394 }
395 tree_events_.clear();
396
390 // Based on the changes to the tree, first fire focus events if needed. 397 // Based on the changes to the tree, first fire focus events if needed.
391 // Screen readers might not do the right thing if they're not aware of what 398 // Screen readers might not do the right thing if they're not aware of what
392 // has focus, so always try that first. Nothing will be fired if the window 399 // has focus, so always try that first. Nothing will be fired if the window
393 // itself isn't focused or if focus hasn't changed. 400 // itself isn't focused or if focus hasn't changed.
394 GetRootManager()->FireFocusEventsIfNeeded( 401 GetRootManager()->FireFocusEventsIfNeeded(
395 BrowserAccessibilityEvent::FromBlink); 402 BrowserAccessibilityEvent::FromBlink);
396 403
397 // Now iterate over the events again and fire the events other than focus 404 // Now iterate over the events from the renderer and fire the events
398 // events. 405 // other than focus events.
399 for (uint32_t index = 0; index < details.size(); index++) { 406 for (uint32_t index = 0; index < details.size(); index++) {
400 const AXEventNotificationDetails& detail = details[index]; 407 const AXEventNotificationDetails& detail = details[index];
401 408
402 // Find the node corresponding to the id that's the target of the 409 // Find the node corresponding to the id that's the target of the
403 // event (which may not be the root of the update tree). 410 // event (which may not be the root of the update tree).
404 ui::AXNode* node = tree_->GetFromId(detail.id); 411 ui::AXNode* node = tree_->GetFromId(detail.id);
405 if (!node) 412 if (!node)
406 continue; 413 continue;
407 414
408 ui::AXEvent event_type = detail.event_type; 415 ui::AXEvent event_type = detail.event_type;
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 // Notify ATs if any live regions have been created. 1184 // Notify ATs if any live regions have been created.
1178 for (auto& change : changes) { 1185 for (auto& change : changes) {
1179 if (change.type != NODE_CREATED && change.type != SUBTREE_CREATED) 1186 if (change.type != NODE_CREATED && change.type != SUBTREE_CREATED)
1180 continue; 1187 continue;
1181 1188
1182 const ui::AXNode* created_node = change.node; 1189 const ui::AXNode* created_node = change.node;
1183 DCHECK(created_node); 1190 DCHECK(created_node);
1184 BrowserAccessibility* object = GetFromAXNode(created_node); 1191 BrowserAccessibility* object = GetFromAXNode(created_node);
1185 if (object && object->HasStringAttribute(ui::AX_ATTR_LIVE_STATUS)) { 1192 if (object && object->HasStringAttribute(ui::AX_ATTR_LIVE_STATUS)) {
1186 if (object->GetRole() == ui::AX_ROLE_ALERT) { 1193 if (object->GetRole() == ui::AX_ROLE_ALERT) {
1187 NotifyAccessibilityEvent(BrowserAccessibilityEvent::FromTreeChange, 1194 tree_events_.push_back(std::make_pair(ui::AX_EVENT_ALERT, object));
1188 ui::AX_EVENT_ALERT, object);
1189 } else { 1195 } else {
1190 NotifyAccessibilityEvent(BrowserAccessibilityEvent::FromTreeChange, 1196 tree_events_.push_back(
1191 ui::AX_EVENT_LIVE_REGION_CREATED, object); 1197 std::make_pair(ui::AX_EVENT_LIVE_REGION_CREATED, object));
1192 } 1198 }
1193 } 1199 }
1194 } 1200 }
1195 } 1201 }
1196 1202
1197 BrowserAccessibilityManager* BrowserAccessibilityManager::GetRootManager() { 1203 BrowserAccessibilityManager* BrowserAccessibilityManager::GetRootManager() {
1198 BrowserAccessibility* parent = GetParentNodeFromParentTree(); 1204 BrowserAccessibility* parent = GetParentNodeFromParentTree();
1199 if (!parent) 1205 if (!parent)
1200 return this; 1206 return this;
1201 1207
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 hit_test_result = parent; 1284 hit_test_result = parent;
1279 parent = parent->PlatformGetParent(); 1285 parent = parent->PlatformGetParent();
1280 } 1286 }
1281 1287
1282 last_hover_ax_tree_id_ = hit_test_result->manager()->ax_tree_id(); 1288 last_hover_ax_tree_id_ = hit_test_result->manager()->ax_tree_id();
1283 last_hover_node_id_ = hit_test_result->GetId(); 1289 last_hover_node_id_ = hit_test_result->GetId();
1284 last_hover_bounds_ = hit_test_result->GetScreenBoundsRect(); 1290 last_hover_bounds_ = hit_test_result->GetScreenBoundsRect();
1285 } 1291 }
1286 1292
1287 } // namespace content 1293 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698