| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 540 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
| 541 std::string name = base::ToLowerASCII( | 541 std::string name = base::ToLowerASCII( |
| 542 element.attributeLocalName(i).utf8()); | 542 element.attributeLocalName(i).utf8()); |
| 543 std::string value = element.attributeValue(i).utf8(); | 543 std::string value = element.attributeValue(i).utf8(); |
| 544 dst->html_attributes.push_back(std::make_pair(name, value)); | 544 dst->html_attributes.push_back(std::make_pair(name, value)); |
| 545 } | 545 } |
| 546 | 546 |
| 547 if (src.isEditable()) { | 547 if (src.isEditable()) { |
| 548 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 548 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
| 549 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 549 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
| 550 |
| 551 #if defined(OS_CHROMEOS) |
| 552 // This attribute will soon be deprecated; see crbug.com/669134. |
| 553 WebVector<int> src_line_breaks; |
| 554 src.lineBreaks(src_line_breaks); |
| 555 if (src_line_breaks.size()) { |
| 556 std::vector<int32_t> line_breaks; |
| 557 line_breaks.reserve(src_line_breaks.size()); |
| 558 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
| 559 line_breaks.push_back(src_line_breaks[i]); |
| 560 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks); |
| 561 } |
| 562 #endif // defined OS_CHROMEOS |
| 550 } | 563 } |
| 551 | 564 |
| 552 // ARIA role. | 565 // ARIA role. |
| 553 if (element.hasAttribute("role")) { | 566 if (element.hasAttribute("role")) { |
| 554 dst->AddStringAttribute( | 567 dst->AddStringAttribute( |
| 555 ui::AX_ATTR_ROLE, | 568 ui::AX_ATTR_ROLE, |
| 556 element.getAttribute("role").utf8()); | 569 element.getAttribute("role").utf8()); |
| 557 } else { | 570 } else { |
| 558 std::string role = GetEquivalentAriaRoleString(dst->role); | 571 std::string role = GetEquivalentAriaRoleString(dst->role); |
| 559 if (!role.empty()) | 572 if (!role.empty()) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 return WebAXObject(); | 752 return WebAXObject(); |
| 740 | 753 |
| 741 WebDocument document = render_frame_->GetWebFrame()->document(); | 754 WebDocument document = render_frame_->GetWebFrame()->document(); |
| 742 if (!document.isNull()) | 755 if (!document.isNull()) |
| 743 return document.accessibilityObject(); | 756 return document.accessibilityObject(); |
| 744 | 757 |
| 745 return WebAXObject(); | 758 return WebAXObject(); |
| 746 } | 759 } |
| 747 | 760 |
| 748 } // namespace content | 761 } // namespace content |
| OLD | NEW |