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

Side by Side Diff: content/renderer/accessibility/renderer_accessibility_focus_only.cc

Issue 125763003: Refactor content/renderer/accessibility to use AXTreeSerializer (re-land). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Little fixes Created 6 years, 10 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 | Annotate | Revision Log
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/renderer/accessibility/renderer_accessibility_focus_only.h" 5 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h"
6 6
7 #include "content/renderer/render_view_impl.h" 7 #include "content/renderer/render_view_impl.h"
8 #include "third_party/WebKit/public/web/WebDocument.h" 8 #include "third_party/WebKit/public/web/WebDocument.h"
9 #include "third_party/WebKit/public/web/WebElement.h" 9 #include "third_party/WebKit/public/web/WebElement.h"
10 #include "third_party/WebKit/public/web/WebFrame.h" 10 #include "third_party/WebKit/public/web/WebFrame.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // If we want to update the browser's accessibility tree but not send a 86 // If we want to update the browser's accessibility tree but not send a
87 // native focus changed event, we can send a LayoutComplete 87 // native focus changed event, we can send a LayoutComplete
88 // event, which doesn't post a native event on Windows. 88 // event, which doesn't post a native event on Windows.
89 event.event_type = 89 event.event_type =
90 send_focus_event ? ui::AX_EVENT_FOCUS : ui::AX_EVENT_LAYOUT_COMPLETE; 90 send_focus_event ? ui::AX_EVENT_FOCUS : ui::AX_EVENT_LAYOUT_COMPLETE;
91 91
92 // Set the id that the event applies to: the root node if nothing 92 // Set the id that the event applies to: the root node if nothing
93 // has focus, otherwise the focused node. 93 // has focus, otherwise the focused node.
94 event.id = node_has_focus ? next_id_ : 1; 94 event.id = node_has_focus ? next_id_ : 1;
95 95
96 event.nodes.resize(2); 96 event.update.nodes.resize(2);
97 ui::AXNodeData& root = event.nodes[0]; 97 ui::AXNodeData& root = event.update.nodes[0];
98 ui::AXNodeData& child = event.nodes[1]; 98 ui::AXNodeData& child = event.update.nodes[1];
99 99
100 // Always include the root of the tree, the document. It always has id 1. 100 // Always include the root of the tree, the document. It always has id 1.
101 root.id = 1; 101 root.id = 1;
102 root.role = ui::AX_ROLE_ROOT_WEB_AREA; 102 root.role = ui::AX_ROLE_ROOT_WEB_AREA;
103 root.state = 103 root.state =
104 (1 << ui::AX_STATE_READ_ONLY) | 104 (1 << ui::AX_STATE_READ_ONLY) |
105 (1 << ui::AX_STATE_FOCUSABLE); 105 (1 << ui::AX_STATE_FOCUSABLE);
106 if (!node_has_focus) 106 if (!node_has_focus)
107 root.state |= (1 << ui::AX_STATE_FOCUSED); 107 root.state |= (1 << ui::AX_STATE_FOCUSED);
108 root.location = gfx::Rect(render_view_->size()); 108 root.location = gfx::Rect(render_view_->size());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 Send(new AccessibilityHostMsg_Events(routing_id(), events)); 143 Send(new AccessibilityHostMsg_Events(routing_id(), events));
144 144
145 // Increment the id, wrap back when we get past a million. 145 // Increment the id, wrap back when we get past a million.
146 next_id_++; 146 next_id_++;
147 if (next_id_ > 1000000) 147 if (next_id_ > 1000000)
148 next_id_ = kInitialId; 148 next_id_ = kInitialId;
149 } 149 }
150 150
151 } // namespace content 151 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698