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

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

Issue 2539503003: ARIA 1.1: implementation for aria-col-* and aria-row-*. (Closed)
Patch Set: Created 4 years 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 case ui::AX_ROLE_MAIN: 92 case ui::AX_ROLE_MAIN:
93 return "main"; 93 return "main";
94 case ui::AX_ROLE_NAVIGATION: 94 case ui::AX_ROLE_NAVIGATION:
95 return "navigation"; 95 return "navigation";
96 case ui::AX_ROLE_RADIO_BUTTON: 96 case ui::AX_ROLE_RADIO_BUTTON:
97 return "radio"; 97 return "radio";
98 case ui::AX_ROLE_REGION: 98 case ui::AX_ROLE_REGION:
99 return "region"; 99 return "region";
100 case ui::AX_ROLE_SLIDER: 100 case ui::AX_ROLE_SLIDER:
101 return "slider"; 101 return "slider";
102 case ui::AX_ROLE_TIME:
103 return "time";
102 default: 104 default:
103 break; 105 break;
104 } 106 }
105 107
106 return std::string(); 108 return std::string();
107 } 109 }
108 110
109 void AddIntListAttributeFromWebObjects(ui::AXIntListAttribute attr, 111 void AddIntListAttributeFromWebObjects(ui::AXIntListAttribute attr,
110 WebVector<WebAXObject> objects, 112 WebVector<WebAXObject> objects,
111 AXContentNodeData* dst) { 113 AXContentNodeData* dst) {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 552
551 // ARIA role. 553 // ARIA role.
552 if (element.hasAttribute("role")) { 554 if (element.hasAttribute("role")) {
553 dst->AddStringAttribute( 555 dst->AddStringAttribute(
554 ui::AX_ATTR_ROLE, 556 ui::AX_ATTR_ROLE,
555 element.getAttribute("role").utf8()); 557 element.getAttribute("role").utf8());
556 } else { 558 } else {
557 std::string role = GetEquivalentAriaRoleString(dst->role); 559 std::string role = GetEquivalentAriaRoleString(dst->role);
558 if (!role.empty()) 560 if (!role.empty())
559 dst->AddStringAttribute(ui::AX_ATTR_ROLE, role); 561 dst->AddStringAttribute(ui::AX_ATTR_ROLE, role);
560 else if (dst->role == ui::AX_ROLE_TIME)
561 dst->AddStringAttribute(ui::AX_ATTR_ROLE, "time");
562 } 562 }
563 563
564 // Browser plugin (used in a <webview>). 564 // Browser plugin (used in a <webview>).
565 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element); 565 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element);
566 if (browser_plugin) { 566 if (browser_plugin) {
567 dst->AddContentIntAttribute( 567 dst->AddContentIntAttribute(
568 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID, 568 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID,
569 browser_plugin->browser_plugin_instance_id()); 569 browser_plugin->browser_plugin_instance_id());
570 } 570 }
571 571
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 unique_cell_ids.push_back(cell_id); 647 unique_cell_ids.push_back(cell_id);
648 } 648 }
649 } 649 }
650 cell_ids.push_back(cell_id); 650 cell_ids.push_back(cell_id);
651 } 651 }
652 dst->AddIntListAttribute(ui::AX_ATTR_CELL_IDS, cell_ids); 652 dst->AddIntListAttribute(ui::AX_ATTR_CELL_IDS, cell_ids);
653 dst->AddIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS, unique_cell_ids); 653 dst->AddIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS, unique_cell_ids);
654 } 654 }
655 } 655 }
656 656
657 if (dst->role == ui::AX_ROLE_TABLE ||
658 dst->role == ui::AX_ROLE_GRID ||
659 dst->role == ui::AX_ROLE_TREE_GRID) {
660 int aria_colcount = src.ariaColumnCount();
661 if (aria_colcount)
662 dst->AddIntAttribute(ui::AX_ATTR_ARIA_COL_COUNT, aria_colcount);
663
664 int aria_rowcount = src.ariaRowCount();
665 if (aria_rowcount)
666 dst->AddIntAttribute(ui::AX_ATTR_ARIA_ROW_COUNT, aria_rowcount);
667 }
668
657 if (dst->role == ui::AX_ROLE_ROW) { 669 if (dst->role == ui::AX_ROLE_ROW) {
658 dst->AddIntAttribute(ui::AX_ATTR_TABLE_ROW_INDEX, src.rowIndex()); 670 dst->AddIntAttribute(ui::AX_ATTR_TABLE_ROW_INDEX, src.rowIndex());
659 WebAXObject header = src.rowHeader(); 671 WebAXObject header = src.rowHeader();
660 if (!header.isDetached()) 672 if (!header.isDetached())
661 dst->AddIntAttribute(ui::AX_ATTR_TABLE_ROW_HEADER_ID, header.axID()); 673 dst->AddIntAttribute(ui::AX_ATTR_TABLE_ROW_HEADER_ID, header.axID());
662 } 674 }
663 675
664 if (dst->role == ui::AX_ROLE_COLUMN) { 676 if (dst->role == ui::AX_ROLE_COLUMN) {
665 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_INDEX, src.columnIndex()); 677 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_INDEX, src.columnIndex());
666 WebAXObject header = src.columnHeader(); 678 WebAXObject header = src.columnHeader();
667 if (!header.isDetached()) 679 if (!header.isDetached())
668 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_HEADER_ID, header.axID()); 680 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_HEADER_ID, header.axID());
669 } 681 }
670 682
671 if (dst->role == ui::AX_ROLE_CELL || 683 if (dst->role == ui::AX_ROLE_CELL ||
672 dst->role == ui::AX_ROLE_ROW_HEADER || 684 dst->role == ui::AX_ROLE_ROW_HEADER ||
673 dst->role == ui::AX_ROLE_COLUMN_HEADER) { 685 dst->role == ui::AX_ROLE_COLUMN_HEADER ||
674 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, 686 dst->role == ui::AX_ROLE_ROW) {
675 src.cellColumnIndex()); 687 if (dst->role != ui::AX_ROLE_ROW) {
676 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, 688 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX,
677 src.cellColumnSpan()); 689 src.cellColumnIndex());
678 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, src.cellRowIndex()); 690 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN,
679 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN, src.cellRowSpan()); 691 src.cellColumnSpan());
692 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX,
693 src.cellRowIndex());
694 dst->AddIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN,src.cellRowSpan());
695
696 int aria_colindex = src.ariaColumnIndex();
697 if (aria_colindex)
698 dst->AddIntAttribute(ui::AX_ATTR_ARIA_COL_INDEX, aria_colindex);
699 }
700
701 int aria_rowindex = src.ariaRowIndex();
702 if (aria_rowindex)
703 dst->AddIntAttribute(ui::AX_ATTR_ARIA_ROW_INDEX, aria_rowindex);
680 } 704 }
681 705
682 if ((dst->role == ui::AX_ROLE_ROW_HEADER || 706 if ((dst->role == ui::AX_ROLE_ROW_HEADER ||
683 dst->role == ui::AX_ROLE_COLUMN_HEADER) && src.sortDirection()) { 707 dst->role == ui::AX_ROLE_COLUMN_HEADER) && src.sortDirection()) {
684 dst->AddIntAttribute(ui::AX_ATTR_SORT_DIRECTION, 708 dst->AddIntAttribute(ui::AX_ATTR_SORT_DIRECTION,
685 AXSortDirectionFromBlink(src.sortDirection())); 709 AXSortDirectionFromBlink(src.sortDirection()));
686 } 710 }
687 711
688 // Add the ids of *indirect* children - those who are children of this node, 712 // Add the ids of *indirect* children - those who are children of this node,
689 // but whose parent is *not* this node. One example is a table 713 // but whose parent is *not* this node. One example is a table
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 return WebAXObject(); 767 return WebAXObject();
744 768
745 WebDocument document = render_frame_->GetWebFrame()->document(); 769 WebDocument document = render_frame_->GetWebFrame()->document();
746 if (!document.isNull()) 770 if (!document.isNull())
747 return document.accessibilityObject(); 771 return document.accessibilityObject();
748 772
749 return WebAXObject(); 773 return WebAXObject();
750 } 774 }
751 775
752 } // namespace content 776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698