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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 dst->AddStringAttribute( | 330 dst->AddStringAttribute( |
331 ui::AX_ATTR_HTML_TAG, | 331 ui::AX_ATTR_HTML_TAG, |
332 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); | 332 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); |
333 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 333 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
334 std::string name = base::StringToLowerASCII(UTF16ToUTF8( | 334 std::string name = base::StringToLowerASCII(UTF16ToUTF8( |
335 element.attributeLocalName(i))); | 335 element.attributeLocalName(i))); |
336 std::string value = UTF16ToUTF8(element.attributeValue(i)); | 336 std::string value = UTF16ToUTF8(element.attributeValue(i)); |
337 dst->html_attributes.push_back(std::make_pair(name, value)); | 337 dst->html_attributes.push_back(std::make_pair(name, value)); |
338 } | 338 } |
339 | 339 |
340 if (dst->role == ui::AX_ROLE_EDITABLE_TEXT || | 340 if (dst->role == ui::AX_ROLE_TEXT_AREA || |
341 dst->role == ui::AX_ROLE_TEXT_AREA || | |
342 dst->role == ui::AX_ROLE_TEXT_FIELD) { | 341 dst->role == ui::AX_ROLE_TEXT_FIELD) { |
343 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 342 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
344 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 343 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
345 | 344 |
346 WebVector<int> src_line_breaks; | 345 WebVector<int> src_line_breaks; |
347 src.lineBreaks(src_line_breaks); | 346 src.lineBreaks(src_line_breaks); |
348 if (src_line_breaks.size() > 0) { | 347 if (src_line_breaks.size() > 0) { |
349 std::vector<int32> line_breaks; | 348 std::vector<int32> line_breaks; |
350 line_breaks.reserve(src_line_breaks.size()); | 349 line_breaks.reserve(src_line_breaks.size()); |
351 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 350 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 562 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
564 } | 563 } |
565 | 564 |
566 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 565 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
567 if (render_frame_ && render_frame_->GetWebFrame()) | 566 if (render_frame_ && render_frame_->GetWebFrame()) |
568 return render_frame_->GetWebFrame()->document(); | 567 return render_frame_->GetWebFrame()->document(); |
569 return WebDocument(); | 568 return WebDocument(); |
570 } | 569 } |
571 | 570 |
572 } // namespace content | 571 } // namespace content |
OLD | NEW |