| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 base::ToLowerASCII(UTF16ToUTF8( | 385 base::ToLowerASCII(UTF16ToUTF8( |
| 386 base::StringPiece16(element.tagName())))); | 386 base::StringPiece16(element.tagName())))); |
| 387 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 387 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
| 388 std::string name = base::ToLowerASCII(UTF16ToUTF8( | 388 std::string name = base::ToLowerASCII(UTF16ToUTF8( |
| 389 base::StringPiece16(element.attributeLocalName(i)))); | 389 base::StringPiece16(element.attributeLocalName(i)))); |
| 390 std::string value = | 390 std::string value = |
| 391 UTF16ToUTF8(base::StringPiece16(element.attributeValue(i))); | 391 UTF16ToUTF8(base::StringPiece16(element.attributeValue(i))); |
| 392 dst->html_attributes.push_back(std::make_pair(name, value)); | 392 dst->html_attributes.push_back(std::make_pair(name, value)); |
| 393 } | 393 } |
| 394 | 394 |
| 395 if (!src.isReadOnly() || dst->role == ui::AX_ROLE_TEXT_FIELD) { | 395 if (src.isEditable()) { |
| 396 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 396 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
| 397 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 397 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
| 398 | 398 |
| 399 WebVector<int> src_line_breaks; | 399 WebVector<int> src_line_breaks; |
| 400 src.lineBreaks(src_line_breaks); | 400 src.lineBreaks(src_line_breaks); |
| 401 if (src_line_breaks.size() > 0) { | 401 if (src_line_breaks.size() > 0) { |
| 402 std::vector<int32> line_breaks; | 402 std::vector<int32> line_breaks; |
| 403 line_breaks.reserve(src_line_breaks.size()); | 403 line_breaks.reserve(src_line_breaks.size()); |
| 404 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 404 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
| 405 line_breaks.push_back(src_line_breaks[i]); | 405 line_breaks.push_back(src_line_breaks[i]); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 } | 657 } |
| 658 } | 658 } |
| 659 | 659 |
| 660 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 660 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 661 if (render_frame_ && render_frame_->GetWebFrame()) | 661 if (render_frame_ && render_frame_->GetWebFrame()) |
| 662 return render_frame_->GetWebFrame()->document(); | 662 return render_frame_->GetWebFrame()->document(); |
| 663 return WebDocument(); | 663 return WebDocument(); |
| 664 } | 664 } |
| 665 | 665 |
| 666 } // namespace content | 666 } // namespace content |
| OLD | NEW |