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

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

Issue 1408203003: Disable insertion points in v1 shadow trees. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v1-youngest-shadow-root-ref
Patch Set: remove expectations Created 5 years, 2 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 NodeToDestinationInsertionPoints::const_iterator it = m_nodeToInsertionPoint s.find(key); 269 NodeToDestinationInsertionPoints::const_iterator it = m_nodeToInsertionPoint s.find(key);
270 #if ENABLE(OILPAN) 270 #if ENABLE(OILPAN)
271 return it == m_nodeToInsertionPoints.end() ? nullptr : it->value.get(); 271 return it == m_nodeToInsertionPoints.end() ? nullptr : it->value.get();
272 #else 272 #else
273 return it == m_nodeToInsertionPoints.end() ? nullptr : &it->value; 273 return it == m_nodeToInsertionPoints.end() ? nullptr : &it->value;
274 #endif 274 #endif
275 } 275 }
276 276
277 void ElementShadow::distribute() 277 void ElementShadow::distribute()
278 { 278 {
279 if (isV1())
280 distributeV1();
281 else
282 distributeV0();
283 }
284
285 void ElementShadow::distributeV0()
286 {
279 host()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :create(StyleChangeReason::Shadow)); 287 host()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :create(StyleChangeReason::Shadow));
280 WillBeHeapVector<RawPtrWillBeMember<HTMLShadowElement>, 32> shadowInsertionP oints; 288 WillBeHeapVector<RawPtrWillBeMember<HTMLShadowElement>, 32> shadowInsertionP oints;
281 DistributionPool pool(*host()); 289 DistributionPool pool(*host());
282 290
283 for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShado wRoot()) { 291 for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShado wRoot()) {
284 HTMLShadowElement* shadowInsertionPoint = 0; 292 HTMLShadowElement* shadowInsertionPoint = 0;
285 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& insertionPoi nts = root->descendantInsertionPoints(); 293 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& insertionPoi nts = root->descendantInsertionPoints();
286 for (size_t i = 0; i < insertionPoints.size(); ++i) { 294 for (size_t i = 0; i < insertionPoints.size(); ++i) {
287 InsertionPoint* point = insertionPoints[i].get(); 295 InsertionPoint* point = insertionPoints[i].get();
288 if (!point->isActive()) 296 if (!point->isActive())
(...skipping 22 matching lines...) Expand all
311 DistributionPool olderShadowRootPool(*root->olderShadowRoot()); 319 DistributionPool olderShadowRootPool(*root->olderShadowRoot());
312 olderShadowRootPool.distributeTo(shadowInsertionPoint, this); 320 olderShadowRootPool.distributeTo(shadowInsertionPoint, this);
313 root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot( shadowInsertionPoint); 321 root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot( shadowInsertionPoint);
314 } 322 }
315 if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*shadowInser tionPoint)) 323 if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*shadowInser tionPoint))
316 shadow->setNeedsDistributionRecalc(); 324 shadow->setNeedsDistributionRecalc();
317 } 325 }
318 InspectorInstrumentation::didPerformElementShadowDistribution(host()); 326 InspectorInstrumentation::didPerformElementShadowDistribution(host());
319 } 327 }
320 328
329 void ElementShadow::distributeV1()
330 {
331 // TODO(hayato): Implement this
332 }
333
321 void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertio nPoint) 334 void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertio nPoint)
322 { 335 {
323 #if ENABLE(OILPAN) 336 #if ENABLE(OILPAN)
324 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, nullptr); 337 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, nullptr);
325 if (result.isNewEntry) 338 if (result.isNewEntry)
326 result.storedValue->value = adoptPtrWillBeNoop(new DestinationInsertionP oints()); 339 result.storedValue->value = adoptPtrWillBeNoop(new DestinationInsertionP oints());
327 result.storedValue->value->append(insertionPoint); 340 result.storedValue->value->append(insertionPoint);
328 #else 341 #else
329 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, DestinationInsertionPoints()); 342 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, DestinationInsertionPoints());
330 result.storedValue->value.append(insertionPoint); 343 result.storedValue->value.append(insertionPoint);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 visitor->trace(m_nodeToInsertionPoints); 395 visitor->trace(m_nodeToInsertionPoints);
383 visitor->trace(m_selectFeatures); 396 visitor->trace(m_selectFeatures);
384 // Shadow roots are linked with previous and next pointers which are traced. 397 // Shadow roots are linked with previous and next pointers which are traced.
385 // It is therefore enough to trace one of the shadow roots here and the 398 // It is therefore enough to trace one of the shadow roots here and the
386 // rest will be traced from there. 399 // rest will be traced from there.
387 visitor->trace(m_shadowRoots.head()); 400 visitor->trace(m_shadowRoots.head());
388 #endif 401 #endif
389 } 402 }
390 403
391 } // namespace 404 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698