OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink_ax_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 if (!anchor_object.isNull() && !focus_object.isNull() && | 155 if (!anchor_object.isNull() && !focus_object.isNull() && |
156 anchor_offset >= 0 && focus_offset >= 0) { | 156 anchor_offset >= 0 && focus_offset >= 0) { |
157 int32_t anchor_id = anchor_object.axID(); | 157 int32_t anchor_id = anchor_object.axID(); |
158 int32_t focus_id = focus_object.axID(); | 158 int32_t focus_id = focus_object.axID(); |
159 tree_data.sel_anchor_object_id = anchor_id; | 159 tree_data.sel_anchor_object_id = anchor_id; |
160 tree_data.sel_anchor_offset = anchor_offset; | 160 tree_data.sel_anchor_offset = anchor_offset; |
161 tree_data.sel_focus_object_id = focus_id; | 161 tree_data.sel_focus_object_id = focus_id; |
162 tree_data.sel_focus_offset = focus_offset; | 162 tree_data.sel_focus_offset = focus_offset; |
163 } | 163 } |
164 | 164 |
165 // Get the tree ID for this frame and possibly the parent frame. | 165 // Get the tree ID for this frame the parent frame. |
David Tseng
2016/03/04 16:50:21
nit remove: the parent frame
dmazzoni
2016/03/07 21:35:32
Changed to "and the parent frame", which is what I
| |
166 WebLocalFrame* web_frame = document.frame(); | 166 WebLocalFrame* web_frame = document.frame(); |
167 if (web_frame) { | 167 if (web_frame) { |
168 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); | 168 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); |
169 tree_data.routing_id = render_frame->GetRoutingID(); | 169 tree_data.routing_id = render_frame->GetRoutingID(); |
170 | 170 |
171 // Get the tree ID for the parent frame, if it's remote. | 171 // Get the tree ID for the parent frame. |
172 // (If it's local, it's already part of this same tree.) | |
173 blink::WebFrame* parent_web_frame = web_frame->parent(); | 172 blink::WebFrame* parent_web_frame = web_frame->parent(); |
174 if (parent_web_frame && parent_web_frame->isWebRemoteFrame()) { | 173 if (parent_web_frame && parent_web_frame->isWebRemoteFrame()) { |
175 RenderFrameProxy* parent_render_frame_proxy = | 174 RenderFrameProxy* parent_render_frame_proxy = |
176 RenderFrameProxy::FromWebFrame(parent_web_frame); | 175 RenderFrameProxy::FromWebFrame(parent_web_frame); |
177 tree_data.parent_routing_id = parent_render_frame_proxy->routing_id(); | 176 tree_data.parent_routing_id = parent_render_frame_proxy->routing_id(); |
177 } else if (parent_web_frame && parent_web_frame->isWebLocalFrame()) { | |
178 RenderFrame* parent_render_frame = RenderFrame::FromWebFrame( | |
179 parent_web_frame); | |
180 tree_data.parent_routing_id = parent_render_frame->GetRoutingID(); | |
178 } | 181 } |
179 } | 182 } |
180 | 183 |
181 return tree_data; | 184 return tree_data; |
182 } | 185 } |
183 | 186 |
184 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { | 187 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { |
185 if (!root_.isNull()) | 188 if (!root_.isNull()) |
186 return root_; | 189 return root_; |
187 return GetMainDocument().accessibilityObject(); | 190 return GetMainDocument().accessibilityObject(); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 } | 461 } |
459 | 462 |
460 // Browser plugin (used in a <webview>). | 463 // Browser plugin (used in a <webview>). |
461 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element); | 464 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element); |
462 if (browser_plugin) { | 465 if (browser_plugin) { |
463 dst->AddContentIntAttribute( | 466 dst->AddContentIntAttribute( |
464 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID, | 467 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID, |
465 browser_plugin->browser_plugin_instance_id()); | 468 browser_plugin->browser_plugin_instance_id()); |
466 } | 469 } |
467 | 470 |
468 // Out-of-process iframe. | 471 // Iframe. |
469 if (is_iframe) { | 472 if (is_iframe) { |
470 WebFrame* frame = WebFrame::fromFrameOwnerElement(element); | 473 WebFrame* frame = WebFrame::fromFrameOwnerElement(element); |
471 | |
472 if (frame && frame->isWebRemoteFrame()) { | 474 if (frame && frame->isWebRemoteFrame()) { |
473 RenderFrameProxy* render_frame_proxy = | 475 RenderFrameProxy* render_frame_proxy = |
474 RenderFrameProxy::FromWebFrame(frame); | 476 RenderFrameProxy::FromWebFrame(frame); |
475 DCHECK(render_frame_proxy); | 477 DCHECK(render_frame_proxy); |
476 dst->AddContentIntAttribute( | 478 dst->AddContentIntAttribute( |
477 AX_CONTENT_ATTR_CHILD_ROUTING_ID, | 479 AX_CONTENT_ATTR_CHILD_ROUTING_ID, |
478 render_frame_proxy->routing_id()); | 480 render_frame_proxy->routing_id()); |
481 } else if (frame && frame->isWebLocalFrame()) { | |
482 RenderFrame* render_frame = RenderFrame::FromWebFrame(frame); | |
483 DCHECK(render_frame); | |
484 dst->AddContentIntAttribute( | |
485 AX_CONTENT_ATTR_CHILD_ROUTING_ID, | |
486 render_frame->GetRoutingID()); | |
479 } | 487 } |
480 } | 488 } |
481 } | 489 } |
482 | 490 |
483 if (src.isInLiveRegion()) { | 491 if (src.isInLiveRegion()) { |
484 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); | 492 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); |
485 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); | 493 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); |
486 if (src.liveRegionBusy()) | 494 if (src.liveRegionBusy()) |
487 dst->state |= (1 << ui::AX_STATE_BUSY); | 495 dst->state |= (1 << ui::AX_STATE_BUSY); |
488 if (!src.liveRegionStatus().isEmpty()) { | 496 if (!src.liveRegionStatus().isEmpty()) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 } | 629 } |
622 } | 630 } |
623 | 631 |
624 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 632 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
625 if (render_frame_ && render_frame_->GetWebFrame()) | 633 if (render_frame_ && render_frame_->GetWebFrame()) |
626 return render_frame_->GetWebFrame()->document(); | 634 return render_frame_->GetWebFrame()->document(); |
627 return WebDocument(); | 635 return WebDocument(); |
628 } | 636 } |
629 | 637 |
630 } // namespace content | 638 } // namespace content |
OLD | NEW |