| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 BlinkAXTreeSource::BlinkAXTreeSource(RenderFrameImpl* render_frame) | 110 BlinkAXTreeSource::BlinkAXTreeSource(RenderFrameImpl* render_frame) |
| 111 : render_frame_(render_frame), | 111 : render_frame_(render_frame), |
| 112 node_to_frame_routing_id_map_(NULL), | 112 node_to_frame_routing_id_map_(NULL), |
| 113 node_to_browser_plugin_instance_id_map_(NULL), | 113 node_to_browser_plugin_instance_id_map_(NULL), |
| 114 accessibility_focus_id_(-1) { | 114 accessibility_focus_id_(-1) { |
| 115 } | 115 } |
| 116 | 116 |
| 117 BlinkAXTreeSource::~BlinkAXTreeSource() { | 117 BlinkAXTreeSource::~BlinkAXTreeSource() { |
| 118 } | 118 } |
| 119 | 119 |
| 120 void BlinkAXTreeSource::SetRoot(blink::WebAXObject root) { |
| 121 root_ = root; |
| 122 } |
| 123 |
| 120 bool BlinkAXTreeSource::IsInTree(blink::WebAXObject node) const { | 124 bool BlinkAXTreeSource::IsInTree(blink::WebAXObject node) const { |
| 121 const blink::WebAXObject& root = GetRoot(); | 125 const blink::WebAXObject& root = GetRoot(); |
| 122 while (IsValid(node)) { | 126 while (IsValid(node)) { |
| 123 if (node.equals(root)) | 127 if (node.equals(root)) |
| 124 return true; | 128 return true; |
| 125 node = GetParent(node); | 129 node = GetParent(node); |
| 126 } | 130 } |
| 127 return false; | 131 return false; |
| 128 } | 132 } |
| 129 | 133 |
| 130 void BlinkAXTreeSource::CollectChildFrameIdMapping( | 134 void BlinkAXTreeSource::CollectChildFrameIdMapping( |
| 131 std::map<int32, int>* node_to_frame_routing_id_map, | 135 std::map<int32, int>* node_to_frame_routing_id_map, |
| 132 std::map<int32, int>* node_to_browser_plugin_instance_id_map) { | 136 std::map<int32, int>* node_to_browser_plugin_instance_id_map) { |
| 133 node_to_frame_routing_id_map_ = node_to_frame_routing_id_map; | 137 node_to_frame_routing_id_map_ = node_to_frame_routing_id_map; |
| 134 node_to_browser_plugin_instance_id_map_ = | 138 node_to_browser_plugin_instance_id_map_ = |
| 135 node_to_browser_plugin_instance_id_map; | 139 node_to_browser_plugin_instance_id_map; |
| 136 } | 140 } |
| 137 | 141 |
| 138 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { | 142 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { |
| 143 if (!root_.isNull()) |
| 144 return root_; |
| 139 return GetMainDocument().accessibilityObject(); | 145 return GetMainDocument().accessibilityObject(); |
| 140 } | 146 } |
| 141 | 147 |
| 142 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const { | 148 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const { |
| 143 return GetMainDocument().accessibilityObjectFromID(id); | 149 return GetMainDocument().accessibilityObjectFromID(id); |
| 144 } | 150 } |
| 145 | 151 |
| 146 int32 BlinkAXTreeSource::GetId(blink::WebAXObject node) const { | 152 int32 BlinkAXTreeSource::GetId(blink::WebAXObject node) const { |
| 147 return node.axID(); | 153 return node.axID(); |
| 148 } | 154 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 607 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
| 602 } | 608 } |
| 603 | 609 |
| 604 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 610 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 605 if (render_frame_ && render_frame_->GetWebFrame()) | 611 if (render_frame_ && render_frame_->GetWebFrame()) |
| 606 return render_frame_->GetWebFrame()->document(); | 612 return render_frame_->GetWebFrame()->document(); |
| 607 return WebDocument(); | 613 return WebDocument(); |
| 608 } | 614 } |
| 609 | 615 |
| 610 } // namespace content | 616 } // namespace content |
| OLD | NEW |