| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 WebVector<int> src_line_breaks; | 340 WebVector<int> src_line_breaks; |
| 341 src.lineBreaks(src_line_breaks); | 341 src.lineBreaks(src_line_breaks); |
| 342 if (src_line_breaks.size() > 0) { | 342 if (src_line_breaks.size() > 0) { |
| 343 std::vector<int32> line_breaks; | 343 std::vector<int32> line_breaks; |
| 344 line_breaks.reserve(src_line_breaks.size()); | 344 line_breaks.reserve(src_line_breaks.size()); |
| 345 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 345 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
| 346 line_breaks.push_back(src_line_breaks[i]); | 346 line_breaks.push_back(src_line_breaks[i]); |
| 347 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks); | 347 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks); |
| 348 } | 348 } |
| 349 |
| 350 if (dst->role == ui::AX_ROLE_TEXT_FIELD && |
| 351 src.textInputType().length()) { |
| 352 dst->AddStringAttribute(ui::AX_ATTR_TEXT_INPUT_TYPE, |
| 353 UTF16ToUTF8(src.textInputType())); |
| 354 } |
| 349 } | 355 } |
| 350 | 356 |
| 351 // ARIA role. | 357 // ARIA role. |
| 352 if (element.hasAttribute("role")) { | 358 if (element.hasAttribute("role")) { |
| 353 dst->AddStringAttribute(ui::AX_ATTR_ROLE, | 359 dst->AddStringAttribute(ui::AX_ATTR_ROLE, |
| 354 UTF16ToUTF8(element.getAttribute("role"))); | 360 UTF16ToUTF8(element.getAttribute("role"))); |
| 355 } else { | 361 } else { |
| 356 std::string role = GetEquivalentAriaRoleString(dst->role); | 362 std::string role = GetEquivalentAriaRoleString(dst->role); |
| 357 if (!role.empty()) | 363 if (!role.empty()) |
| 358 dst->AddStringAttribute(ui::AX_ATTR_ROLE, role); | 364 dst->AddStringAttribute(ui::AX_ATTR_ROLE, role); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 604 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
| 599 } | 605 } |
| 600 | 606 |
| 601 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 607 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 602 if (render_frame_ && render_frame_->GetWebFrame()) | 608 if (render_frame_ && render_frame_->GetWebFrame()) |
| 603 return render_frame_->GetWebFrame()->document(); | 609 return render_frame_->GetWebFrame()->document(); |
| 604 return WebDocument(); | 610 return WebDocument(); |
| 605 } | 611 } |
| 606 | 612 |
| 607 } // namespace content | 613 } // namespace content |
| OLD | NEW |