| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 bool AXARIAGridRow::isARIATreeGridRow() const | 51 bool AXARIAGridRow::isARIATreeGridRow() const |
| 52 { | 52 { |
| 53 AXObject* parent = parentTable(); | 53 AXObject* parent = parentTable(); |
| 54 if (!parent) | 54 if (!parent) |
| 55 return false; | 55 return false; |
| 56 | 56 |
| 57 return parent->ariaRoleAttribute() == TreeGridRole; | 57 return parent->ariaRoleAttribute() == TreeGridRole; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void AXARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclosedRows) | |
| 61 { | |
| 62 // The contiguous disclosed rows will be the rows in the table that | |
| 63 // have an aria-level of plus 1 from this row. | |
| 64 AXObject* parent = parentObjectUnignored(); | |
| 65 if (!parent || !parent->isAXTable()) | |
| 66 return; | |
| 67 | |
| 68 // Search for rows that match the correct level. | |
| 69 // Only take the subsequent rows from this one that are +1 from this row's l
evel. | |
| 70 int index = rowIndex(); | |
| 71 if (index < 0) | |
| 72 return; | |
| 73 | |
| 74 unsigned level = hierarchicalLevel(); | |
| 75 AccessibilityChildrenVector& allRows = toAXTable(parent)->rows(); | |
| 76 int rowCount = allRows.size(); | |
| 77 for (int k = index + 1; k < rowCount; ++k) { | |
| 78 AXObject* row = allRows[k].get(); | |
| 79 // Stop at the first row that doesn't match the correct level. | |
| 80 if (row->hierarchicalLevel() != level + 1) | |
| 81 break; | |
| 82 | |
| 83 disclosedRows.append(row); | |
| 84 } | |
| 85 } | |
| 86 | |
| 87 AXObject* AXARIAGridRow::disclosedByRow() const | |
| 88 { | |
| 89 // The row that discloses this one is the row in the table | |
| 90 // that is aria-level subtract 1 from this row. | |
| 91 AXObject* parent = parentObjectUnignored(); | |
| 92 if (!parent || !parent->isAXTable()) | |
| 93 return 0; | |
| 94 | |
| 95 // If the level is 1 or less, than nothing discloses this row. | |
| 96 unsigned level = hierarchicalLevel(); | |
| 97 if (level <= 1) | |
| 98 return 0; | |
| 99 | |
| 100 // Search for the previous row that matches the correct level. | |
| 101 int index = rowIndex(); | |
| 102 AccessibilityChildrenVector& allRows = toAXTable(parent)->rows(); | |
| 103 int rowCount = allRows.size(); | |
| 104 if (index >= rowCount) | |
| 105 return 0; | |
| 106 | |
| 107 for (int k = index - 1; k >= 0; --k) { | |
| 108 AXObject* row = allRows[k].get(); | |
| 109 if (row->hierarchicalLevel() == level - 1) | |
| 110 return row; | |
| 111 } | |
| 112 | |
| 113 return 0; | |
| 114 } | |
| 115 | |
| 116 AXObject* AXARIAGridRow::headerObject() | 60 AXObject* AXARIAGridRow::headerObject() |
| 117 { | 61 { |
| 118 AccessibilityChildrenVector rowChildren = children(); | 62 AccessibilityChildrenVector rowChildren = children(); |
| 119 unsigned childrenCount = rowChildren.size(); | 63 unsigned childrenCount = rowChildren.size(); |
| 120 for (unsigned i = 0; i < childrenCount; ++i) { | 64 for (unsigned i = 0; i < childrenCount; ++i) { |
| 121 AXObject* cell = rowChildren[i].get(); | 65 AXObject* cell = rowChildren[i].get(); |
| 122 if (cell->ariaRoleAttribute() == RowHeaderRole) | 66 if (cell->ariaRoleAttribute() == RowHeaderRole) |
| 123 return cell; | 67 return cell; |
| 124 } | 68 } |
| 125 | 69 |
| 126 return 0; | 70 return 0; |
| 127 } | 71 } |
| 128 | 72 |
| 129 } // namespace WebCore | 73 } // namespace WebCore |
| OLD | NEW |