| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 rootOwner->setNeedsDistributionRecalc(); | 191 rootOwner->setNeedsDistributionRecalc(); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 Node::InsertionNotificationRequest HTMLSlotElement::insertedInto(ContainerNode*
insertionPoint) | 195 Node::InsertionNotificationRequest HTMLSlotElement::insertedInto(ContainerNode*
insertionPoint) |
| 196 { | 196 { |
| 197 HTMLElement::insertedInto(insertionPoint); | 197 HTMLElement::insertedInto(insertionPoint); |
| 198 if (ShadowRoot* root = containingShadowRoot()) { | 198 if (ShadowRoot* root = containingShadowRoot()) { |
| 199 if (ElementShadow* rootOwner = root->owner()) | 199 if (ElementShadow* rootOwner = root->owner()) |
| 200 rootOwner->setNeedsDistributionRecalc(); | 200 rootOwner->setNeedsDistributionRecalc(); |
| 201 if (root == insertionPoint->treeScope().rootNode()) | 201 if (root == insertionPoint->treeScopeOrDocument().rootNode()) |
| 202 root->didAddSlot(); | 202 root->didAddSlot(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 // We could have been distributed into in a detached subtree, make sure to | 205 // We could have been distributed into in a detached subtree, make sure to |
| 206 // clear the distribution when inserted again to avoid cycles. | 206 // clear the distribution when inserted again to avoid cycles. |
| 207 clearDistribution(); | 207 clearDistribution(); |
| 208 | 208 |
| 209 return InsertionDone; | 209 return InsertionDone; |
| 210 } | 210 } |
| 211 | 211 |
| 212 void HTMLSlotElement::removedFrom(ContainerNode* insertionPoint) | 212 void HTMLSlotElement::removedFrom(ContainerNode* insertionPoint) |
| 213 { | 213 { |
| 214 ShadowRoot* root = containingShadowRoot(); | 214 ShadowRoot* root = containingShadowRoot(); |
| 215 if (!root) | 215 if (!root) |
| 216 root = insertionPoint->containingShadowRoot(); | 216 root = insertionPoint->containingShadowRoot(); |
| 217 if (root) { | 217 if (root) { |
| 218 if (ElementShadow* rootOwner = root->owner()) | 218 if (ElementShadow* rootOwner = root->owner()) |
| 219 rootOwner->setNeedsDistributionRecalc(); | 219 rootOwner->setNeedsDistributionRecalc(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. | 222 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. |
| 223 clearDistribution(); | 223 clearDistribution(); |
| 224 | 224 |
| 225 if (root == insertionPoint->treeScope().rootNode()) | 225 if (root == insertionPoint->treeScopeOrDocument().rootNode()) |
| 226 root->didRemoveSlot(); | 226 root->didRemoveSlot(); |
| 227 | 227 |
| 228 HTMLElement::removedFrom(insertionPoint); | 228 HTMLElement::removedFrom(insertionPoint); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void HTMLSlotElement::willRecalcStyle(StyleRecalcChange change) | 231 void HTMLSlotElement::willRecalcStyle(StyleRecalcChange change) |
| 232 { | 232 { |
| 233 if (change < Inherit && getStyleChangeType() < SubtreeStyleChange) | 233 if (change < Inherit && getStyleChangeType() < SubtreeStyleChange) |
| 234 return; | 234 return; |
| 235 | 235 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 DEFINE_TRACE(HTMLSlotElement) | 292 DEFINE_TRACE(HTMLSlotElement) |
| 293 { | 293 { |
| 294 visitor->trace(m_assignedNodes); | 294 visitor->trace(m_assignedNodes); |
| 295 visitor->trace(m_distributedNodes); | 295 visitor->trace(m_distributedNodes); |
| 296 visitor->trace(m_distributedIndices); | 296 visitor->trace(m_distributedIndices); |
| 297 visitor->trace(m_oldDistributedNodes); | 297 visitor->trace(m_oldDistributedNodes); |
| 298 HTMLElement::trace(visitor); | 298 HTMLElement::trace(visitor); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |