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 30 matching lines...) Expand all Loading... |
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(AXObject* child, |
49 HeapHashSet<Member<AXObject>>& appended_rows, | 49 HeapHashSet<Member<AXObject>>& appended_rows, |
50 unsigned& column_count) { | 50 unsigned& column_count) { |
51 if (!child || !child->IsTableRow() || child->RoleValue() != kRowRole) | 51 if (!child || child->RoleValue() != kRowRole) |
52 return false; | 52 return false; |
53 | 53 |
54 AXTableRow* row = ToAXTableRow(child); | 54 if (appended_rows.Contains(child)) |
55 if (appended_rows.Contains(row)) | |
56 return false; | 55 return false; |
57 | 56 |
58 // store the maximum number of columns | 57 // store the maximum number of columns |
59 unsigned row_cell_count = row->Children().size(); | 58 const unsigned row_cell_count = child->Children().size(); |
60 if (row_cell_count > column_count) | 59 if (row_cell_count > column_count) |
61 column_count = row_cell_count; | 60 column_count = row_cell_count; |
62 | 61 |
63 row->SetRowIndex((int)rows_.size()); | 62 AXTableRow* row = child->IsTableRow() ? ToAXTableRow(child) : 0; |
64 rows_.push_back(row); | 63 if (row) { |
| 64 row->SetRowIndex((int)rows_.size()); |
| 65 } |
| 66 rows_.push_back(child); |
65 | 67 |
66 // Try adding the row if it's not ignoring accessibility, | 68 // Try adding the row if it's not ignoring accessibility, |
67 // otherwise add its children (the cells) as the grid's children. | 69 // otherwise add its children (the cells) as the grid's children. |
68 if (!row->AccessibilityIsIgnored()) | 70 if (!child->AccessibilityIsIgnored()) |
69 children_.push_back(row); | 71 children_.push_back(child); |
70 else | 72 else |
71 children_.AppendVector(row->Children()); | 73 children_.AppendVector(child->Children()); |
72 | 74 |
73 appended_rows.insert(row); | 75 appended_rows.insert(child); |
74 return true; | 76 return true; |
75 } | 77 } |
76 | 78 |
77 void AXARIAGrid::AddChildren() { | 79 void AXARIAGrid::AddChildren() { |
78 DCHECK(!IsDetached()); | 80 DCHECK(!IsDetached()); |
79 DCHECK(!have_children_); | 81 DCHECK(!have_children_); |
80 | 82 |
81 if (!IsAXTable()) { | 83 if (!IsAXTable()) { |
82 AXLayoutObject::AddChildren(); | 84 AXLayoutObject::AddChildren(); |
83 return; | 85 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 children_.push_back(column); | 125 children_.push_back(column); |
124 } | 126 } |
125 | 127 |
126 AXObject* header_container_object = HeaderContainer(); | 128 AXObject* header_container_object = HeaderContainer(); |
127 if (header_container_object && | 129 if (header_container_object && |
128 !header_container_object->AccessibilityIsIgnored()) | 130 !header_container_object->AccessibilityIsIgnored()) |
129 children_.push_back(header_container_object); | 131 children_.push_back(header_container_object); |
130 } | 132 } |
131 | 133 |
132 } // namespace blink | 134 } // namespace blink |
OLD | NEW |