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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 if (!parent || !parent->isAccessibilityTable()) | 66 if (!parent || !parent->isAccessibilityTable()) |
67 return; | 67 return; |
68 | 68 |
69 // Search for rows that match the correct level. | 69 // Search for rows that match the correct level. |
70 // Only take the subsequent rows from this one that are +1 from this row's l
evel. | 70 // Only take the subsequent rows from this one that are +1 from this row's l
evel. |
71 int index = rowIndex(); | 71 int index = rowIndex(); |
72 if (index < 0) | 72 if (index < 0) |
73 return; | 73 return; |
74 | 74 |
75 unsigned level = hierarchicalLevel(); | 75 unsigned level = hierarchicalLevel(); |
76 AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(pare
nt)->rows(); | 76 AccessibilityChildrenVector& allRows = toAccessibilityTable(parent)->rows(); |
77 int rowCount = allRows.size(); | 77 int rowCount = allRows.size(); |
78 for (int k = index + 1; k < rowCount; ++k) { | 78 for (int k = index + 1; k < rowCount; ++k) { |
79 AccessibilityObject* row = allRows[k].get(); | 79 AccessibilityObject* row = allRows[k].get(); |
80 // Stop at the first row that doesn't match the correct level. | 80 // Stop at the first row that doesn't match the correct level. |
81 if (row->hierarchicalLevel() != level + 1) | 81 if (row->hierarchicalLevel() != level + 1) |
82 break; | 82 break; |
83 | 83 |
84 disclosedRows.append(row); | 84 disclosedRows.append(row); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const | 88 AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const |
89 { | 89 { |
90 // The row that discloses this one is the row in the table | 90 // The row that discloses this one is the row in the table |
91 // that is aria-level subtract 1 from this row. | 91 // that is aria-level subtract 1 from this row. |
92 AccessibilityObject* parent = parentObjectUnignored(); | 92 AccessibilityObject* parent = parentObjectUnignored(); |
93 if (!parent || !parent->isAccessibilityTable()) | 93 if (!parent || !parent->isAccessibilityTable()) |
94 return 0; | 94 return 0; |
95 | 95 |
96 // If the level is 1 or less, than nothing discloses this row. | 96 // If the level is 1 or less, than nothing discloses this row. |
97 unsigned level = hierarchicalLevel(); | 97 unsigned level = hierarchicalLevel(); |
98 if (level <= 1) | 98 if (level <= 1) |
99 return 0; | 99 return 0; |
100 | 100 |
101 // Search for the previous row that matches the correct level. | 101 // Search for the previous row that matches the correct level. |
102 int index = rowIndex(); | 102 int index = rowIndex(); |
103 AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(pare
nt)->rows(); | 103 AccessibilityChildrenVector& allRows = toAccessibilityTable(parent)->rows(); |
104 int rowCount = allRows.size(); | 104 int rowCount = allRows.size(); |
105 if (index >= rowCount) | 105 if (index >= rowCount) |
106 return 0; | 106 return 0; |
107 | 107 |
108 for (int k = index - 1; k >= 0; --k) { | 108 for (int k = index - 1; k >= 0; --k) { |
109 AccessibilityObject* row = allRows[k].get(); | 109 AccessibilityObject* row = allRows[k].get(); |
110 if (row->hierarchicalLevel() == level - 1) | 110 if (row->hierarchicalLevel() == level - 1) |
111 return row; | 111 return row; |
112 } | 112 } |
113 | 113 |
114 return 0; | 114 return 0; |
115 } | 115 } |
116 | 116 |
117 AccessibilityObject* AccessibilityARIAGridRow::headerObject() | 117 AccessibilityObject* AccessibilityARIAGridRow::headerObject() |
118 { | 118 { |
119 AccessibilityChildrenVector rowChildren = children(); | 119 AccessibilityChildrenVector rowChildren = children(); |
120 unsigned childrenCount = rowChildren.size(); | 120 unsigned childrenCount = rowChildren.size(); |
121 for (unsigned i = 0; i < childrenCount; ++i) { | 121 for (unsigned i = 0; i < childrenCount; ++i) { |
122 AccessibilityObject* cell = rowChildren[i].get(); | 122 AccessibilityObject* cell = rowChildren[i].get(); |
123 if (cell->ariaRoleAttribute() == RowHeaderRole) | 123 if (cell->ariaRoleAttribute() == RowHeaderRole) |
124 return cell; | 124 return cell; |
125 } | 125 } |
126 | 126 |
127 return 0; | 127 return 0; |
128 } | 128 } |
129 | 129 |
130 } // namespace WebCore | 130 } // namespace WebCore |
OLD | NEW |