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

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

Issue 2614663008: Migrate WTF::Vector::append() to ::push_back() [part 13 of N] (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 AXTableRow* row = toAXTableRow(child); 54 AXTableRow* row = toAXTableRow(child);
55 if (appendedRows.contains(row)) 55 if (appendedRows.contains(row))
56 return false; 56 return false;
57 57
58 // store the maximum number of columns 58 // store the maximum number of columns
59 unsigned rowCellCount = row->children().size(); 59 unsigned rowCellCount = row->children().size();
60 if (rowCellCount > columnCount) 60 if (rowCellCount > columnCount)
61 columnCount = rowCellCount; 61 columnCount = rowCellCount;
62 62
63 row->setRowIndex((int)m_rows.size()); 63 row->setRowIndex((int)m_rows.size());
64 m_rows.append(row); 64 m_rows.push_back(row);
65 65
66 // Try adding the row if it's not ignoring accessibility, 66 // Try adding the row if it's not ignoring accessibility,
67 // otherwise add its children (the cells) as the grid's children. 67 // otherwise add its children (the cells) as the grid's children.
68 if (!row->accessibilityIsIgnored()) 68 if (!row->accessibilityIsIgnored())
69 m_children.append(row); 69 m_children.push_back(row);
70 else 70 else
71 m_children.appendVector(row->children()); 71 m_children.appendVector(row->children());
72 72
73 appendedRows.add(row); 73 appendedRows.add(row);
74 return true; 74 return true;
75 } 75 }
76 76
77 void AXARIAGrid::addChildren() { 77 void AXARIAGrid::addChildren() {
78 ASSERT(!isDetached()); 78 ASSERT(!isDetached());
79 ASSERT(!m_haveChildren); 79 ASSERT(!m_haveChildren);
80 80
81 if (!isAXTable()) { 81 if (!isAXTable()) {
82 AXLayoutObject::addChildren(); 82 AXLayoutObject::addChildren();
83 return; 83 return;
84 } 84 }
85 85
86 m_haveChildren = true; 86 m_haveChildren = true;
87 if (!m_layoutObject) 87 if (!m_layoutObject)
88 return; 88 return;
89 89
90 HeapVector<Member<AXObject>> children; 90 HeapVector<Member<AXObject>> children;
91 for (AXObject* child = rawFirstChild(); child; 91 for (AXObject* child = rawFirstChild(); child;
92 child = child->rawNextSibling()) 92 child = child->rawNextSibling())
93 children.append(child); 93 children.push_back(child);
94 computeAriaOwnsChildren(children); 94 computeAriaOwnsChildren(children);
95 95
96 AXObjectCacheImpl& axCache = axObjectCache(); 96 AXObjectCacheImpl& axCache = axObjectCache();
97 97
98 // Only add children that are actually rows. 98 // Only add children that are actually rows.
99 HeapHashSet<Member<AXObject>> appendedRows; 99 HeapHashSet<Member<AXObject>> appendedRows;
100 unsigned columnCount = 0; 100 unsigned columnCount = 0;
101 for (const auto& child : children) { 101 for (const auto& child : children) {
102 if (!addTableRowChild(child, appendedRows, columnCount)) { 102 if (!addTableRowChild(child, appendedRows, columnCount)) {
103 // in case the layout tree doesn't match the expected ARIA hierarchy, look 103 // in case the layout tree doesn't match the expected ARIA hierarchy, look
104 // at the children 104 // at the children
105 if (!child->hasChildren()) 105 if (!child->hasChildren())
106 child->addChildren(); 106 child->addChildren();
107 107
108 // The children of this non-row will contain all non-ignored elements 108 // The children of this non-row will contain all non-ignored elements
109 // (recursing to find them). This allows the table to dive arbitrarily 109 // (recursing to find them). This allows the table to dive arbitrarily
110 // deep to find the rows. 110 // deep to find the rows.
111 for (const auto& childObject : child->children()) 111 for (const auto& childObject : child->children())
112 addTableRowChild(childObject.get(), appendedRows, columnCount); 112 addTableRowChild(childObject.get(), appendedRows, columnCount);
113 } 113 }
114 } 114 }
115 115
116 // make the columns based on the number of columns in the first body 116 // make the columns based on the number of columns in the first body
117 for (unsigned i = 0; i < columnCount; ++i) { 117 for (unsigned i = 0; i < columnCount; ++i) {
118 AXTableColumn* column = toAXTableColumn(axCache.getOrCreate(ColumnRole)); 118 AXTableColumn* column = toAXTableColumn(axCache.getOrCreate(ColumnRole));
119 column->setColumnIndex((int)i); 119 column->setColumnIndex((int)i);
120 column->setParent(this); 120 column->setParent(this);
121 m_columns.append(column); 121 m_columns.push_back(column);
122 if (!column->accessibilityIsIgnored()) 122 if (!column->accessibilityIsIgnored())
123 m_children.append(column); 123 m_children.push_back(column);
124 } 124 }
125 125
126 AXObject* headerContainerObject = headerContainer(); 126 AXObject* headerContainerObject = headerContainer();
127 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored()) 127 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
128 m_children.append(headerContainerObject); 128 m_children.push_back(headerContainerObject);
129 } 129 }
130 130
131 } // namespace blink 131 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698