Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility_manager_win.cc |
| diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc |
| index 05ef1b139e53969fc66416ae3ea249bb99cec2c7..8049f569070a6ade4ae32c464e99a20a9fea35a3 100644 |
| --- a/content/browser/accessibility/browser_accessibility_manager_win.cc |
| +++ b/content/browser/accessibility/browser_accessibility_manager_win.cc |
| @@ -297,17 +297,45 @@ void BrowserAccessibilityManagerWin::OnAtomicUpdateFinished( |
| OnWindowFocused(); |
| } |
| - // BrowserAccessibilityManager::OnAtomicUpdateFinished calls |
| - // OnUpdateFinished() on each node in |changes|. However, the |
| - // IAccessibleText text for a node is a concatenatenation of all of its child |
| - // text nodes, so we can't compute a node's IAccessibleText in |
| - // OnUpdateFinished because its children may not have been updated yet. |
| - // |
| - // So we make a second pass here to update IAccessibleText. |
| + // Do a sequence of Windows-specific updates on each node. Each one is |
| + // done in a single pass that must complete before the next step starts. |
| + // The first step moves win_attributes_ to old_win_attributes_ and then |
| + // recomputes all of win_attributes_ other than IAccessibleText. |
| for (size_t i = 0; i < changes.size(); ++i) { |
| BrowserAccessibility* obj = GetFromAXNode(changes[i].node); |
| - if (obj && obj->IsNative()) |
| - obj->ToBrowserAccessibilityWin()->UpdateIAccessibleText(); |
| + if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) |
| + obj->ToBrowserAccessibilityWin()->UpdateStep1ComputeWinAttributes(); |
| + } |
| + |
| + // The next step updates the hypertext of each node, which is a |
| + // concatenatenation of all of its child text nodes, so it can't run until |
|
David Tseng
2015/01/30 23:57:25
nit: contatenation
dmazzoni
2015/01/31 07:45:21
Done.
|
| + // the text of all of the nodes was computed in the previous step. |
| + for (size_t i = 0; i < changes.size(); ++i) { |
| + BrowserAccessibility* obj = GetFromAXNode(changes[i].node); |
| + if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) |
| + obj->ToBrowserAccessibilityWin()->UpdateStep2ComputeHypertext(); |
| + } |
| + |
| + // The third step fires events on nodes based on what's changed - like |
| + // if the name, value, or description changed, or if the hypertext had |
| + // text inserted or removed. It's able to figure out exactly what changed |
| + // because we still have old_win_attributes_ populated. |
| + // This step has to run after the previous two steps complete because the |
| + // client may walk the tree when it receives any of these events. |
| + for (size_t i = 0; i < changes.size(); ++i) { |
| + BrowserAccessibility* obj = GetFromAXNode(changes[i].node); |
| + if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) { |
| + obj->ToBrowserAccessibilityWin()->UpdateStep3FireEvents( |
| + changes[i].type == AXTreeDelegate::SUBTREE_CREATED); |
| + } |
| + } |
| + |
| + // The final step is to delete old_win_attributes_ since they're not |
| + // needed anymore. |
| + for (size_t i = 0; i < changes.size(); ++i) { |
| + BrowserAccessibility* obj = GetFromAXNode(changes[i].node); |
| + if (obj && obj->IsNative() && !obj->PlatformIsChildOfLeaf()) |
| + obj->ToBrowserAccessibilityWin()->UpdateStep4DeleteOldWinAttributes(); |
|
David Tseng
2015/01/30 23:57:25
Could you combine this last step with the above on
dmazzoni
2015/01/31 07:45:21
Sure. It doesn't really need its own step.
|
| } |
| } |