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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return false; | 71 return false; |
72 if (decision == kIgnoreObject) | 72 if (decision == kIgnoreObject) |
73 return true; | 73 return true; |
74 | 74 |
75 if (!IsTableCell()) | 75 if (!IsTableCell()) |
76 return AXLayoutObject::ComputeAccessibilityIsIgnored(ignored_reasons); | 76 return AXLayoutObject::ComputeAccessibilityIsIgnored(ignored_reasons); |
77 | 77 |
78 return false; | 78 return false; |
79 } | 79 } |
80 | 80 |
81 AXObject* AXTableCell::ParentTable() const { | 81 AXObjectImpl* AXTableCell::ParentTable() const { |
82 if (!layout_object_ || !layout_object_->IsTableCell()) | 82 if (!layout_object_ || !layout_object_->IsTableCell()) |
83 return 0; | 83 return 0; |
84 | 84 |
85 // If the document no longer exists, we might not have an axObjectCache. | 85 // If the document no longer exists, we might not have an axObjectCache. |
86 if (IsDetached()) | 86 if (IsDetached()) |
87 return 0; | 87 return 0; |
88 | 88 |
89 // Do not use getOrCreate. parentTable() can be called while the layout tree | 89 // Do not use getOrCreate. parentTable() can be called while the layout tree |
90 // is being modified by javascript, and creating a table element may try to | 90 // is being modified by javascript, and creating a table element may try to |
91 // access the layout tree while in a bad state. By using only get() implies | 91 // access the layout tree while in a bad state. By using only get() implies |
92 // that the AXTable must be created before AXTableCells. This should always be | 92 // that the AXTable must be created before AXTableCells. This should always be |
93 // the case when AT clients access a table. | 93 // the case when AT clients access a table. |
94 // https://bugs.webkit.org/show_bug.cgi?id=42652 | 94 // https://bugs.webkit.org/show_bug.cgi?id=42652 |
95 return AxObjectCache().Get(ToLayoutTableCell(layout_object_)->Table()); | 95 return AxObjectCache().Get(ToLayoutTableCell(layout_object_)->Table()); |
96 } | 96 } |
97 | 97 |
98 bool AXTableCell::IsTableCell() const { | 98 bool AXTableCell::IsTableCell() const { |
99 AXObject* parent = ParentObjectUnignored(); | 99 AXObjectImpl* parent = ParentObjectUnignored(); |
100 if (!parent || !parent->IsTableRow()) | 100 if (!parent || !parent->IsTableRow()) |
101 return false; | 101 return false; |
102 | 102 |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 unsigned AXTableCell::AriaColumnIndex() const { | 106 unsigned AXTableCell::AriaColumnIndex() const { |
107 const AtomicString& col_index = GetAttribute(aria_colindexAttr); | 107 const AtomicString& col_index = GetAttribute(aria_colindexAttr); |
108 if (col_index.ToInt() >= 1) | 108 if (col_index.ToInt() >= 1) |
109 return col_index.ToInt(); | 109 return col_index.ToInt(); |
110 | 110 |
111 AXObject* parent = ParentObjectUnignored(); | 111 AXObjectImpl* parent = ParentObjectUnignored(); |
112 if (!parent || !parent->IsTableRow()) | 112 if (!parent || !parent->IsTableRow()) |
113 return 0; | 113 return 0; |
114 | 114 |
115 return aria_col_index_from_row_; | 115 return aria_col_index_from_row_; |
116 } | 116 } |
117 | 117 |
118 unsigned AXTableCell::AriaRowIndex() const { | 118 unsigned AXTableCell::AriaRowIndex() const { |
119 const AtomicString& row_index = GetAttribute(aria_rowindexAttr); | 119 const AtomicString& row_index = GetAttribute(aria_rowindexAttr); |
120 if (row_index.ToInt() >= 1) | 120 if (row_index.ToInt() >= 1) |
121 return row_index.ToInt(); | 121 return row_index.ToInt(); |
122 | 122 |
123 AXObject* parent = ParentObjectUnignored(); | 123 AXObjectImpl* parent = ParentObjectUnignored(); |
124 if (!parent || !parent->IsTableRow()) | 124 if (!parent || !parent->IsTableRow()) |
125 return 0; | 125 return 0; |
126 | 126 |
127 return ToAXTableRow(parent)->AriaRowIndex(); | 127 return ToAXTableRow(parent)->AriaRowIndex(); |
128 } | 128 } |
129 | 129 |
130 static AccessibilityRole DecideRoleFromSibling(LayoutTableCell* sibling_cell) { | 130 static AccessibilityRole DecideRoleFromSibling(LayoutTableCell* sibling_cell) { |
131 if (!sibling_cell) | 131 if (!sibling_cell) |
132 return kCellRole; | 132 return kCellRole; |
133 | 133 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (EqualIgnoringASCIICase(aria_sort, "ascending")) | 232 if (EqualIgnoringASCIICase(aria_sort, "ascending")) |
233 return kSortDirectionAscending; | 233 return kSortDirectionAscending; |
234 if (EqualIgnoringASCIICase(aria_sort, "descending")) | 234 if (EqualIgnoringASCIICase(aria_sort, "descending")) |
235 return kSortDirectionDescending; | 235 return kSortDirectionDescending; |
236 if (EqualIgnoringASCIICase(aria_sort, "other")) | 236 if (EqualIgnoringASCIICase(aria_sort, "other")) |
237 return kSortDirectionOther; | 237 return kSortDirectionOther; |
238 return kSortDirectionUndefined; | 238 return kSortDirectionUndefined; |
239 } | 239 } |
240 | 240 |
241 } // namespace blink | 241 } // namespace blink |
OLD | NEW |