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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); | 297 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); |
298 | 298 |
299 if (LowerCaseEqualsASCII(element.getAttribute("aria-expanded"), "true")) | 299 if (LowerCaseEqualsASCII(element.getAttribute("aria-expanded"), "true")) |
300 dst->state |= (1 << ui::AX_STATE_EXPANDED); | 300 dst->state |= (1 << ui::AX_STATE_EXPANDED); |
301 | 301 |
302 // TODO(ctguil): The tagName in WebKit is lower cased but | 302 // TODO(ctguil): The tagName in WebKit is lower cased but |
303 // HTMLElement::nodeName calls localNameUpper. Consider adding | 303 // HTMLElement::nodeName calls localNameUpper. Consider adding |
304 // a WebElement method that returns the original lower cased tagName. | 304 // a WebElement method that returns the original lower cased tagName. |
305 dst->AddStringAttribute( | 305 dst->AddStringAttribute( |
306 ui::AX_ATTR_HTML_TAG, | 306 ui::AX_ATTR_HTML_TAG, |
307 StringToLowerASCII(UTF16ToUTF8(element.tagName()))); | 307 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); |
308 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 308 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
309 std::string name = StringToLowerASCII(UTF16ToUTF8( | 309 std::string name = base::StringToLowerASCII(UTF16ToUTF8( |
310 element.attributeLocalName(i))); | 310 element.attributeLocalName(i))); |
311 std::string value = UTF16ToUTF8(element.attributeValue(i)); | 311 std::string value = UTF16ToUTF8(element.attributeValue(i)); |
312 dst->html_attributes.push_back(std::make_pair(name, value)); | 312 dst->html_attributes.push_back(std::make_pair(name, value)); |
313 } | 313 } |
314 | 314 |
315 if (dst->role == ui::AX_ROLE_EDITABLE_TEXT || | 315 if (dst->role == ui::AX_ROLE_EDITABLE_TEXT || |
316 dst->role == ui::AX_ROLE_TEXT_AREA || | 316 dst->role == ui::AX_ROLE_TEXT_AREA || |
317 dst->role == ui::AX_ROLE_TEXT_FIELD) { | 317 dst->role == ui::AX_ROLE_TEXT_FIELD) { |
318 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 318 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
319 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 319 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 554 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
555 WebView* view = render_frame_->render_view()->GetWebView(); | 555 WebView* view = render_frame_->render_view()->GetWebView(); |
556 WebFrame* main_frame = view ? view->mainFrame() : NULL; | 556 WebFrame* main_frame = view ? view->mainFrame() : NULL; |
557 | 557 |
558 if (main_frame) | 558 if (main_frame) |
559 return main_frame->document(); | 559 return main_frame->document(); |
560 return WebDocument(); | 560 return WebDocument(); |
561 } | 561 } |
562 | 562 |
563 } // namespace content | 563 } // namespace content |
OLD | NEW |