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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // accessibilityIsIgnored(). | 49 // accessibilityIsIgnored(). |
50 bool IsParentUnignoredOf(WebAXObject ancestor, | 50 bool IsParentUnignoredOf(WebAXObject ancestor, |
51 WebAXObject child) { | 51 WebAXObject child) { |
52 WebAXObject parent = child.parentObject(); | 52 WebAXObject parent = child.parentObject(); |
53 while (!parent.isDetached() && parent.accessibilityIsIgnored()) | 53 while (!parent.isDetached() && parent.accessibilityIsIgnored()) |
54 parent = parent.parentObject(); | 54 parent = parent.parentObject(); |
55 return parent.equals(ancestor); | 55 return parent.equals(ancestor); |
56 } | 56 } |
57 | 57 |
58 bool IsTrue(std::string html_value) { | 58 bool IsTrue(std::string html_value) { |
59 return base::LowerCaseEqualsASCII(html_value, "true"); | 59 return LowerCaseEqualsASCII(html_value, "true"); |
60 } | 60 } |
61 | 61 |
62 std::string GetEquivalentAriaRoleString(const ui::AXRole role) { | 62 std::string GetEquivalentAriaRoleString(const ui::AXRole role) { |
63 switch (role) { | 63 switch (role) { |
64 case ui::AX_ROLE_ARTICLE: | 64 case ui::AX_ROLE_ARTICLE: |
65 return "article"; | 65 return "article"; |
66 case ui::AX_ROLE_BANNER: | 66 case ui::AX_ROLE_BANNER: |
67 return "banner"; | 67 return "banner"; |
68 case ui::AX_ROLE_COMPLEMENTARY: | 68 case ui::AX_ROLE_COMPLEMENTARY: |
69 return "complementary"; | 69 return "complementary"; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 bool is_iframe = false; | 289 bool is_iframe = false; |
290 std::string live_atomic; | 290 std::string live_atomic; |
291 std::string live_busy; | 291 std::string live_busy; |
292 std::string live_status; | 292 std::string live_status; |
293 std::string live_relevant; | 293 std::string live_relevant; |
294 | 294 |
295 if (!node.isNull() && node.isElementNode()) { | 295 if (!node.isNull() && node.isElementNode()) { |
296 WebElement element = node.to<WebElement>(); | 296 WebElement element = node.to<WebElement>(); |
297 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); | 297 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); |
298 | 298 |
299 if (base::LowerCaseEqualsASCII( | 299 if (LowerCaseEqualsASCII(element.getAttribute("aria-expanded"), "true")) |
300 base::string16(element.getAttribute("aria-expanded")), | |
301 "true")) | |
302 dst->state |= (1 << ui::AX_STATE_EXPANDED); | 300 dst->state |= (1 << ui::AX_STATE_EXPANDED); |
303 | 301 |
304 // TODO(ctguil): The tagName in WebKit is lower cased but | 302 // TODO(ctguil): The tagName in WebKit is lower cased but |
305 // HTMLElement::nodeName calls localNameUpper. Consider adding | 303 // HTMLElement::nodeName calls localNameUpper. Consider adding |
306 // a WebElement method that returns the original lower cased tagName. | 304 // a WebElement method that returns the original lower cased tagName. |
307 dst->AddStringAttribute( | 305 dst->AddStringAttribute( |
308 ui::AX_ATTR_HTML_TAG, | 306 ui::AX_ATTR_HTML_TAG, |
309 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); | 307 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); |
310 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 308 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
311 std::string name = base::StringToLowerASCII(UTF16ToUTF8( | 309 std::string name = base::StringToLowerASCII(UTF16ToUTF8( |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 554 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
557 WebView* view = render_frame_->render_view()->GetWebView(); | 555 WebView* view = render_frame_->render_view()->GetWebView(); |
558 WebFrame* main_frame = view ? view->mainFrame() : NULL; | 556 WebFrame* main_frame = view ? view->mainFrame() : NULL; |
559 | 557 |
560 if (main_frame) | 558 if (main_frame) |
561 return main_frame->document(); | 559 return main_frame->document(); |
562 return WebDocument(); | 560 return WebDocument(); |
563 } | 561 } |
564 | 562 |
565 } // namespace content | 563 } // namespace content |
OLD | NEW |