| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 501 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
| 502 std::string name = base::ToLowerASCII( | 502 std::string name = base::ToLowerASCII( |
| 503 element.attributeLocalName(i).utf8()); | 503 element.attributeLocalName(i).utf8()); |
| 504 std::string value = element.attributeValue(i).utf8(); | 504 std::string value = element.attributeValue(i).utf8(); |
| 505 dst->html_attributes.push_back(std::make_pair(name, value)); | 505 dst->html_attributes.push_back(std::make_pair(name, value)); |
| 506 } | 506 } |
| 507 | 507 |
| 508 if (src.isEditable()) { | 508 if (src.isEditable()) { |
| 509 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 509 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
| 510 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 510 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
| 511 | |
| 512 WebVector<int> src_line_breaks; | |
| 513 src.lineBreaks(src_line_breaks); | |
| 514 if (src_line_breaks.size()) { | |
| 515 std::vector<int32_t> line_breaks; | |
| 516 line_breaks.reserve(src_line_breaks.size()); | |
| 517 for (size_t i = 0; i < src_line_breaks.size(); ++i) | |
| 518 line_breaks.push_back(src_line_breaks[i]); | |
| 519 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks); | |
| 520 } | |
| 521 } | 511 } |
| 522 | 512 |
| 523 // ARIA role. | 513 // ARIA role. |
| 524 if (element.hasAttribute("role")) { | 514 if (element.hasAttribute("role")) { |
| 525 dst->AddStringAttribute( | 515 dst->AddStringAttribute( |
| 526 ui::AX_ATTR_ROLE, | 516 ui::AX_ATTR_ROLE, |
| 527 element.getAttribute("role").utf8()); | 517 element.getAttribute("role").utf8()); |
| 528 } else { | 518 } else { |
| 529 std::string role = GetEquivalentAriaRoleString(dst->role); | 519 std::string role = GetEquivalentAriaRoleString(dst->role); |
| 530 if (!role.empty()) | 520 if (!role.empty()) |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 } | 687 } |
| 698 } | 688 } |
| 699 | 689 |
| 700 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 690 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 701 if (render_frame_ && render_frame_->GetWebFrame()) | 691 if (render_frame_ && render_frame_->GetWebFrame()) |
| 702 return render_frame_->GetWebFrame()->document(); | 692 return render_frame_->GetWebFrame()->document(); |
| 703 return WebDocument(); | 693 return WebDocument(); |
| 704 } | 694 } |
| 705 | 695 |
| 706 } // namespace content | 696 } // namespace content |
| OLD | NEW |