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

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

Issue 1489433002: Support the essential part of Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert Internals.* Created 5 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 { 64 {
65 detachNonDistributedNodes(); 65 detachNonDistributedNodes();
66 m_nodes.clear(); 66 m_nodes.clear();
67 m_distributed.clear(); 67 m_distributed.clear();
68 } 68 }
69 69
70 inline void DistributionPool::populateChildren(const ContainerNode& parent) 70 inline void DistributionPool::populateChildren(const ContainerNode& parent)
71 { 71 {
72 clear(); 72 clear();
73 for (Node* child = parent.firstChild(); child; child = child->nextSibling()) { 73 for (Node* child = parent.firstChild(); child; child = child->nextSibling()) {
74 if (isHTMLSlotElement(child)) {
75 // TODO(hayato): Support re-distribution across v0 and v1 shadow tre es
76 continue;
77 }
74 if (isActiveInsertionPoint(*child)) { 78 if (isActiveInsertionPoint(*child)) {
75 InsertionPoint* insertionPoint = toInsertionPoint(child); 79 InsertionPoint* insertionPoint = toInsertionPoint(child);
76 for (size_t i = 0; i < insertionPoint->distributedNodesSize(); ++i) 80 for (size_t i = 0; i < insertionPoint->distributedNodesSize(); ++i)
77 m_nodes.append(insertionPoint->distributedNodeAt(i)); 81 m_nodes.append(insertionPoint->distributedNodeAt(i));
78 } else { 82 } else {
79 m_nodes.append(child); 83 m_nodes.append(child);
80 } 84 }
81 } 85 }
82 m_distributed.resize(m_nodes.size()); 86 m_distributed.resize(m_nodes.size());
83 m_distributed.fill(false); 87 m_distributed.fill(false);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot( shadowInsertionPoint); 325 root->olderShadowRoot()->setShadowInsertionPointOfYoungerShadowRoot( shadowInsertionPoint);
322 } 326 }
323 if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*shadowInser tionPoint)) 327 if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*shadowInser tionPoint))
324 shadow->setNeedsDistributionRecalc(); 328 shadow->setNeedsDistributionRecalc();
325 } 329 }
326 InspectorInstrumentation::didPerformElementShadowDistribution(host()); 330 InspectorInstrumentation::didPerformElementShadowDistribution(host());
327 } 331 }
328 332
329 void ElementShadow::distributeV1() 333 void ElementShadow::distributeV1()
330 { 334 {
331 // TODO(hayato): Implement this 335 if (!m_slotAssignment)
336 m_slotAssignment = adoptPtr(new SlotAssignment());
337 m_slotAssignment->resolveAssignment(youngestShadowRoot());
332 } 338 }
333 339
334 void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertio nPoint) 340 void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertio nPoint)
335 { 341 {
336 #if ENABLE(OILPAN) 342 #if ENABLE(OILPAN)
337 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, nullptr); 343 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, nullptr);
338 if (result.isNewEntry) 344 if (result.isNewEntry)
339 result.storedValue->value = adoptPtrWillBeNoop(new DestinationInsertionP oints()); 345 result.storedValue->value = adoptPtrWillBeNoop(new DestinationInsertionP oints());
340 result.storedValue->value->append(insertionPoint); 346 result.storedValue->value->append(insertionPoint);
341 #else 347 #else
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 visitor->trace(m_nodeToInsertionPoints); 401 visitor->trace(m_nodeToInsertionPoints);
396 visitor->trace(m_selectFeatures); 402 visitor->trace(m_selectFeatures);
397 // Shadow roots are linked with previous and next pointers which are traced. 403 // Shadow roots are linked with previous and next pointers which are traced.
398 // It is therefore enough to trace one of the shadow roots here and the 404 // It is therefore enough to trace one of the shadow roots here and the
399 // rest will be traced from there. 405 // rest will be traced from there.
400 visitor->trace(m_shadowRoots.head()); 406 visitor->trace(m_shadowRoots.head());
401 #endif 407 #endif
402 } 408 }
403 409
404 } // namespace 410 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ElementShadow.h ('k') | third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698