| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/dom/shadow/InsertionPoint.h" | 32 #include "core/dom/shadow/InsertionPoint.h" |
| 33 | 33 |
| 34 #include "HTMLNames.h" | 34 #include "HTMLNames.h" |
| 35 #include "core/dom/QualifiedName.h" | 35 #include "core/dom/QualifiedName.h" |
| 36 #include "core/dom/StaticNodeList.h" | 36 #include "core/dom/StaticNodeList.h" |
| 37 #include "core/dom/shadow/ElementShadow.h" | 37 #include "core/dom/shadow/ElementShadow.h" |
| 38 #include "core/dom/shadow/ScopeContentDistribution.h" |
| 38 #include "core/dom/shadow/ShadowRoot.h" | 39 #include "core/dom/shadow/ShadowRoot.h" |
| 39 | 40 |
| 40 namespace WebCore { | 41 namespace WebCore { |
| 41 | 42 |
| 42 using namespace HTMLNames; | 43 using namespace HTMLNames; |
| 43 | 44 |
| 44 InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document) | 45 InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document) |
| 45 : HTMLElement(tagName, document, CreateInsertionPoint) | 46 : HTMLElement(tagName, document, CreateInsertionPoint) |
| 46 , m_registeredWithShadowRoot(false) | 47 , m_registeredWithShadowRoot(false) |
| 47 { | 48 { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 setBooleanAttribute(reset_style_inheritanceAttr, value); | 244 setBooleanAttribute(reset_style_inheritanceAttr, value); |
| 244 } | 245 } |
| 245 | 246 |
| 246 InsertionPoint* resolveReprojection(const Node* projectedNode) | 247 InsertionPoint* resolveReprojection(const Node* projectedNode) |
| 247 { | 248 { |
| 248 InsertionPoint* insertionPoint = 0; | 249 InsertionPoint* insertionPoint = 0; |
| 249 const Node* current = projectedNode; | 250 const Node* current = projectedNode; |
| 250 | 251 |
| 251 while (current) { | 252 while (current) { |
| 252 if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { | 253 if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { |
| 253 if (InsertionPoint* insertedTo = shadow->distributor().findInsertion
PointFor(projectedNode)) { | 254 if (InsertionPoint* insertedTo = shadow->findInsertionPointFor(proje
ctedNode)) { |
| 254 current = insertedTo; | 255 current = insertedTo; |
| 255 insertionPoint = insertedTo; | 256 insertionPoint = insertedTo; |
| 256 continue; | 257 continue; |
| 257 } | 258 } |
| 258 } | 259 } |
| 259 | 260 |
| 260 if (Node* parent = parentNodeForDistribution(current)) { | 261 if (Node* parent = parentNodeForDistribution(current)) { |
| 261 if (InsertionPoint* insertedTo = parent->isShadowRoot() ? toShadowRo
ot(parent)->insertionPoint() : 0) { | 262 if (InsertionPoint* insertedTo = parent->isShadowRoot() ? toShadowRo
ot(parent)->insertionPoint() : 0) { |
| 262 current = insertedTo; | 263 current = insertedTo; |
| 263 insertionPoint = insertedTo; | 264 insertionPoint = insertedTo; |
| 264 continue; | 265 continue; |
| 265 } | 266 } |
| 266 } | 267 } |
| 267 | 268 |
| 268 break; | 269 break; |
| 269 } | 270 } |
| 270 | 271 |
| 271 return insertionPoint; | 272 return insertionPoint; |
| 272 } | 273 } |
| 273 | 274 |
| 274 void collectInsertionPointsWhereNodeIsDistributed(const Node* node, Vector<Inser
tionPoint*, 8>& results) | 275 void collectInsertionPointsWhereNodeIsDistributed(const Node* node, Vector<Inser
tionPoint*, 8>& results) |
| 275 { | 276 { |
| 276 const Node* current = node; | 277 const Node* current = node; |
| 277 while (true) { | 278 while (true) { |
| 278 if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { | 279 if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { |
| 279 if (InsertionPoint* insertedTo = shadow->distributor().findInsertion
PointFor(node)) { | 280 if (InsertionPoint* insertedTo = shadow->findInsertionPointFor(node)
) { |
| 280 current = insertedTo; | 281 current = insertedTo; |
| 281 results.append(insertedTo); | 282 results.append(insertedTo); |
| 282 continue; | 283 continue; |
| 283 } | 284 } |
| 284 } | 285 } |
| 285 if (Node* parent = parentNodeForDistribution(current)) { | 286 if (Node* parent = parentNodeForDistribution(current)) { |
| 286 if (InsertionPoint* insertedTo = parent->isShadowRoot() ? toShadowRo
ot(parent)->insertionPoint() : 0) { | 287 if (InsertionPoint* insertedTo = parent->isShadowRoot() ? toShadowRo
ot(parent)->insertionPoint() : 0) { |
| 287 current = insertedTo; | 288 current = insertedTo; |
| 288 results.append(insertedTo); | 289 results.append(insertedTo); |
| 289 continue; | 290 continue; |
| 290 } | 291 } |
| 291 } | 292 } |
| 292 return; | 293 return; |
| 293 } | 294 } |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace WebCore | 297 } // namespace WebCore |
| OLD | NEW |