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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1761633002: One accessibility tree per frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix is-richly-editable test Created 4 years, 9 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/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 3b619f154c6fca9d60b09d3a99f30145ba36c663..705ab3aaaaab637a91fe8a2a1efacb145135fcd6 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1630,8 +1630,8 @@ void RenderFrameHostImpl::OnAccessibilityEvents(
detail.ax_tree_id = GetAXTreeID();
if (param.update.has_tree_data) {
detail.update.has_tree_data = true;
- AXContentTreeDataToAXTreeData(param.update.tree_data,
- &detail.update.tree_data);
+ ax_content_tree_data_ = param.update.tree_data;
+ AXContentTreeDataToAXTreeData(&detail.update.tree_data);
}
detail.update.node_id_to_clear = param.update.node_id_to_clear;
detail.update.nodes.resize(param.update.nodes.size());
@@ -1724,8 +1724,8 @@ void RenderFrameHostImpl::OnAccessibilitySnapshotResponse(
&dst_snapshot.nodes[i]);
}
if (snapshot.has_tree_data) {
- AXContentTreeDataToAXTreeData(snapshot.tree_data,
- &dst_snapshot.tree_data);
+ ax_content_tree_data_ = snapshot.tree_data;
+ AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data);
dst_snapshot.has_tree_data = true;
}
it->second.Run(dst_snapshot);
@@ -2343,6 +2343,27 @@ void RenderFrameHostImpl::SetAccessibilityCallbackForTesting(
accessibility_testing_callback_ = callback;
}
+void RenderFrameHostImpl::UpdateAXTreeData() {
+ AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode();
+ if (accessibility_mode == AccessibilityModeOff ||
+ !RenderFrameHostImpl::IsRFHStateActive(rfh_state())) {
+ return;
+ }
+
+ std::vector<AXEventNotificationDetails> details;
+ details.reserve(1U);
+ AXEventNotificationDetails detail;
+ detail.ax_tree_id = GetAXTreeID();
+ detail.update.has_tree_data = true;
+ AXContentTreeDataToAXTreeData(&detail.update.tree_data);
+ details.push_back(detail);
+
+ if (browser_accessibility_manager_)
+ browser_accessibility_manager_->OnAccessibilityEvents(details);
+
+ delegate_->AccessibilityEventReceived(details);
+}
+
void RenderFrameHostImpl::SetTextTrackSettings(
const FrameMsg_TextTrackSettings_Params& params) {
DCHECK(!GetParent());
@@ -2625,8 +2646,9 @@ void RenderFrameHostImpl::AXContentNodeDataToAXNodeData(
}
void RenderFrameHostImpl::AXContentTreeDataToAXTreeData(
- const AXContentTreeData& src,
ui::AXTreeData* dst) {
+ const AXContentTreeData& src = ax_content_tree_data_;
+
// Copy the common fields.
*dst = src;
@@ -2635,6 +2657,19 @@ void RenderFrameHostImpl::AXContentTreeDataToAXTreeData(
if (src.parent_routing_id != -1)
dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
+
+ // If this is not the root frame tree node, we're done.
+ if (frame_tree_node()->parent())
+ return;
+
+ // For the root frame tree node, also store the AXTreeID of the focused frame.
+ FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
+ if (!focused_frame_tree_node)
+ return;
+ RenderFrameHostImpl* focused_frame =
+ focused_frame_tree_node->current_frame_host();
+ DCHECK(focused_frame);
+ dst->focused_tree_id = focused_frame->GetAXTreeID();
}
} // namespace content
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698