| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 } // Anonymous namespace | 94 } // Anonymous namespace |
| 95 | 95 |
| 96 BlinkAXTreeSource::BlinkAXTreeSource(RenderViewImpl* render_view) | 96 BlinkAXTreeSource::BlinkAXTreeSource(RenderViewImpl* render_view) |
| 97 : render_view_(render_view) { | 97 : render_view_(render_view) { |
| 98 } | 98 } |
| 99 | 99 |
| 100 BlinkAXTreeSource::~BlinkAXTreeSource() { | 100 BlinkAXTreeSource::~BlinkAXTreeSource() { |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool BlinkAXTreeSource::IsInTree(blink::WebAXObject node) const { |
| 104 const blink::WebAXObject& root = GetRoot(); |
| 105 while (IsValid(node)) { |
| 106 if (node.equals(root)) |
| 107 return true; |
| 108 node = GetParent(node); |
| 109 } |
| 110 return false; |
| 111 } |
| 112 |
| 103 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { | 113 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { |
| 104 return GetMainDocument().accessibilityObject(); | 114 return GetMainDocument().accessibilityObject(); |
| 105 } | 115 } |
| 106 | 116 |
| 107 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const { | 117 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const { |
| 108 return GetMainDocument().accessibilityObjectFromID(id); | 118 return GetMainDocument().accessibilityObjectFromID(id); |
| 109 } | 119 } |
| 110 | 120 |
| 111 int32 BlinkAXTreeSource::GetId(blink::WebAXObject node) const { | 121 int32 BlinkAXTreeSource::GetId(blink::WebAXObject node) const { |
| 112 return node.axID(); | 122 return node.axID(); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 WebLocalFrame* main_frame = | 554 WebLocalFrame* main_frame = |
| 545 view ? view->mainFrame()->toWebLocalFrame() : NULL; | 555 view ? view->mainFrame()->toWebLocalFrame() : NULL; |
| 546 | 556 |
| 547 if (main_frame) | 557 if (main_frame) |
| 548 return main_frame->document(); | 558 return main_frame->document(); |
| 549 | 559 |
| 550 return WebDocument(); | 560 return WebDocument(); |
| 551 } | 561 } |
| 552 | 562 |
| 553 } // namespace content | 563 } // namespace content |
| OLD | NEW |