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