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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 AXTableRow::~AXTableRow() | 45 AXTableRow::~AXTableRow() |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 AXTableRow* AXTableRow::create(LayoutObject* layoutObject, AXObjectCacheImpl& ax
ObjectCache) | 49 AXTableRow* AXTableRow::create(LayoutObject* layoutObject, AXObjectCacheImpl& ax
ObjectCache) |
50 { | 50 { |
51 return new AXTableRow(layoutObject, axObjectCache); | 51 return new AXTableRow(layoutObject, axObjectCache); |
52 } | 52 } |
53 | 53 |
| 54 void AXTableRow::addChildren() |
| 55 { |
| 56 AXLayoutObject::addChildren(); |
| 57 int colIndex = ariaColumnIndex(); |
| 58 if (!colIndex) |
| 59 return; |
| 60 |
| 61 unsigned index = 0; |
| 62 for (const auto& cell : children()) { |
| 63 if (cell->isTableCell()) |
| 64 toAXTableCell(cell.get())->setARIAColIndexFromRow(colIndex + index); |
| 65 index++; |
| 66 } |
| 67 } |
| 68 |
54 AccessibilityRole AXTableRow::determineAccessibilityRole() | 69 AccessibilityRole AXTableRow::determineAccessibilityRole() |
55 { | 70 { |
56 if (!isTableRow()) | 71 if (!isTableRow()) |
57 return AXLayoutObject::determineAccessibilityRole(); | 72 return AXLayoutObject::determineAccessibilityRole(); |
58 | 73 |
59 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) | 74 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) |
60 return m_ariaRole; | 75 return m_ariaRole; |
61 | 76 |
62 return RowRole; | 77 return RowRole; |
63 } | 78 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 AXObject* AXTableRow::headerObject() | 112 AXObject* AXTableRow::headerObject() |
98 { | 113 { |
99 AXObjectVector headers; | 114 AXObjectVector headers; |
100 headerObjectsForRow(headers); | 115 headerObjectsForRow(headers); |
101 if (!headers.size()) | 116 if (!headers.size()) |
102 return 0; | 117 return 0; |
103 | 118 |
104 return headers[0].get(); | 119 return headers[0].get(); |
105 } | 120 } |
106 | 121 |
| 122 unsigned AXTableRow::ariaColumnIndex() const |
| 123 { |
| 124 const AtomicString& colIndexValue = getAttribute(aria_colindexAttr); |
| 125 if (colIndexValue.toInt() >= 1) |
| 126 return colIndexValue.toInt(); |
| 127 |
| 128 return 0; |
| 129 } |
| 130 |
| 131 unsigned AXTableRow::ariaRowIndex() const |
| 132 { |
| 133 const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr); |
| 134 if (rowIndexValue.toInt() >= 1) |
| 135 return rowIndexValue.toInt(); |
| 136 |
| 137 return 0; |
| 138 } |
| 139 |
107 void AXTableRow::headerObjectsForRow(AXObjectVector& headers) | 140 void AXTableRow::headerObjectsForRow(AXObjectVector& headers) |
108 { | 141 { |
109 if (!m_layoutObject || !m_layoutObject->isTableRow()) | 142 if (!m_layoutObject || !m_layoutObject->isTableRow()) |
110 return; | 143 return; |
111 | 144 |
112 for (const auto& cell : children()) { | 145 for (const auto& cell : children()) { |
113 if (!cell->isTableCell()) | 146 if (!cell->isTableCell()) |
114 continue; | 147 continue; |
115 | 148 |
116 if (toAXTableCell(cell.get())->scanToDecideHeaderRole() == RowHeaderRole
) | 149 if (toAXTableCell(cell.get())->scanToDecideHeaderRole() == RowHeaderRole
) |
117 headers.append(cell); | 150 headers.append(cell); |
118 } | 151 } |
119 } | 152 } |
120 | 153 |
121 } // namespace blink | 154 } // namespace blink |
OLD | NEW |