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

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: Fix memory leaks Created 6 years, 8 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // If we want to update the browser's accessibility tree but not send a 90 // If we want to update the browser's accessibility tree but not send a
91 // native focus changed event, we can send a LayoutComplete 91 // native focus changed event, we can send a LayoutComplete
92 // event, which doesn't post a native event on Windows. 92 // event, which doesn't post a native event on Windows.
93 event.event_type = 93 event.event_type =
94 send_focus_event ? ui::AX_EVENT_FOCUS : ui::AX_EVENT_LAYOUT_COMPLETE; 94 send_focus_event ? ui::AX_EVENT_FOCUS : ui::AX_EVENT_LAYOUT_COMPLETE;
95 95
96 // Set the id that the event applies to: the root node if nothing 96 // Set the id that the event applies to: the root node if nothing
97 // has focus, otherwise the focused node. 97 // has focus, otherwise the focused node.
98 event.id = node_has_focus ? next_id_ : 1; 98 event.id = node_has_focus ? next_id_ : 1;
99 99
100 event.nodes.resize(2); 100 event.update.nodes.resize(2);
101 ui::AXNodeData& root = event.nodes[0]; 101 ui::AXNodeData& root = event.update.nodes[0];
102 ui::AXNodeData& child = event.nodes[1]; 102 ui::AXNodeData& child = event.update.nodes[1];
103 103
104 // Always include the root of the tree, the document. It always has id 1. 104 // Always include the root of the tree, the document. It always has id 1.
105 root.id = 1; 105 root.id = 1;
106 root.role = ui::AX_ROLE_ROOT_WEB_AREA; 106 root.role = ui::AX_ROLE_ROOT_WEB_AREA;
107 root.state = 107 root.state =
108 (1 << ui::AX_STATE_READ_ONLY) | 108 (1 << ui::AX_STATE_READ_ONLY) |
109 (1 << ui::AX_STATE_FOCUSABLE); 109 (1 << ui::AX_STATE_FOCUSABLE);
110 if (!node_has_focus) 110 if (!node_has_focus)
111 root.state |= (1 << ui::AX_STATE_FOCUSED); 111 root.state |= (1 << ui::AX_STATE_FOCUSED);
112 root.location = gfx::Rect(render_view_->size()); 112 root.location = gfx::Rect(render_view_->size());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 Send(new AccessibilityHostMsg_Events(routing_id(), events)); 147 Send(new AccessibilityHostMsg_Events(routing_id(), events));
148 148
149 // Increment the id, wrap back when we get past a million. 149 // Increment the id, wrap back when we get past a million.
150 next_id_++; 150 next_id_++;
151 if (next_id_ > 1000000) 151 if (next_id_ > 1000000)
152 next_id_ = kInitialId; 152 next_id_ = kInitialId;
153 } 153 }
154 154
155 } // namespace content 155 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/accessibility/renderer_accessibility_complete.cc ('k') | ui/accessibility/ax_tree_serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698