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

Unified Diff: content/browser/accessibility/browser_accessibility_manager_win.cc

Issue 859133003: Fire AX text inserted event when embedded obj char changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor cleanup Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
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.
}
}

Powered by Google App Engine
This is Rietveld 408576698