OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 12 matching lines...) Expand all Loading... | |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "modules/accessibility/AXTableCell.h" | 29 #include "modules/accessibility/AXTableCell.h" |
30 | 30 |
31 #include "core/layout/LayoutTableCell.h" | 31 #include "core/layout/LayoutTableCell.h" |
32 #include "modules/accessibility/AXObjectCacheImpl.h" | 32 #include "modules/accessibility/AXObjectCacheImpl.h" |
33 #include "modules/accessibility/AXTableRow.h" | |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 using namespace HTMLNames; | 37 using namespace HTMLNames; |
37 | 38 |
38 AXTableCell::AXTableCell(LayoutObject* layoutObject, | 39 AXTableCell::AXTableCell(LayoutObject* layoutObject, |
39 AXObjectCacheImpl& axObjectCache) | 40 AXObjectCacheImpl& axObjectCache) |
40 : AXLayoutObject(layoutObject, axObjectCache) {} | 41 : AXLayoutObject(layoutObject, axObjectCache) {} |
41 | 42 |
42 AXTableCell::~AXTableCell() {} | 43 AXTableCell::~AXTableCell() {} |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 } | 95 } |
95 | 96 |
96 bool AXTableCell::isTableCell() const { | 97 bool AXTableCell::isTableCell() const { |
97 AXObject* parent = parentObjectUnignored(); | 98 AXObject* parent = parentObjectUnignored(); |
98 if (!parent || !parent->isTableRow()) | 99 if (!parent || !parent->isTableRow()) |
99 return false; | 100 return false; |
100 | 101 |
101 return true; | 102 return true; |
102 } | 103 } |
103 | 104 |
105 unsigned AXTableCell::ariaColumnIndex() const | |
106 { | |
107 const AtomicString& colIndex = getAttribute(aria_colindexAttr); | |
108 if (colIndex.toInt() >= 1) | |
109 return colIndex.toInt(); | |
110 | |
111 AXObject* parent = parentObjectUnignored(); | |
112 if (!parent || !parent->isTableRow()) | |
aboxhall
2016/11/29 17:36:54
Is this check necessary? How would m_ariaColIndexF
dmazzoni
2016/11/30 22:48:17
This can happen in teardown, or if the AX tree is
| |
113 return 0; | |
114 | |
115 return m_ariaColIndexFromRow; | |
116 } | |
117 | |
118 unsigned AXTableCell::ariaRowIndex() const | |
119 { | |
120 const AtomicString& rowIndex = getAttribute(aria_rowindexAttr); | |
121 if (rowIndex.toInt() >= 1) | |
122 return rowIndex.toInt(); | |
123 | |
124 AXObject* parent = parentObjectUnignored(); | |
125 if (!parent || !parent->isTableRow()) | |
126 return 0; | |
127 | |
128 return toAXTableRow(parent)->ariaRowIndex(); | |
129 } | |
130 | |
104 static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell) { | 131 static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell) { |
105 if (!siblingCell) | 132 if (!siblingCell) |
106 return CellRole; | 133 return CellRole; |
107 | 134 |
108 if (Node* siblingNode = siblingCell->node()) { | 135 if (Node* siblingNode = siblingCell->node()) { |
109 if (siblingNode->hasTagName(thTag)) | 136 if (siblingNode->hasTagName(thTag)) |
110 return ColumnHeaderRole; | 137 return ColumnHeaderRole; |
111 if (siblingNode->hasTagName(tdTag)) | 138 if (siblingNode->hasTagName(tdTag)) |
112 return RowHeaderRole; | 139 return RowHeaderRole; |
113 } | 140 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 if (equalIgnoringCase(ariaSort, "ascending")) | 230 if (equalIgnoringCase(ariaSort, "ascending")) |
204 return SortDirectionAscending; | 231 return SortDirectionAscending; |
205 if (equalIgnoringCase(ariaSort, "descending")) | 232 if (equalIgnoringCase(ariaSort, "descending")) |
206 return SortDirectionDescending; | 233 return SortDirectionDescending; |
207 if (equalIgnoringCase(ariaSort, "other")) | 234 if (equalIgnoringCase(ariaSort, "other")) |
208 return SortDirectionOther; | 235 return SortDirectionOther; |
209 return SortDirectionUndefined; | 236 return SortDirectionUndefined; |
210 } | 237 } |
211 | 238 |
212 } // namespace blink | 239 } // namespace blink |
OLD | NEW |