| 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 const AtomicString& colIndex = getAttribute(aria_colindexAttr); |
| 107 if (colIndex.toInt() >= 1) |
| 108 return colIndex.toInt(); |
| 109 |
| 110 AXObject* parent = parentObjectUnignored(); |
| 111 if (!parent || !parent->isTableRow()) |
| 112 return 0; |
| 113 |
| 114 return m_ariaColIndexFromRow; |
| 115 } |
| 116 |
| 117 unsigned AXTableCell::ariaRowIndex() const { |
| 118 const AtomicString& rowIndex = getAttribute(aria_rowindexAttr); |
| 119 if (rowIndex.toInt() >= 1) |
| 120 return rowIndex.toInt(); |
| 121 |
| 122 AXObject* parent = parentObjectUnignored(); |
| 123 if (!parent || !parent->isTableRow()) |
| 124 return 0; |
| 125 |
| 126 return toAXTableRow(parent)->ariaRowIndex(); |
| 127 } |
| 128 |
| 104 static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell) { | 129 static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell) { |
| 105 if (!siblingCell) | 130 if (!siblingCell) |
| 106 return CellRole; | 131 return CellRole; |
| 107 | 132 |
| 108 if (Node* siblingNode = siblingCell->node()) { | 133 if (Node* siblingNode = siblingCell->node()) { |
| 109 if (siblingNode->hasTagName(thTag)) | 134 if (siblingNode->hasTagName(thTag)) |
| 110 return ColumnHeaderRole; | 135 return ColumnHeaderRole; |
| 111 if (siblingNode->hasTagName(tdTag)) | 136 if (siblingNode->hasTagName(tdTag)) |
| 112 return RowHeaderRole; | 137 return RowHeaderRole; |
| 113 } | 138 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (equalIgnoringCase(ariaSort, "ascending")) | 228 if (equalIgnoringCase(ariaSort, "ascending")) |
| 204 return SortDirectionAscending; | 229 return SortDirectionAscending; |
| 205 if (equalIgnoringCase(ariaSort, "descending")) | 230 if (equalIgnoringCase(ariaSort, "descending")) |
| 206 return SortDirectionDescending; | 231 return SortDirectionDescending; |
| 207 if (equalIgnoringCase(ariaSort, "other")) | 232 if (equalIgnoringCase(ariaSort, "other")) |
| 208 return SortDirectionOther; | 233 return SortDirectionOther; |
| 209 return SortDirectionUndefined; | 234 return SortDirectionUndefined; |
| 210 } | 235 } |
| 211 | 236 |
| 212 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |