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

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

Issue 277213004: Oilpan: add transition types to shadow DOM supporting objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use Member<const Node> Created 6 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
« no previous file with comments | « Source/core/dom/shadow/InsertionPoint.h ('k') | Source/core/dom/shadow/ShadowRoot.h » ('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) 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 { 145 {
146 if (!canBeActive()) 146 if (!canBeActive())
147 return false; 147 return false;
148 ShadowRoot* shadowRoot = containingShadowRoot(); 148 ShadowRoot* shadowRoot = containingShadowRoot();
149 if (!shadowRoot) 149 if (!shadowRoot)
150 return false; 150 return false;
151 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount( ) <= 1) 151 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount( ) <= 1)
152 return true; 152 return true;
153 153
154 // Slow path only when there are more than one shadow elements in a shadow t ree. That should be a rare case. 154 // Slow path only when there are more than one shadow elements in a shadow t ree. That should be a rare case.
155 const Vector<RefPtr<InsertionPoint> >& insertionPoints = shadowRoot->descend antInsertionPoints(); 155 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> >& insertionPoints = shadowRoot->descendantInsertionPoints();
156 for (size_t i = 0; i < insertionPoints.size(); ++i) { 156 for (size_t i = 0; i < insertionPoints.size(); ++i) {
157 InsertionPoint* point = insertionPoints[i].get(); 157 InsertionPoint* point = insertionPoints[i].get();
158 if (isHTMLShadowElement(*point)) 158 if (isHTMLShadowElement(*point))
159 return point == this; 159 return point == this;
160 } 160 }
161 return true; 161 return true;
162 } 162 }
163 163
164 bool InsertionPoint::isShadowInsertionPoint() const 164 bool InsertionPoint::isShadowInsertionPoint() const
165 { 165 {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 root->didRemoveInsertionPoint(this); 238 root->didRemoveInsertionPoint(this);
239 if (rootOwner) { 239 if (rootOwner) {
240 if (canAffectSelector()) 240 if (canAffectSelector())
241 rootOwner->willAffectSelector(); 241 rootOwner->willAffectSelector();
242 } 242 }
243 } 243 }
244 244
245 HTMLElement::removedFrom(insertionPoint); 245 HTMLElement::removedFrom(insertionPoint);
246 } 246 }
247 247
248 void InsertionPoint::trace(Visitor* visitor)
249 {
250 visitor->trace(m_distribution);
251 HTMLElement::trace(visitor);
252 }
253
248 const InsertionPoint* resolveReprojection(const Node* projectedNode) 254 const InsertionPoint* resolveReprojection(const Node* projectedNode)
249 { 255 {
250 ASSERT(projectedNode); 256 ASSERT(projectedNode);
251 const InsertionPoint* insertionPoint = 0; 257 const InsertionPoint* insertionPoint = 0;
252 const Node* current = projectedNode; 258 const Node* current = projectedNode;
253 ElementShadow* lastElementShadow = 0; 259 ElementShadow* lastElementShadow = 0;
254 while (true) { 260 while (true) {
255 ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current); 261 ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current);
256 if (!shadow || shadow == lastElementShadow) 262 if (!shadow || shadow == lastElementShadow)
257 break; 263 break;
258 lastElementShadow = shadow; 264 lastElementShadow = shadow;
259 const InsertionPoint* insertedTo = shadow->finalDestinationInsertionPoin tFor(projectedNode); 265 const InsertionPoint* insertedTo = shadow->finalDestinationInsertionPoin tFor(projectedNode);
260 if (!insertedTo) 266 if (!insertedTo)
261 break; 267 break;
262 ASSERT(current != insertedTo); 268 ASSERT(current != insertedTo);
263 current = insertedTo; 269 current = insertedTo;
264 insertionPoint = insertedTo; 270 insertionPoint = insertedTo;
265 } 271 }
266 return insertionPoint; 272 return insertionPoint;
267 } 273 }
268 274
269 void collectDestinationInsertionPoints(const Node& node, Vector<InsertionPoint*, 8>& results) 275 void collectDestinationInsertionPoints(const Node& node, WillBeHeapVector<RawPtr WillBeMember<InsertionPoint>, 8>& results)
270 { 276 {
271 const Node* current = &node; 277 const Node* current = &node;
272 ElementShadow* lastElementShadow = 0; 278 ElementShadow* lastElementShadow = 0;
273 while (true) { 279 while (true) {
274 ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current); 280 ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current);
275 if (!shadow || shadow == lastElementShadow) 281 if (!shadow || shadow == lastElementShadow)
276 return; 282 return;
277 lastElementShadow = shadow; 283 lastElementShadow = shadow;
278 const DestinationInsertionPoints* insertionPoints = shadow->destinationI nsertionPointsFor(&node); 284 const DestinationInsertionPoints* insertionPoints = shadow->destinationI nsertionPointsFor(&node);
279 if (!insertionPoints) 285 if (!insertionPoints)
280 return; 286 return;
281 for (size_t i = 0; i < insertionPoints->size(); ++i) 287 for (size_t i = 0; i < insertionPoints->size(); ++i)
282 results.append(insertionPoints->at(i).get()); 288 results.append(insertionPoints->at(i).get());
283 ASSERT(current != insertionPoints->last().get()); 289 ASSERT(current != insertionPoints->last().get());
284 current = insertionPoints->last().get(); 290 current = insertionPoints->last().get();
285 } 291 }
286 } 292 }
287 293
288 } // namespace WebCore 294 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/InsertionPoint.h ('k') | Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698