| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/dom/shadow/InsertionPoint.h" | 36 #include "core/dom/shadow/InsertionPoint.h" |
| 37 #include "core/html/AssignedNodesOptions.h" | 37 #include "core/html/AssignedNodesOptions.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 using namespace HTMLNames; | 41 using namespace HTMLNames; |
| 42 | 42 |
| 43 inline HTMLSlotElement::HTMLSlotElement(Document& document) | 43 inline HTMLSlotElement::HTMLSlotElement(Document& document) |
| 44 : HTMLElement(slotTag, document) | 44 : HTMLElement(slotTag, document) |
| 45 { | 45 { |
| 46 setHasCustomStyleCallbacks(); | |
| 47 } | 46 } |
| 48 | 47 |
| 49 DEFINE_NODE_FACTORY(HTMLSlotElement); | 48 DEFINE_NODE_FACTORY(HTMLSlotElement); |
| 50 | 49 |
| 51 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod
esForBinding(const AssignedNodesOptions& options) | 50 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod
esForBinding(const AssignedNodesOptions& options) |
| 52 { | 51 { |
| 53 updateDistribution(); | 52 updateDistribution(); |
| 54 if (options.hasFlatten() && options.flatten()) | 53 if (options.hasFlatten() && options.flatten()) |
| 55 return getDistributedNodes(); | 54 return getDistributedNodes(); |
| 56 return m_assignedNodes; | 55 return m_assignedNodes; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 194 |
| 196 // 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. |
| 197 clearDistribution(); | 196 clearDistribution(); |
| 198 | 197 |
| 199 if (root == insertionPoint->treeScope().rootNode()) | 198 if (root == insertionPoint->treeScope().rootNode()) |
| 200 root->didRemoveSlot(); | 199 root->didRemoveSlot(); |
| 201 | 200 |
| 202 HTMLElement::removedFrom(insertionPoint); | 201 HTMLElement::removedFrom(insertionPoint); |
| 203 } | 202 } |
| 204 | 203 |
| 205 void HTMLSlotElement::willRecalcStyle(StyleRecalcChange change) | |
| 206 { | |
| 207 if (change < Inherit && styleChangeType() < SubtreeStyleChange) | |
| 208 return; | |
| 209 | |
| 210 for (Node* node : m_distributedNodes) | |
| 211 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing:
:create(StyleChangeReason::PropagateInheritChangeToDistributedNodes)); | |
| 212 } | |
| 213 | |
| 214 void HTMLSlotElement::updateDistributedNodesWithFallback() | 204 void HTMLSlotElement::updateDistributedNodesWithFallback() |
| 215 { | 205 { |
| 216 if (!m_distributedNodes.isEmpty()) | 206 if (!m_distributedNodes.isEmpty()) |
| 217 return; | 207 return; |
| 218 for (auto& child : NodeTraversal::childrenOf(*this)) { | 208 for (auto& child : NodeTraversal::childrenOf(*this)) { |
| 219 if (!child.isSlotAssignable()) | 209 if (!child.isSlotAssignable()) |
| 220 continue; | 210 continue; |
| 221 // Insertion points are not supported as slots fallback | 211 // Insertion points are not supported as slots fallback |
| 222 if (isActiveInsertionPoint(child)) | 212 if (isActiveInsertionPoint(child)) |
| 223 continue; | 213 continue; |
| 224 if (isHTMLSlotElement(child)) | 214 if (isHTMLSlotElement(child)) |
| 225 appendDistributedNodesFrom(toHTMLSlotElement(child)); | 215 appendDistributedNodesFrom(toHTMLSlotElement(child)); |
| 226 else | 216 else |
| 227 appendDistributedNode(child); | 217 appendDistributedNode(child); |
| 228 } | 218 } |
| 229 } | 219 } |
| 230 | 220 |
| 231 DEFINE_TRACE(HTMLSlotElement) | 221 DEFINE_TRACE(HTMLSlotElement) |
| 232 { | 222 { |
| 233 #if ENABLE(OILPAN) | 223 #if ENABLE(OILPAN) |
| 234 visitor->trace(m_assignedNodes); | 224 visitor->trace(m_assignedNodes); |
| 235 visitor->trace(m_distributedNodes); | 225 visitor->trace(m_distributedNodes); |
| 236 visitor->trace(m_distributedIndices); | 226 visitor->trace(m_distributedIndices); |
| 237 #endif | 227 #endif |
| 238 HTMLElement::trace(visitor); | 228 HTMLElement::trace(visitor); |
| 239 } | 229 } |
| 240 | 230 |
| 241 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |