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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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) 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 bool InsertionPoint::isActive() const 142 bool InsertionPoint::isActive() const
143 { 143 {
144 if (!canBeActive()) 144 if (!canBeActive())
145 return false; 145 return false;
146 ShadowRoot* shadowRoot = containingShadowRoot(); 146 ShadowRoot* shadowRoot = containingShadowRoot();
147 ASSERT(shadowRoot); 147 ASSERT(shadowRoot);
148 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount( ) <= 1) 148 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount( ) <= 1)
149 return true; 149 return true;
150 150
151 // Slow path only when there are more than one shadow elements in a shadow t ree. That should be a rare case. 151 // Slow path only when there are more than one shadow elements in a shadow t ree. That should be a rare case.
152 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& insertionPoints = shadowRoot->descendantInsertionPoints(); 152 const HeapVector<Member<InsertionPoint>>& insertionPoints = shadowRoot->desc endantInsertionPoints();
153 for (size_t i = 0; i < insertionPoints.size(); ++i) { 153 for (size_t i = 0; i < insertionPoints.size(); ++i) {
154 InsertionPoint* point = insertionPoints[i].get(); 154 InsertionPoint* point = insertionPoints[i].get();
155 if (isHTMLShadowElement(*point)) 155 if (isHTMLShadowElement(*point))
156 return point == this; 156 return point == this;
157 } 157 }
158 return true; 158 return true;
159 } 159 }
160 160
161 bool InsertionPoint::isShadowInsertionPoint() const 161 bool InsertionPoint::isShadowInsertionPoint() const
162 { 162 {
163 return isHTMLShadowElement(*this) && isActive(); 163 return isHTMLShadowElement(*this) && isActive();
164 } 164 }
165 165
166 bool InsertionPoint::isContentInsertionPoint() const 166 bool InsertionPoint::isContentInsertionPoint() const
167 { 167 {
168 return isHTMLContentElement(*this) && isActive(); 168 return isHTMLContentElement(*this) && isActive();
169 } 169 }
170 170
171 PassRefPtrWillBeRawPtr<StaticNodeList> InsertionPoint::getDistributedNodes() 171 RawPtr<StaticNodeList> InsertionPoint::getDistributedNodes()
172 { 172 {
173 updateDistribution(); 173 updateDistribution();
174 174
175 WillBeHeapVector<RefPtrWillBeMember<Node>> nodes; 175 HeapVector<Member<Node>> nodes;
176 nodes.reserveInitialCapacity(m_distributedNodes.size()); 176 nodes.reserveInitialCapacity(m_distributedNodes.size());
177 for (size_t i = 0; i < m_distributedNodes.size(); ++i) 177 for (size_t i = 0; i < m_distributedNodes.size(); ++i)
178 nodes.uncheckedAppend(m_distributedNodes.at(i)); 178 nodes.uncheckedAppend(m_distributedNodes.at(i));
179 179
180 return StaticNodeList::adopt(nodes); 180 return StaticNodeList::adopt(nodes);
181 } 181 }
182 182
183 bool InsertionPoint::layoutObjectIsNeeded(const ComputedStyle& style) 183 bool InsertionPoint::layoutObjectIsNeeded(const ComputedStyle& style)
184 { 184 {
185 return !isActive() && HTMLElement::layoutObjectIsNeeded(style); 185 return !isActive() && HTMLElement::layoutObjectIsNeeded(style);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 const InsertionPoint* insertedTo = shadow->finalDestinationInsertionPoin tFor(projectedNode); 266 const InsertionPoint* insertedTo = shadow->finalDestinationInsertionPoin tFor(projectedNode);
267 if (!insertedTo) 267 if (!insertedTo)
268 break; 268 break;
269 ASSERT(current != insertedTo); 269 ASSERT(current != insertedTo);
270 current = insertedTo; 270 current = insertedTo;
271 insertionPoint = insertedTo; 271 insertionPoint = insertedTo;
272 } 272 }
273 return insertionPoint; 273 return insertionPoint;
274 } 274 }
275 275
276 void collectDestinationInsertionPoints(const Node& node, WillBeHeapVector<RawPtr WillBeMember<InsertionPoint>, 8>& results) 276 void collectDestinationInsertionPoints(const Node& node, HeapVector<Member<Inser tionPoint>, 8>& results)
277 { 277 {
278 const Node* current = &node; 278 const Node* current = &node;
279 ElementShadow* lastElementShadow = 0; 279 ElementShadow* lastElementShadow = 0;
280 while (true) { 280 while (true) {
281 ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current); 281 ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current);
282 if (!shadow || shadow == lastElementShadow) 282 if (!shadow || shadow == lastElementShadow)
283 return; 283 return;
284 lastElementShadow = shadow; 284 lastElementShadow = shadow;
285 const DestinationInsertionPoints* insertionPoints = shadow->destinationI nsertionPointsFor(&node); 285 const DestinationInsertionPoints* insertionPoints = shadow->destinationI nsertionPointsFor(&node);
286 if (!insertionPoints) 286 if (!insertionPoints)
287 return; 287 return;
288 for (size_t i = 0; i < insertionPoints->size(); ++i) 288 for (size_t i = 0; i < insertionPoints->size(); ++i)
289 results.append(insertionPoints->at(i).get()); 289 results.append(insertionPoints->at(i).get());
290 ASSERT(current != insertionPoints->last().get()); 290 ASSERT(current != insertionPoints->last().get());
291 current = insertionPoints->last().get(); 291 current = insertionPoints->last().get();
292 } 292 }
293 } 293 }
294 294
295 } // namespace blink 295 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698