| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 rootOwner->setNeedsDistributionRecalc(); | 194 rootOwner->setNeedsDistributionRecalc(); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* i
nsertionPoint) | 198 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* i
nsertionPoint) |
| 199 { | 199 { |
| 200 HTMLElement::insertedInto(insertionPoint); | 200 HTMLElement::insertedInto(insertionPoint); |
| 201 if (ShadowRoot* root = containingShadowRoot()) { | 201 if (ShadowRoot* root = containingShadowRoot()) { |
| 202 if (ElementShadow* rootOwner = root->owner()) { | 202 if (ElementShadow* rootOwner = root->owner()) { |
| 203 rootOwner->setNeedsDistributionRecalc(); | 203 rootOwner->setNeedsDistributionRecalc(); |
| 204 if (canBeActive() && !m_registeredWithShadowRoot && insertionPoint->
treeScope().rootNode() == root) { | 204 if (canBeActive() && !m_registeredWithShadowRoot && insertionPoint->
treeScopeOrDocument().rootNode() == root) { |
| 205 m_registeredWithShadowRoot = true; | 205 m_registeredWithShadowRoot = true; |
| 206 root->didAddInsertionPoint(this); | 206 root->didAddInsertionPoint(this); |
| 207 if (canAffectSelector()) | 207 if (canAffectSelector()) |
| 208 rootOwner->willAffectSelector(); | 208 rootOwner->willAffectSelector(); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 // We could have been distributed into in a detached subtree, make sure to | 213 // We could have been distributed into in a detached subtree, make sure to |
| 214 // clear the distribution when inserted again to avoid cycles. | 214 // clear the distribution when inserted again to avoid cycles. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 227 if (ElementShadow* rootOwner = root->owner()) | 227 if (ElementShadow* rootOwner = root->owner()) |
| 228 rootOwner->setNeedsDistributionRecalc(); | 228 rootOwner->setNeedsDistributionRecalc(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // host can be null when removedFrom() is called from ElementShadow destruct
or. | 231 // host can be null when removedFrom() is called from ElementShadow destruct
or. |
| 232 ElementShadow* rootOwner = root ? root->owner() : 0; | 232 ElementShadow* rootOwner = root ? root->owner() : 0; |
| 233 | 233 |
| 234 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. | 234 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. |
| 235 clearDistribution(); | 235 clearDistribution(); |
| 236 | 236 |
| 237 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() ==
root) { | 237 if (m_registeredWithShadowRoot && insertionPoint->treeScopeOrDocument().root
Node() == root) { |
| 238 DCHECK(root); | 238 DCHECK(root); |
| 239 m_registeredWithShadowRoot = false; | 239 m_registeredWithShadowRoot = false; |
| 240 root->didRemoveInsertionPoint(this); | 240 root->didRemoveInsertionPoint(this); |
| 241 if (rootOwner) { | 241 if (rootOwner) { |
| 242 if (canAffectSelector()) | 242 if (canAffectSelector()) |
| 243 rootOwner->willAffectSelector(); | 243 rootOwner->willAffectSelector(); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 HTMLElement::removedFrom(insertionPoint); | 247 HTMLElement::removedFrom(insertionPoint); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 DCHECK_NE(current, insertionPoints->last().get()); | 291 DCHECK_NE(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 |