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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 PassRefPtr<AXTableCell> AXTableCell::create(RenderObject* renderer, AXObjectCach
eImpl* axObjectCache) | 49 PassRefPtr<AXTableCell> AXTableCell::create(RenderObject* renderer, AXObjectCach
eImpl* axObjectCache) |
50 { | 50 { |
51 return adoptRef(new AXTableCell(renderer, axObjectCache)); | 51 return adoptRef(new AXTableCell(renderer, axObjectCache)); |
52 } | 52 } |
53 | 53 |
54 bool AXTableCell::isTableHeaderCell() const | 54 bool AXTableCell::isTableHeaderCell() const |
55 { | 55 { |
56 return node() && node()->hasTagName(thTag); | 56 return node() && node()->hasTagName(thTag); |
57 } | 57 } |
58 | 58 |
| 59 bool AXTableCell::isRowHeaderCell() const |
| 60 { |
| 61 const AtomicString& scope = getAttribute(scopeAttr); |
| 62 return equalIgnoringCase(scope, "row") || equalIgnoringCase(scope, "rowgroup
"); |
| 63 } |
| 64 |
| 65 bool AXTableCell::isColumnHeaderCell() const |
| 66 { |
| 67 const AtomicString& scope = getAttribute(scopeAttr); |
| 68 return equalIgnoringCase(scope, "col") || equalIgnoringCase(scope, "colgroup
"); |
| 69 } |
| 70 |
59 bool AXTableCell::computeAccessibilityIsIgnored() const | 71 bool AXTableCell::computeAccessibilityIsIgnored() const |
60 { | 72 { |
61 AXObjectInclusion decision = defaultObjectInclusion(); | 73 AXObjectInclusion decision = defaultObjectInclusion(); |
62 if (decision == IncludeObject) | 74 if (decision == IncludeObject) |
63 return false; | 75 return false; |
64 if (decision == IgnoreObject) | 76 if (decision == IgnoreObject) |
65 return true; | 77 return true; |
66 | 78 |
67 if (!isTableCell()) | 79 if (!isTableCell()) |
68 return AXRenderObject::computeAccessibilityIsIgnored(); | 80 return AXRenderObject::computeAccessibilityIsIgnored(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return RowHeaderRole; | 118 return RowHeaderRole; |
107 return CellRole; | 119 return CellRole; |
108 } | 120 } |
109 | 121 |
110 AccessibilityRole AXTableCell::scanToDecideHeaderRole() | 122 AccessibilityRole AXTableCell::scanToDecideHeaderRole() |
111 { | 123 { |
112 if (!isTableHeaderCell()) | 124 if (!isTableHeaderCell()) |
113 return CellRole; | 125 return CellRole; |
114 | 126 |
115 // Check scope attribute first. | 127 // Check scope attribute first. |
116 const AtomicString& scope = getAttribute(scopeAttr); | 128 if (isRowHeaderCell()) |
117 if (equalIgnoringCase(scope, "row")) | |
118 return RowHeaderRole; | 129 return RowHeaderRole; |
119 if (equalIgnoringCase(scope, "col")) | 130 |
| 131 if (isColumnHeaderCell()) |
120 return ColumnHeaderRole; | 132 return ColumnHeaderRole; |
121 | 133 |
122 // Check the previous cell and the next cell | 134 // Check the previous cell and the next cell |
123 RenderTableCell* renderCell = toRenderTableCell(m_renderer); | 135 RenderTableCell* renderCell = toRenderTableCell(m_renderer); |
124 AccessibilityRole headerRole = CellRole; | 136 AccessibilityRole headerRole = CellRole; |
125 | 137 |
126 // if header is preceded by header cells then it's a column header, | 138 // if header is preceded by header cells then it's a column header, |
127 // if it is preceded by cells then it's a row header. | 139 // if it is preceded by cells then it's a row header. |
128 if (RenderTableCell* cell = renderCell->previousCell()) { | 140 if (RenderTableCell* cell = renderCell->previousCell()) { |
129 Node* siblingNode = cell->node(); | 141 Node* siblingNode = cell->node(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return 0; | 229 return 0; |
218 | 230 |
219 Node* cellElement = headerCell->node(); | 231 Node* cellElement = headerCell->node(); |
220 if (!cellElement || !cellElement->hasTagName(thTag)) | 232 if (!cellElement || !cellElement->hasTagName(thTag)) |
221 return 0; | 233 return 0; |
222 | 234 |
223 return axObjectCache()->getOrCreate(headerCell); | 235 return axObjectCache()->getOrCreate(headerCell); |
224 } | 236 } |
225 | 237 |
226 } // namespace blink | 238 } // namespace blink |
OLD | NEW |