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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 dst->AddStringAttribute( | 318 dst->AddStringAttribute( |
319 ui::AX_ATTR_HTML_TAG, | 319 ui::AX_ATTR_HTML_TAG, |
320 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); | 320 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); |
321 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 321 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
322 std::string name = base::StringToLowerASCII(UTF16ToUTF8( | 322 std::string name = base::StringToLowerASCII(UTF16ToUTF8( |
323 element.attributeLocalName(i))); | 323 element.attributeLocalName(i))); |
324 std::string value = UTF16ToUTF8(element.attributeValue(i)); | 324 std::string value = UTF16ToUTF8(element.attributeValue(i)); |
325 dst->html_attributes.push_back(std::make_pair(name, value)); | 325 dst->html_attributes.push_back(std::make_pair(name, value)); |
326 } | 326 } |
327 | 327 |
328 if (dst->role == ui::AX_ROLE_EDITABLE_TEXT || | 328 if (dst->role == ui::AX_ROLE_TEXT_AREA || |
329 dst->role == ui::AX_ROLE_TEXT_AREA || | |
330 dst->role == ui::AX_ROLE_TEXT_FIELD) { | 329 dst->role == ui::AX_ROLE_TEXT_FIELD) { |
331 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 330 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
332 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 331 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
333 | 332 |
334 WebVector<int> src_line_breaks; | 333 WebVector<int> src_line_breaks; |
335 src.lineBreaks(src_line_breaks); | 334 src.lineBreaks(src_line_breaks); |
336 if (src_line_breaks.size() > 0) { | 335 if (src_line_breaks.size() > 0) { |
337 std::vector<int32> line_breaks; | 336 std::vector<int32> line_breaks; |
338 line_breaks.reserve(src_line_breaks.size()); | 337 line_breaks.reserve(src_line_breaks.size()); |
339 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 338 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 550 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
552 } | 551 } |
553 | 552 |
554 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 553 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
555 if (render_frame_ && render_frame_->GetWebFrame()) | 554 if (render_frame_ && render_frame_->GetWebFrame()) |
556 return render_frame_->GetWebFrame()->document(); | 555 return render_frame_->GetWebFrame()->document(); |
557 return WebDocument(); | 556 return WebDocument(); |
558 } | 557 } |
559 | 558 |
560 } // namespace content | 559 } // namespace content |
OLD | NEW |