| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 tree_data->mimetype = document.isXHTMLDocument() ? "text/xhtml" : "text/html"; | 143 tree_data->mimetype = document.isXHTMLDocument() ? "text/xhtml" : "text/html"; |
| 144 tree_data->title = document.title().utf8(); | 144 tree_data->title = document.title().utf8(); |
| 145 tree_data->url = document.url().string().utf8(); | 145 tree_data->url = document.url().string().utf8(); |
| 146 | 146 |
| 147 WebAXObject focus = document.focusedAccessibilityObject(); | 147 WebAXObject focus = document.focusedAccessibilityObject(); |
| 148 if (!focus.isNull()) | 148 if (!focus.isNull()) |
| 149 tree_data->focus_id = focus.axID(); | 149 tree_data->focus_id = focus.axID(); |
| 150 | 150 |
| 151 WebAXObject anchor_object, focus_object; | 151 WebAXObject anchor_object, focus_object; |
| 152 int anchor_offset, focus_offset; | 152 int anchor_offset, focus_offset; |
| 153 root.selection(anchor_object, anchor_offset, focus_object, focus_offset); | 153 blink::WebAXTextAffinity anchor_affinity, focus_affinity; |
| 154 root.selection(anchor_object, anchor_offset, anchor_affinity, |
| 155 focus_object, focus_offset, focus_affinity); |
| 154 if (!anchor_object.isNull() && !focus_object.isNull() && | 156 if (!anchor_object.isNull() && !focus_object.isNull() && |
| 155 anchor_offset >= 0 && focus_offset >= 0) { | 157 anchor_offset >= 0 && focus_offset >= 0) { |
| 156 int32_t anchor_id = anchor_object.axID(); | 158 int32_t anchor_id = anchor_object.axID(); |
| 157 int32_t focus_id = focus_object.axID(); | 159 int32_t focus_id = focus_object.axID(); |
| 158 tree_data->sel_anchor_object_id = anchor_id; | 160 tree_data->sel_anchor_object_id = anchor_id; |
| 159 tree_data->sel_anchor_offset = anchor_offset; | 161 tree_data->sel_anchor_offset = anchor_offset; |
| 160 tree_data->sel_focus_object_id = focus_id; | 162 tree_data->sel_focus_object_id = focus_id; |
| 161 tree_data->sel_focus_offset = focus_offset; | 163 tree_data->sel_focus_offset = focus_offset; |
| 164 tree_data->sel_anchor_affinity = AXTextAffinityFromBlink(anchor_affinity); |
| 165 tree_data->sel_focus_affinity = AXTextAffinityFromBlink(focus_affinity); |
| 162 } | 166 } |
| 163 | 167 |
| 164 // Get the tree ID for this frame and the parent frame. | 168 // Get the tree ID for this frame and the parent frame. |
| 165 WebLocalFrame* web_frame = document.frame(); | 169 WebLocalFrame* web_frame = document.frame(); |
| 166 if (web_frame) { | 170 if (web_frame) { |
| 167 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); | 171 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); |
| 168 tree_data->routing_id = render_frame->GetRoutingID(); | 172 tree_data->routing_id = render_frame->GetRoutingID(); |
| 169 | 173 |
| 170 // Get the tree ID for the parent frame. | 174 // Get the tree ID for the parent frame. |
| 171 blink::WebFrame* parent_web_frame = web_frame->parent(); | 175 blink::WebFrame* parent_web_frame = web_frame->parent(); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 688 } |
| 685 } | 689 } |
| 686 | 690 |
| 687 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 691 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 688 if (render_frame_ && render_frame_->GetWebFrame()) | 692 if (render_frame_ && render_frame_->GetWebFrame()) |
| 689 return render_frame_->GetWebFrame()->document(); | 693 return render_frame_->GetWebFrame()->document(); |
| 690 return WebDocument(); | 694 return WebDocument(); |
| 691 } | 695 } |
| 692 | 696 |
| 693 } // namespace content | 697 } // namespace content |
| OLD | NEW |