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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.cpp

Issue 2553343002: Avoid WTF::Vector::at() and operator[] in core/dom. (Closed)
Patch Set: Created 4 years 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return it == m_nodeToInsertionPoints.end() ? nullptr : it->value; 157 return it == m_nodeToInsertionPoints.end() ? nullptr : it->value;
158 } 158 }
159 159
160 void ElementShadowV0::distribute() { 160 void ElementShadowV0::distribute() {
161 HeapVector<Member<HTMLShadowElement>, 32> shadowInsertionPoints; 161 HeapVector<Member<HTMLShadowElement>, 32> shadowInsertionPoints;
162 DistributionPool pool(m_elementShadow->host()); 162 DistributionPool pool(m_elementShadow->host());
163 163
164 for (ShadowRoot* root = &youngestShadowRoot(); root; 164 for (ShadowRoot* root = &youngestShadowRoot(); root;
165 root = root->olderShadowRoot()) { 165 root = root->olderShadowRoot()) {
166 HTMLShadowElement* shadowInsertionPoint = 0; 166 HTMLShadowElement* shadowInsertionPoint = 0;
167 const HeapVector<Member<InsertionPoint>>& insertionPoints = 167 for (const auto& point : root->descendantInsertionPoints()) {
168 root->descendantInsertionPoints();
169 for (size_t i = 0; i < insertionPoints.size(); ++i) {
170 InsertionPoint* point = insertionPoints[i];
171 if (!point->isActive()) 168 if (!point->isActive())
172 continue; 169 continue;
173 if (isHTMLShadowElement(*point)) { 170 if (isHTMLShadowElement(*point)) {
174 DCHECK(!shadowInsertionPoint); 171 DCHECK(!shadowInsertionPoint);
175 shadowInsertionPoint = toHTMLShadowElement(point); 172 shadowInsertionPoint = toHTMLShadowElement(point);
176 shadowInsertionPoints.append(shadowInsertionPoint); 173 shadowInsertionPoints.append(shadowInsertionPoint);
177 } else { 174 } else {
178 pool.distributeTo(point, this); 175 pool.distributeTo(point, this);
179 if (ElementShadow* shadow = 176 if (ElementShadow* shadow =
180 shadowWhereNodeCanBeDistributedForV0(*point)) 177 shadowWhereNodeCanBeDistributedForV0(*point))
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 259
263 DEFINE_TRACE(ElementShadowV0) { 260 DEFINE_TRACE(ElementShadowV0) {
264 visitor->trace(m_elementShadow); 261 visitor->trace(m_elementShadow);
265 visitor->trace(m_nodeToInsertionPoints); 262 visitor->trace(m_nodeToInsertionPoints);
266 visitor->trace(m_selectFeatures); 263 visitor->trace(m_selectFeatures);
267 } 264 }
268 265
269 DEFINE_TRACE_WRAPPERS(ElementShadowV0) {} 266 DEFINE_TRACE_WRAPPERS(ElementShadowV0) {}
270 267
271 } // namespace blink 268 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698