| OLD | NEW |
| 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_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 // Do a sequence of Windows-specific updates on each node. Each one is | 266 // Do a sequence of Windows-specific updates on each node. Each one is |
| 267 // done in a single pass that must complete before the next step starts. | 267 // done in a single pass that must complete before the next step starts. |
| 268 // The first step moves win_attributes_ to old_win_attributes_ and then | 268 // The first step moves win_attributes_ to old_win_attributes_ and then |
| 269 // recomputes all of win_attributes_ other than IAccessibleText. | 269 // recomputes all of win_attributes_ other than IAccessibleText. |
| 270 for (size_t i = 0; i < changes.size(); ++i) { | 270 for (size_t i = 0; i < changes.size(); ++i) { |
| 271 const ui::AXNode* changed_node = changes[i].node; | 271 const ui::AXNode* changed_node = changes[i].node; |
| 272 DCHECK(changed_node); | 272 DCHECK(changed_node); |
| 273 BrowserAccessibility* obj = GetFromAXNode(changed_node); | 273 BrowserAccessibility* obj = GetFromAXNode(changed_node); |
| 274 if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) | 274 if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) |
| 275 ToBrowserAccessibilityWin(obj)->UpdateStep1ComputeWinAttributes(); | 275 ToBrowserAccessibilityWin(obj) |
| 276 ->GetCOM() |
| 277 ->UpdateStep1ComputeWinAttributes(); |
| 276 } | 278 } |
| 277 | 279 |
| 278 // The next step updates the hypertext of each node, which is a | 280 // The next step updates the hypertext of each node, which is a |
| 279 // concatenation of all of its child text nodes, so it can't run until | 281 // concatenation of all of its child text nodes, so it can't run until |
| 280 // the text of all of the nodes was computed in the previous step. | 282 // the text of all of the nodes was computed in the previous step. |
| 281 for (size_t i = 0; i < changes.size(); ++i) { | 283 for (size_t i = 0; i < changes.size(); ++i) { |
| 282 const ui::AXNode* changed_node = changes[i].node; | 284 const ui::AXNode* changed_node = changes[i].node; |
| 283 DCHECK(changed_node); | 285 DCHECK(changed_node); |
| 284 BrowserAccessibility* obj = GetFromAXNode(changed_node); | 286 BrowserAccessibility* obj = GetFromAXNode(changed_node); |
| 285 if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) | 287 if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) |
| 286 ToBrowserAccessibilityWin(obj)->UpdateStep2ComputeHypertext(); | 288 ToBrowserAccessibilityWin(obj)->GetCOM()->UpdateStep2ComputeHypertext(); |
| 287 } | 289 } |
| 288 | 290 |
| 289 // The third step fires events on nodes based on what's changed - like | 291 // The third step fires events on nodes based on what's changed - like |
| 290 // if the name, value, or description changed, or if the hypertext had | 292 // if the name, value, or description changed, or if the hypertext had |
| 291 // text inserted or removed. It's able to figure out exactly what changed | 293 // text inserted or removed. It's able to figure out exactly what changed |
| 292 // because we still have old_win_attributes_ populated. | 294 // because we still have old_win_attributes_ populated. |
| 293 // This step has to run after the previous two steps complete because the | 295 // This step has to run after the previous two steps complete because the |
| 294 // client may walk the tree when it receives any of these events. | 296 // client may walk the tree when it receives any of these events. |
| 295 // At the end, it deletes old_win_attributes_ since they're not needed | 297 // At the end, it deletes old_win_attributes_ since they're not needed |
| 296 // anymore. | 298 // anymore. |
| 297 for (size_t i = 0; i < changes.size(); ++i) { | 299 for (size_t i = 0; i < changes.size(); ++i) { |
| 298 const ui::AXNode* changed_node = changes[i].node; | 300 const ui::AXNode* changed_node = changes[i].node; |
| 299 DCHECK(changed_node); | 301 DCHECK(changed_node); |
| 300 BrowserAccessibility* obj = GetFromAXNode(changed_node); | 302 BrowserAccessibility* obj = GetFromAXNode(changed_node); |
| 301 if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) { | 303 if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) { |
| 302 ToBrowserAccessibilityWin(obj)->UpdateStep3FireEvents( | 304 ToBrowserAccessibilityWin(obj)->GetCOM()->UpdateStep3FireEvents( |
| 303 changes[i].type == AXTreeDelegate::SUBTREE_CREATED); | 305 changes[i].type == AXTreeDelegate::SUBTREE_CREATED); |
| 304 } | 306 } |
| 305 } | 307 } |
| 306 } | 308 } |
| 307 | 309 |
| 308 } // namespace content | 310 } // namespace content |
| OLD | NEW |