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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 dst->AddStringAttribute( | 349 dst->AddStringAttribute( |
350 ui::AX_ATTR_HTML_TAG, | 350 ui::AX_ATTR_HTML_TAG, |
351 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); | 351 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); |
352 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 352 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
353 std::string name = base::StringToLowerASCII(UTF16ToUTF8( | 353 std::string name = base::StringToLowerASCII(UTF16ToUTF8( |
354 element.attributeLocalName(i))); | 354 element.attributeLocalName(i))); |
355 std::string value = UTF16ToUTF8(element.attributeValue(i)); | 355 std::string value = UTF16ToUTF8(element.attributeValue(i)); |
356 dst->html_attributes.push_back(std::make_pair(name, value)); | 356 dst->html_attributes.push_back(std::make_pair(name, value)); |
357 } | 357 } |
358 | 358 |
359 if (!src.isReadOnly() || | 359 if (!src.isReadOnly() || dst->role == ui::AX_ROLE_TEXT_FIELD) { |
360 dst->role == ui::AX_ROLE_TEXT_AREA || | |
361 dst->role == ui::AX_ROLE_TEXT_FIELD) { | |
362 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 360 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
363 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 361 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
364 | 362 |
365 WebVector<int> src_line_breaks; | 363 WebVector<int> src_line_breaks; |
366 src.lineBreaks(src_line_breaks); | 364 src.lineBreaks(src_line_breaks); |
367 if (src_line_breaks.size() > 0) { | 365 if (src_line_breaks.size() > 0) { |
368 std::vector<int32> line_breaks; | 366 std::vector<int32> line_breaks; |
369 line_breaks.reserve(src_line_breaks.size()); | 367 line_breaks.reserve(src_line_breaks.size()); |
370 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 368 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
371 line_breaks.push_back(src_line_breaks[i]); | 369 line_breaks.push_back(src_line_breaks[i]); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 599 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
602 } | 600 } |
603 | 601 |
604 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 602 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
605 if (render_frame_ && render_frame_->GetWebFrame()) | 603 if (render_frame_ && render_frame_->GetWebFrame()) |
606 return render_frame_->GetWebFrame()->document(); | 604 return render_frame_->GetWebFrame()->document(); |
607 return WebDocument(); | 605 return WebDocument(); |
608 } | 606 } |
609 | 607 |
610 } // namespace content | 608 } // namespace content |
OLD | NEW |