| OLD | NEW |
| 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 Loading... |
| 64 inline void DistributionPool::populateChildren(const ContainerNode& parent) { | 64 inline void DistributionPool::populateChildren(const ContainerNode& parent) { |
| 65 clear(); | 65 clear(); |
| 66 for (Node* child = parent.firstChild(); child; child = child->nextSibling()) { | 66 for (Node* child = parent.firstChild(); child; child = child->nextSibling()) { |
| 67 if (isHTMLSlotElement(child)) { | 67 if (isHTMLSlotElement(child)) { |
| 68 // TODO(hayato): Support re-distribution across v0 and v1 shadow trees | 68 // TODO(hayato): Support re-distribution across v0 and v1 shadow trees |
| 69 continue; | 69 continue; |
| 70 } | 70 } |
| 71 if (isActiveInsertionPoint(*child)) { | 71 if (isActiveInsertionPoint(*child)) { |
| 72 InsertionPoint* insertionPoint = toInsertionPoint(child); | 72 InsertionPoint* insertionPoint = toInsertionPoint(child); |
| 73 for (size_t i = 0; i < insertionPoint->distributedNodesSize(); ++i) | 73 for (size_t i = 0; i < insertionPoint->distributedNodesSize(); ++i) |
| 74 m_nodes.append(insertionPoint->distributedNodeAt(i)); | 74 m_nodes.push_back(insertionPoint->distributedNodeAt(i)); |
| 75 } else { | 75 } else { |
| 76 m_nodes.append(child); | 76 m_nodes.push_back(child); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 m_distributed.resize(m_nodes.size()); | 79 m_distributed.resize(m_nodes.size()); |
| 80 m_distributed.fill(false); | 80 m_distributed.fill(false); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void DistributionPool::distributeTo(InsertionPoint* insertionPoint, | 83 void DistributionPool::distributeTo(InsertionPoint* insertionPoint, |
| 84 ElementShadowV0* elementShadow) { | 84 ElementShadowV0* elementShadow) { |
| 85 DistributedNodes distributedNodes; | 85 DistributedNodes distributedNodes; |
| 86 | 86 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 for (const auto& point : root->descendantInsertionPoints()) { | 167 for (const auto& point : root->descendantInsertionPoints()) { |
| 168 if (!point->isActive()) | 168 if (!point->isActive()) |
| 169 continue; | 169 continue; |
| 170 if (isHTMLShadowElement(*point)) { | 170 if (isHTMLShadowElement(*point)) { |
| 171 DCHECK(!shadowInsertionPoint); | 171 DCHECK(!shadowInsertionPoint); |
| 172 shadowInsertionPoint = toHTMLShadowElement(point); | 172 shadowInsertionPoint = toHTMLShadowElement(point); |
| 173 shadowInsertionPoints.append(shadowInsertionPoint); | 173 shadowInsertionPoints.push_back(shadowInsertionPoint); |
| 174 } else { | 174 } else { |
| 175 pool.distributeTo(point, this); | 175 pool.distributeTo(point, this); |
| 176 if (ElementShadow* shadow = | 176 if (ElementShadow* shadow = |
| 177 shadowWhereNodeCanBeDistributedForV0(*point)) | 177 shadowWhereNodeCanBeDistributedForV0(*point)) |
| 178 shadow->setNeedsDistributionRecalc(); | 178 shadow->setNeedsDistributionRecalc(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 for (size_t i = shadowInsertionPoints.size(); i > 0; --i) { | 183 for (size_t i = shadowInsertionPoints.size(); i > 0; --i) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 201 InspectorInstrumentation::didPerformElementShadowDistribution( | 201 InspectorInstrumentation::didPerformElementShadowDistribution( |
| 202 &m_elementShadow->host()); | 202 &m_elementShadow->host()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void ElementShadowV0::didDistributeNode(const Node* node, | 205 void ElementShadowV0::didDistributeNode(const Node* node, |
| 206 InsertionPoint* insertionPoint) { | 206 InsertionPoint* insertionPoint) { |
| 207 NodeToDestinationInsertionPoints::AddResult result = | 207 NodeToDestinationInsertionPoints::AddResult result = |
| 208 m_nodeToInsertionPoints.add(node, nullptr); | 208 m_nodeToInsertionPoints.add(node, nullptr); |
| 209 if (result.isNewEntry) | 209 if (result.isNewEntry) |
| 210 result.storedValue->value = new DestinationInsertionPoints; | 210 result.storedValue->value = new DestinationInsertionPoints; |
| 211 result.storedValue->value->append(insertionPoint); | 211 result.storedValue->value->push_back(insertionPoint); |
| 212 } | 212 } |
| 213 | 213 |
| 214 const SelectRuleFeatureSet& ElementShadowV0::ensureSelectFeatureSet() { | 214 const SelectRuleFeatureSet& ElementShadowV0::ensureSelectFeatureSet() { |
| 215 if (!m_needsSelectFeatureSet) | 215 if (!m_needsSelectFeatureSet) |
| 216 return m_selectFeatures; | 216 return m_selectFeatures; |
| 217 | 217 |
| 218 m_selectFeatures.clear(); | 218 m_selectFeatures.clear(); |
| 219 for (const ShadowRoot* root = &oldestShadowRoot(); root; | 219 for (const ShadowRoot* root = &oldestShadowRoot(); root; |
| 220 root = root->youngerShadowRoot()) | 220 root = root->youngerShadowRoot()) |
| 221 collectSelectFeatureSetFrom(*root); | 221 collectSelectFeatureSetFrom(*root); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 DEFINE_TRACE(ElementShadowV0) { | 260 DEFINE_TRACE(ElementShadowV0) { |
| 261 visitor->trace(m_elementShadow); | 261 visitor->trace(m_elementShadow); |
| 262 visitor->trace(m_nodeToInsertionPoints); | 262 visitor->trace(m_nodeToInsertionPoints); |
| 263 visitor->trace(m_selectFeatures); | 263 visitor->trace(m_selectFeatures); |
| 264 } | 264 } |
| 265 | 265 |
| 266 DEFINE_TRACE_WRAPPERS(ElementShadowV0) {} | 266 DEFINE_TRACE_WRAPPERS(ElementShadowV0) {} |
| 267 | 267 |
| 268 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |