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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXARIAGridCell.cpp

Issue 2858493002: Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Fixed rebase Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool AXARIAGridCell::IsAriaColumnHeader() const { 48 bool AXARIAGridCell::IsAriaColumnHeader() const {
49 const AtomicString& role = GetAttribute(HTMLNames::roleAttr); 49 const AtomicString& role = GetAttribute(HTMLNames::roleAttr);
50 return EqualIgnoringASCIICase(role, "columnheader"); 50 return EqualIgnoringASCIICase(role, "columnheader");
51 } 51 }
52 52
53 bool AXARIAGridCell::IsAriaRowHeader() const { 53 bool AXARIAGridCell::IsAriaRowHeader() const {
54 const AtomicString& role = GetAttribute(HTMLNames::roleAttr); 54 const AtomicString& role = GetAttribute(HTMLNames::roleAttr);
55 return EqualIgnoringASCIICase(role, "rowheader"); 55 return EqualIgnoringASCIICase(role, "rowheader");
56 } 56 }
57 57
58 AXObject* AXARIAGridCell::ParentTable() const { 58 AXObjectImpl* AXARIAGridCell::ParentTable() const {
59 AXObject* parent = ParentObjectUnignored(); 59 AXObjectImpl* parent = ParentObjectUnignored();
60 if (!parent) 60 if (!parent)
61 return 0; 61 return 0;
62 62
63 if (parent->IsAXTable()) 63 if (parent->IsAXTable())
64 return parent; 64 return parent;
65 65
66 // It could happen that we hadn't reached the parent table yet (in 66 // It could happen that we hadn't reached the parent table yet (in
67 // case objects for rows were not ignoring accessibility) so for 67 // case objects for rows were not ignoring accessibility) so for
68 // that reason we need to run parentObjectUnignored once again. 68 // that reason we need to run parentObjectUnignored once again.
69 parent = parent->ParentObjectUnignored(); 69 parent = parent->ParentObjectUnignored();
70 if (!parent || !parent->IsAXTable()) 70 if (!parent || !parent->IsAXTable())
71 return 0; 71 return 0;
72 72
73 return parent; 73 return parent;
74 } 74 }
75 75
76 void AXARIAGridCell::RowIndexRange(std::pair<unsigned, unsigned>& row_range) { 76 void AXARIAGridCell::RowIndexRange(std::pair<unsigned, unsigned>& row_range) {
77 AXObject* parent = ParentObjectUnignored(); 77 AXObjectImpl* parent = ParentObjectUnignored();
78 if (!parent) 78 if (!parent)
79 return; 79 return;
80 80
81 if (parent->IsTableRow()) { 81 if (parent->IsTableRow()) {
82 // We already got a table row, use its API. 82 // We already got a table row, use its API.
83 row_range.first = ToAXTableRow(parent)->RowIndex(); 83 row_range.first = ToAXTableRow(parent)->RowIndex();
84 } else if (parent->IsAXTable()) { 84 } else if (parent->IsAXTable()) {
85 // We reached the parent table, so we need to inspect its 85 // We reached the parent table, so we need to inspect its
86 // children to determine the row index for the cell in it. 86 // children to determine the row index for the cell in it.
87 unsigned column_count = ToAXTable(parent)->ColumnCount(); 87 unsigned column_count = ToAXTable(parent)->ColumnCount();
88 if (!column_count) 88 if (!column_count)
89 return; 89 return;
90 90
91 const auto& siblings = parent->Children(); 91 const auto& siblings = parent->Children();
92 unsigned children_size = siblings.size(); 92 unsigned children_size = siblings.size();
93 for (unsigned k = 0; k < children_size; ++k) { 93 for (unsigned k = 0; k < children_size; ++k) {
94 if (siblings[k].Get() == this) { 94 if (siblings[k].Get() == this) {
95 row_range.first = k / column_count; 95 row_range.first = k / column_count;
96 break; 96 break;
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 // as far as I can tell, grid cells cannot span rows 101 // as far as I can tell, grid cells cannot span rows
102 row_range.second = 1; 102 row_range.second = 1;
103 } 103 }
104 104
105 void AXARIAGridCell::ColumnIndexRange( 105 void AXARIAGridCell::ColumnIndexRange(
106 std::pair<unsigned, unsigned>& column_range) { 106 std::pair<unsigned, unsigned>& column_range) {
107 AXObject* parent = ParentObjectUnignored(); 107 AXObjectImpl* parent = ParentObjectUnignored();
108 if (!parent) 108 if (!parent)
109 return; 109 return;
110 110
111 if (!parent->IsTableRow() && !parent->IsAXTable()) 111 if (!parent->IsTableRow() && !parent->IsAXTable())
112 return; 112 return;
113 113
114 const auto& siblings = parent->Children(); 114 const auto& siblings = parent->Children();
115 unsigned children_size = siblings.size(); 115 unsigned children_size = siblings.size();
116 for (unsigned k = 0; k < children_size; ++k) { 116 for (unsigned k = 0; k < children_size; ++k) {
117 if (siblings[k].Get() == this) { 117 if (siblings[k].Get() == this) {
(...skipping 10 matching lines...) Expand all
128 if (IsAriaRowHeader()) 128 if (IsAriaRowHeader())
129 return kRowHeaderRole; 129 return kRowHeaderRole;
130 130
131 if (IsAriaColumnHeader()) 131 if (IsAriaColumnHeader())
132 return kColumnHeaderRole; 132 return kColumnHeaderRole;
133 133
134 return kCellRole; 134 return kCellRole;
135 } 135 }
136 136
137 } // namespace blink 137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698