Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: content/renderer/accessibility/blink_ax_tree_source.cc

Issue 2301833005: Get rid of AX_LINE_BREAKS attribute to improve performance. (Closed)
Patch Set: Re-worded comment. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 for (unsigned i = 0; i < element.attributeCount(); ++i) { 536 for (unsigned i = 0; i < element.attributeCount(); ++i) {
537 std::string name = base::ToLowerASCII( 537 std::string name = base::ToLowerASCII(
538 element.attributeLocalName(i).utf8()); 538 element.attributeLocalName(i).utf8());
539 std::string value = element.attributeValue(i).utf8(); 539 std::string value = element.attributeValue(i).utf8();
540 dst->html_attributes.push_back(std::make_pair(name, value)); 540 dst->html_attributes.push_back(std::make_pair(name, value));
541 } 541 }
542 542
543 if (src.isEditable()) { 543 if (src.isEditable()) {
544 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); 544 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart());
545 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); 545 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd());
546
547 WebVector<int> src_line_breaks;
548 src.lineBreaks(src_line_breaks);
549 if (src_line_breaks.size()) {
550 std::vector<int32_t> line_breaks;
551 line_breaks.reserve(src_line_breaks.size());
552 for (size_t i = 0; i < src_line_breaks.size(); ++i)
553 line_breaks.push_back(src_line_breaks[i]);
554 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks);
555 }
556 } 546 }
557 547
558 // ARIA role. 548 // ARIA role.
559 if (element.hasAttribute("role")) { 549 if (element.hasAttribute("role")) {
560 dst->AddStringAttribute( 550 dst->AddStringAttribute(
561 ui::AX_ATTR_ROLE, 551 ui::AX_ATTR_ROLE,
562 element.getAttribute("role").utf8()); 552 element.getAttribute("role").utf8());
563 } else { 553 } else {
564 std::string role = GetEquivalentAriaRoleString(dst->role); 554 std::string role = GetEquivalentAriaRoleString(dst->role);
565 if (!role.empty()) 555 if (!role.empty())
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 return WebAXObject(); 735 return WebAXObject();
746 736
747 WebDocument document = render_frame_->GetWebFrame()->document(); 737 WebDocument document = render_frame_->GetWebFrame()->document();
748 if (!document.isNull()) 738 if (!document.isNull())
749 return document.accessibilityObject(); 739 return document.accessibilityObject();
750 740
751 return WebAXObject(); 741 return WebAXObject();
752 } 742 }
753 743
754 } // namespace content 744 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698