| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 if (!node.isNull() && node.isElementNode()) { | 376 if (!node.isNull() && node.isElementNode()) { |
| 377 WebElement element = node.to<WebElement>(); | 377 WebElement element = node.to<WebElement>(); |
| 378 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); | 378 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); |
| 379 | 379 |
| 380 // TODO(ctguil): The tagName in WebKit is lower cased but | 380 // TODO(ctguil): The tagName in WebKit is lower cased but |
| 381 // HTMLElement::nodeName calls localNameUpper. Consider adding | 381 // HTMLElement::nodeName calls localNameUpper. Consider adding |
| 382 // a WebElement method that returns the original lower cased tagName. | 382 // a WebElement method that returns the original lower cased tagName. |
| 383 dst->AddStringAttribute( | 383 dst->AddStringAttribute( |
| 384 ui::AX_ATTR_HTML_TAG, | 384 ui::AX_ATTR_HTML_TAG, |
| 385 base::StringToLowerASCII(UTF16ToUTF8( | 385 base::ToLowerASCII(UTF16ToUTF8( |
| 386 base::StringPiece16(element.tagName())))); | 386 base::StringPiece16(element.tagName())))); |
| 387 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 387 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
| 388 std::string name = base::StringToLowerASCII(UTF16ToUTF8( | 388 std::string name = base::ToLowerASCII(UTF16ToUTF8( |
| 389 base::StringPiece16(element.attributeLocalName(i)))); | 389 base::StringPiece16(element.attributeLocalName(i)))); |
| 390 std::string value = | 390 std::string value = |
| 391 UTF16ToUTF8(base::StringPiece16(element.attributeValue(i))); | 391 UTF16ToUTF8(base::StringPiece16(element.attributeValue(i))); |
| 392 dst->html_attributes.push_back(std::make_pair(name, value)); | 392 dst->html_attributes.push_back(std::make_pair(name, value)); |
| 393 } | 393 } |
| 394 | 394 |
| 395 if (!src.isReadOnly() || dst->role == ui::AX_ROLE_TEXT_FIELD) { | 395 if (!src.isReadOnly() || dst->role == ui::AX_ROLE_TEXT_FIELD) { |
| 396 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 396 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
| 397 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 397 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
| 398 | 398 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 } | 657 } |
| 658 } | 658 } |
| 659 | 659 |
| 660 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 660 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 661 if (render_frame_ && render_frame_->GetWebFrame()) | 661 if (render_frame_ && render_frame_->GetWebFrame()) |
| 662 return render_frame_->GetWebFrame()->document(); | 662 return render_frame_->GetWebFrame()->document(); |
| 663 return WebDocument(); | 663 return WebDocument(); |
| 664 } | 664 } |
| 665 | 665 |
| 666 } // namespace content | 666 } // namespace content |
| OLD | NEW |