| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (parent->isTableRow()) { | 90 if (parent->isTableRow()) { |
| 91 // We already got a table row, use its API. | 91 // We already got a table row, use its API. |
| 92 rowRange.first = toAXTableRow(parent)->rowIndex(); | 92 rowRange.first = toAXTableRow(parent)->rowIndex(); |
| 93 } else if (parent->isAXTable()) { | 93 } else if (parent->isAXTable()) { |
| 94 // We reached the parent table, so we need to inspect its | 94 // We reached the parent table, so we need to inspect its |
| 95 // children to determine the row index for the cell in it. | 95 // children to determine the row index for the cell in it. |
| 96 unsigned columnCount = toAXTable(parent)->columnCount(); | 96 unsigned columnCount = toAXTable(parent)->columnCount(); |
| 97 if (!columnCount) | 97 if (!columnCount) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 AccessibilityChildrenVector siblings = parent->children(); | 100 const AccessibilityChildrenVector& siblings = parent->children(); |
| 101 unsigned childrenSize = siblings.size(); | 101 unsigned childrenSize = siblings.size(); |
| 102 for (unsigned k = 0; k < childrenSize; ++k) { | 102 for (unsigned k = 0; k < childrenSize; ++k) { |
| 103 if (siblings[k].get() == this) { | 103 if (siblings[k].get() == this) { |
| 104 rowRange.first = k / columnCount; | 104 rowRange.first = k / columnCount; |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 // as far as I can tell, grid cells cannot span rows | 110 // as far as I can tell, grid cells cannot span rows |
| 111 rowRange.second = 1; | 111 rowRange.second = 1; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void AXARIAGridCell::columnIndexRange(pair<unsigned, unsigned>& columnRange) | 114 void AXARIAGridCell::columnIndexRange(pair<unsigned, unsigned>& columnRange) |
| 115 { | 115 { |
| 116 AXObject* parent = parentObjectUnignored(); | 116 AXObject* parent = parentObjectUnignored(); |
| 117 if (!parent) | 117 if (!parent) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 if (!parent->isTableRow() && !parent->isAXTable()) | 120 if (!parent->isTableRow() && !parent->isAXTable()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 AccessibilityChildrenVector siblings = parent->children(); | 123 const AccessibilityChildrenVector& siblings = parent->children(); |
| 124 unsigned childrenSize = siblings.size(); | 124 unsigned childrenSize = siblings.size(); |
| 125 for (unsigned k = 0; k < childrenSize; ++k) { | 125 for (unsigned k = 0; k < childrenSize; ++k) { |
| 126 if (siblings[k].get() == this) { | 126 if (siblings[k].get() == this) { |
| 127 columnRange.first = k; | 127 columnRange.first = k; |
| 128 break; | 128 break; |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 // as far as I can tell, grid cells cannot span columns | 132 // as far as I can tell, grid cells cannot span columns |
| 133 columnRange.second = 1; | 133 columnRange.second = 1; |
| 134 } | 134 } |
| 135 | 135 |
| 136 AccessibilityRole AXARIAGridCell::scanToDecideHeaderRole() | 136 AccessibilityRole AXARIAGridCell::scanToDecideHeaderRole() |
| 137 { | 137 { |
| 138 if (isAriaRowHeader()) | 138 if (isAriaRowHeader()) |
| 139 return RowHeaderRole; | 139 return RowHeaderRole; |
| 140 | 140 |
| 141 if (isAriaColumnHeader()) | 141 if (isAriaColumnHeader()) |
| 142 return ColumnHeaderRole; | 142 return ColumnHeaderRole; |
| 143 | 143 |
| 144 return CellRole; | 144 return CellRole; |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |