| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 void InsertionPoint::insertedInto(ContainerNode* insertionPoint) | 165 void InsertionPoint::insertedInto(ContainerNode* insertionPoint) |
| 166 { | 166 { |
| 167 HTMLElement::insertedInto(insertionPoint); | 167 HTMLElement::insertedInto(insertionPoint); |
| 168 if (ShadowRoot* root = containingShadowRoot()) { | 168 if (ShadowRoot* root = containingShadowRoot()) { |
| 169 if (ElementShadow* rootOwner = root->owner()) { | 169 if (ElementShadow* rootOwner = root->owner()) { |
| 170 rootOwner->setNeedsDistributionRecalc(); | 170 rootOwner->setNeedsDistributionRecalc(); |
| 171 if (canBeActive() && !m_registeredWithShadowRoot && insertionPoint->
treeScope().rootNode() == root) { | 171 if (canBeActive() && !m_registeredWithShadowRoot && insertionPoint->
treeScope().rootNode() == root) { |
| 172 m_registeredWithShadowRoot = true; | 172 m_registeredWithShadowRoot = true; |
| 173 root->didAddInsertionPoint(this); | 173 root->didAddInsertionPoint(); |
| 174 if (canAffectSelector()) | 174 if (canAffectSelector()) |
| 175 rootOwner->willAffectSelector(); | 175 rootOwner->willAffectSelector(); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) | 181 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) |
| 182 { | 182 { |
| 183 ShadowRoot* root = containingShadowRoot(); | 183 ShadowRoot* root = containingShadowRoot(); |
| 184 if (!root) | 184 if (!root) |
| 185 root = insertionPoint->containingShadowRoot(); | 185 root = insertionPoint->containingShadowRoot(); |
| 186 | 186 |
| 187 if (root) { | 187 if (root) { |
| 188 if (ElementShadow* rootOwner = root->owner()) | 188 if (ElementShadow* rootOwner = root->owner()) |
| 189 rootOwner->setNeedsDistributionRecalc(); | 189 rootOwner->setNeedsDistributionRecalc(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // host can be null when removedFrom() is called from ElementShadow destruct
or. | 192 // host can be null when removedFrom() is called from ElementShadow destruct
or. |
| 193 ElementShadow* rootOwner = root ? root->owner() : 0; | 193 ElementShadow* rootOwner = root ? root->owner() : 0; |
| 194 | 194 |
| 195 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. | 195 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. |
| 196 clearDistribution(); | 196 clearDistribution(); |
| 197 | 197 |
| 198 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() ==
root) { | 198 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() ==
root) { |
| 199 ASSERT(root); | 199 ASSERT(root); |
| 200 m_registeredWithShadowRoot = false; | 200 m_registeredWithShadowRoot = false; |
| 201 root->didRemoveInsertionPoint(this); | 201 root->didRemoveInsertionPoint(); |
| 202 if (rootOwner) { | 202 if (rootOwner) { |
| 203 if (canAffectSelector()) | 203 if (canAffectSelector()) |
| 204 rootOwner->willAffectSelector(); | 204 rootOwner->willAffectSelector(); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 HTMLElement::removedFrom(insertionPoint); | 208 HTMLElement::removedFrom(insertionPoint); |
| 209 } | 209 } |
| 210 | 210 |
| 211 const InsertionPoint* resolveReprojection(const Node* projectedNode) | 211 const InsertionPoint* resolveReprojection(const Node* projectedNode) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 242 if (!insertionPoints) | 242 if (!insertionPoints) |
| 243 return; | 243 return; |
| 244 for (size_t i = 0; i < insertionPoints->size(); ++i) | 244 for (size_t i = 0; i < insertionPoints->size(); ++i) |
| 245 results.append(insertionPoints->at(i).get()); | 245 results.append(insertionPoints->at(i).get()); |
| 246 ASSERT(current != insertionPoints->last().get()); | 246 ASSERT(current != insertionPoints->last().get()); |
| 247 current = insertionPoints->last().get(); | 247 current = insertionPoints->last().get(); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |