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 27 matching lines...) Expand all Loading... |
38 AXObjectCacheImpl& ax_object_cache) | 38 AXObjectCacheImpl& ax_object_cache) |
39 : AXTable(layout_object, ax_object_cache) {} | 39 : AXTable(layout_object, ax_object_cache) {} |
40 | 40 |
41 AXARIAGrid::~AXARIAGrid() {} | 41 AXARIAGrid::~AXARIAGrid() {} |
42 | 42 |
43 AXARIAGrid* AXARIAGrid::Create(LayoutObject* layout_object, | 43 AXARIAGrid* AXARIAGrid::Create(LayoutObject* layout_object, |
44 AXObjectCacheImpl& ax_object_cache) { | 44 AXObjectCacheImpl& ax_object_cache) { |
45 return new AXARIAGrid(layout_object, ax_object_cache); | 45 return new AXARIAGrid(layout_object, ax_object_cache); |
46 } | 46 } |
47 | 47 |
48 bool AXARIAGrid::AddTableRowChild(AXObject* child, | 48 bool AXARIAGrid::AddTableRowChild( |
49 HeapHashSet<Member<AXObject>>& appended_rows, | 49 AXObjectImpl* child, |
50 unsigned& column_count) { | 50 HeapHashSet<Member<AXObjectImpl>>& appended_rows, |
| 51 unsigned& column_count) { |
51 if (!child || child->RoleValue() != kRowRole) | 52 if (!child || child->RoleValue() != kRowRole) |
52 return false; | 53 return false; |
53 | 54 |
54 if (appended_rows.Contains(child)) | 55 if (appended_rows.Contains(child)) |
55 return false; | 56 return false; |
56 | 57 |
57 // store the maximum number of columns | 58 // store the maximum number of columns |
58 const unsigned row_cell_count = child->Children().size(); | 59 const unsigned row_cell_count = child->Children().size(); |
59 if (row_cell_count > column_count) | 60 if (row_cell_count > column_count) |
60 column_count = row_cell_count; | 61 column_count = row_cell_count; |
(...skipping 21 matching lines...) Expand all Loading... |
82 | 83 |
83 if (!IsAXTable()) { | 84 if (!IsAXTable()) { |
84 AXLayoutObject::AddChildren(); | 85 AXLayoutObject::AddChildren(); |
85 return; | 86 return; |
86 } | 87 } |
87 | 88 |
88 have_children_ = true; | 89 have_children_ = true; |
89 if (!layout_object_) | 90 if (!layout_object_) |
90 return; | 91 return; |
91 | 92 |
92 HeapVector<Member<AXObject>> children; | 93 HeapVector<Member<AXObjectImpl>> children; |
93 for (AXObject* child = RawFirstChild(); child; | 94 for (AXObjectImpl* child = RawFirstChild(); child; |
94 child = child->RawNextSibling()) | 95 child = child->RawNextSibling()) |
95 children.push_back(child); | 96 children.push_back(child); |
96 ComputeAriaOwnsChildren(children); | 97 ComputeAriaOwnsChildren(children); |
97 | 98 |
98 AXObjectCacheImpl& ax_cache = AxObjectCache(); | 99 AXObjectCacheImpl& ax_cache = AxObjectCache(); |
99 | 100 |
100 // Only add children that are actually rows. | 101 // Only add children that are actually rows. |
101 HeapHashSet<Member<AXObject>> appended_rows; | 102 HeapHashSet<Member<AXObjectImpl>> appended_rows; |
102 unsigned column_count = 0; | 103 unsigned column_count = 0; |
103 for (const auto& child : children) { | 104 for (const auto& child : children) { |
104 if (!AddTableRowChild(child, appended_rows, column_count)) { | 105 if (!AddTableRowChild(child, appended_rows, column_count)) { |
105 // in case the layout tree doesn't match the expected ARIA hierarchy, look | 106 // in case the layout tree doesn't match the expected ARIA hierarchy, look |
106 // at the children | 107 // at the children |
107 if (!child->HasChildren()) | 108 if (!child->HasChildren()) |
108 child->AddChildren(); | 109 child->AddChildren(); |
109 | 110 |
110 // The children of this non-row will contain all non-ignored elements | 111 // The children of this non-row will contain all non-ignored elements |
111 // (recursing to find them). This allows the table to dive arbitrarily | 112 // (recursing to find them). This allows the table to dive arbitrarily |
112 // deep to find the rows. | 113 // deep to find the rows. |
113 for (const auto& child_object : child->Children()) | 114 for (const auto& child_object : child->Children()) |
114 AddTableRowChild(child_object.Get(), appended_rows, column_count); | 115 AddTableRowChild(child_object.Get(), appended_rows, column_count); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 // make the columns based on the number of columns in the first body | 119 // make the columns based on the number of columns in the first body |
119 for (unsigned i = 0; i < column_count; ++i) { | 120 for (unsigned i = 0; i < column_count; ++i) { |
120 AXTableColumn* column = ToAXTableColumn(ax_cache.GetOrCreate(kColumnRole)); | 121 AXTableColumn* column = ToAXTableColumn(ax_cache.GetOrCreate(kColumnRole)); |
121 column->SetColumnIndex((int)i); | 122 column->SetColumnIndex((int)i); |
122 column->SetParent(this); | 123 column->SetParent(this); |
123 columns_.push_back(column); | 124 columns_.push_back(column); |
124 if (!column->AccessibilityIsIgnored()) | 125 if (!column->AccessibilityIsIgnored()) |
125 children_.push_back(column); | 126 children_.push_back(column); |
126 } | 127 } |
127 | 128 |
128 AXObject* header_container_object = HeaderContainer(); | 129 AXObjectImpl* header_container_object = HeaderContainer(); |
129 if (header_container_object && | 130 if (header_container_object && |
130 !header_container_object->AccessibilityIsIgnored()) | 131 !header_container_object->AccessibilityIsIgnored()) |
131 children_.push_back(header_container_object); | 132 children_.push_back(header_container_object); |
132 } | 133 } |
133 | 134 |
134 } // namespace blink | 135 } // namespace blink |
OLD | NEW |