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 29 matching lines...) Expand all Loading... | |
40 AXObjectCacheImpl& axObjectCache) | 40 AXObjectCacheImpl& axObjectCache) |
41 : AXLayoutObject(layoutObject, axObjectCache) {} | 41 : AXLayoutObject(layoutObject, axObjectCache) {} |
42 | 42 |
43 AXTableRow::~AXTableRow() {} | 43 AXTableRow::~AXTableRow() {} |
44 | 44 |
45 AXTableRow* AXTableRow::create(LayoutObject* layoutObject, | 45 AXTableRow* AXTableRow::create(LayoutObject* layoutObject, |
46 AXObjectCacheImpl& axObjectCache) { | 46 AXObjectCacheImpl& axObjectCache) { |
47 return new AXTableRow(layoutObject, axObjectCache); | 47 return new AXTableRow(layoutObject, axObjectCache); |
48 } | 48 } |
49 | 49 |
50 void AXTableRow::addChildren() { | |
51 AXLayoutObject::addChildren(); | |
52 | |
53 // A row is allowed to have a column index that's then applied to all | |
aboxhall
2016/12/02 17:39:26
nit: this explanation may give the impression that
dmazzoni
2016/12/14 17:41:03
Done.
| |
54 // cells within that row, if they're all contiguous. | |
55 int colIndex = ariaColumnIndex(); | |
56 if (!colIndex) | |
57 return; | |
58 | |
59 unsigned index = 0; | |
60 for (const auto& cell : children()) { | |
61 if (cell->isTableCell()) | |
62 toAXTableCell(cell.get())->setARIAColIndexFromRow(colIndex + index); | |
63 index++; | |
64 } | |
65 } | |
66 | |
50 AccessibilityRole AXTableRow::determineAccessibilityRole() { | 67 AccessibilityRole AXTableRow::determineAccessibilityRole() { |
51 if (!isTableRow()) | 68 if (!isTableRow()) |
52 return AXLayoutObject::determineAccessibilityRole(); | 69 return AXLayoutObject::determineAccessibilityRole(); |
53 | 70 |
54 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) | 71 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) |
55 return m_ariaRole; | 72 return m_ariaRole; |
56 | 73 |
57 return RowRole; | 74 return RowRole; |
58 } | 75 } |
59 | 76 |
(...skipping 29 matching lines...) Expand all Loading... | |
89 | 106 |
90 AXObject* AXTableRow::headerObject() { | 107 AXObject* AXTableRow::headerObject() { |
91 AXObjectVector headers; | 108 AXObjectVector headers; |
92 headerObjectsForRow(headers); | 109 headerObjectsForRow(headers); |
93 if (!headers.size()) | 110 if (!headers.size()) |
94 return 0; | 111 return 0; |
95 | 112 |
96 return headers[0].get(); | 113 return headers[0].get(); |
97 } | 114 } |
98 | 115 |
116 unsigned AXTableRow::ariaColumnIndex() const { | |
117 const AtomicString& colIndexValue = getAttribute(aria_colindexAttr); | |
118 if (colIndexValue.toInt() >= 1) | |
119 return colIndexValue.toInt(); | |
120 | |
121 return 0; | |
122 } | |
123 | |
124 unsigned AXTableRow::ariaRowIndex() const { | |
125 const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr); | |
126 if (rowIndexValue.toInt() >= 1) | |
127 return rowIndexValue.toInt(); | |
128 | |
129 return 0; | |
130 } | |
131 | |
99 void AXTableRow::headerObjectsForRow(AXObjectVector& headers) { | 132 void AXTableRow::headerObjectsForRow(AXObjectVector& headers) { |
100 if (!m_layoutObject || !m_layoutObject->isTableRow()) | 133 if (!m_layoutObject || !m_layoutObject->isTableRow()) |
101 return; | 134 return; |
102 | 135 |
103 for (const auto& cell : children()) { | 136 for (const auto& cell : children()) { |
104 if (!cell->isTableCell()) | 137 if (!cell->isTableCell()) |
105 continue; | 138 continue; |
106 | 139 |
107 if (toAXTableCell(cell.get())->scanToDecideHeaderRole() == RowHeaderRole) | 140 if (toAXTableCell(cell.get())->scanToDecideHeaderRole() == RowHeaderRole) |
108 headers.append(cell); | 141 headers.append(cell); |
109 } | 142 } |
110 } | 143 } |
111 | 144 |
112 } // namespace blink | 145 } // namespace blink |
OLD | NEW |