Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp

Issue 2883203002: Revert of Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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( 48 bool AXARIAGrid::AddTableRowChild(AXObject* child,
49 AXObjectImpl* child, 49 HeapHashSet<Member<AXObject>>& appended_rows,
50 HeapHashSet<Member<AXObjectImpl>>& appended_rows, 50 unsigned& column_count) {
51 unsigned& column_count) {
52 if (!child || child->RoleValue() != kRowRole) 51 if (!child || child->RoleValue() != kRowRole)
53 return false; 52 return false;
54 53
55 if (appended_rows.Contains(child)) 54 if (appended_rows.Contains(child))
56 return false; 55 return false;
57 56
58 // store the maximum number of columns 57 // store the maximum number of columns
59 const unsigned row_cell_count = child->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;
(...skipping 21 matching lines...) Expand all
83 82
84 if (!IsAXTable()) { 83 if (!IsAXTable()) {
85 AXLayoutObject::AddChildren(); 84 AXLayoutObject::AddChildren();
86 return; 85 return;
87 } 86 }
88 87
89 have_children_ = true; 88 have_children_ = true;
90 if (!layout_object_) 89 if (!layout_object_)
91 return; 90 return;
92 91
93 HeapVector<Member<AXObjectImpl>> children; 92 HeapVector<Member<AXObject>> children;
94 for (AXObjectImpl* child = RawFirstChild(); child; 93 for (AXObject* child = RawFirstChild(); child;
95 child = child->RawNextSibling()) 94 child = child->RawNextSibling())
96 children.push_back(child); 95 children.push_back(child);
97 ComputeAriaOwnsChildren(children); 96 ComputeAriaOwnsChildren(children);
98 97
99 AXObjectCacheImpl& ax_cache = AxObjectCache(); 98 AXObjectCacheImpl& ax_cache = AxObjectCache();
100 99
101 // Only add children that are actually rows. 100 // Only add children that are actually rows.
102 HeapHashSet<Member<AXObjectImpl>> appended_rows; 101 HeapHashSet<Member<AXObject>> appended_rows;
103 unsigned column_count = 0; 102 unsigned column_count = 0;
104 for (const auto& child : children) { 103 for (const auto& child : children) {
105 if (!AddTableRowChild(child, appended_rows, column_count)) { 104 if (!AddTableRowChild(child, appended_rows, column_count)) {
106 // in case the layout tree doesn't match the expected ARIA hierarchy, look 105 // in case the layout tree doesn't match the expected ARIA hierarchy, look
107 // at the children 106 // at the children
108 if (!child->HasChildren()) 107 if (!child->HasChildren())
109 child->AddChildren(); 108 child->AddChildren();
110 109
111 // The children of this non-row will contain all non-ignored elements 110 // The children of this non-row will contain all non-ignored elements
112 // (recursing to find them). This allows the table to dive arbitrarily 111 // (recursing to find them). This allows the table to dive arbitrarily
113 // deep to find the rows. 112 // deep to find the rows.
114 for (const auto& child_object : child->Children()) 113 for (const auto& child_object : child->Children())
115 AddTableRowChild(child_object.Get(), appended_rows, column_count); 114 AddTableRowChild(child_object.Get(), appended_rows, column_count);
116 } 115 }
117 } 116 }
118 117
119 // make the columns based on the number of columns in the first body 118 // make the columns based on the number of columns in the first body
120 for (unsigned i = 0; i < column_count; ++i) { 119 for (unsigned i = 0; i < column_count; ++i) {
121 AXTableColumn* column = ToAXTableColumn(ax_cache.GetOrCreate(kColumnRole)); 120 AXTableColumn* column = ToAXTableColumn(ax_cache.GetOrCreate(kColumnRole));
122 column->SetColumnIndex((int)i); 121 column->SetColumnIndex((int)i);
123 column->SetParent(this); 122 column->SetParent(this);
124 columns_.push_back(column); 123 columns_.push_back(column);
125 if (!column->AccessibilityIsIgnored()) 124 if (!column->AccessibilityIsIgnored())
126 children_.push_back(column); 125 children_.push_back(column);
127 } 126 }
128 127
129 AXObjectImpl* header_container_object = HeaderContainer(); 128 AXObject* header_container_object = HeaderContainer();
130 if (header_container_object && 129 if (header_container_object &&
131 !header_container_object->AccessibilityIsIgnored()) 130 !header_container_object->AccessibilityIsIgnored())
132 children_.push_back(header_container_object); 131 children_.push_back(header_container_object);
133 } 132 }
134 133
135 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698