| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/shadow/SlotAssignment.h" | 5 #include "core/dom/shadow/SlotAssignment.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/dom/ElementTraversal.h" | 8 #include "core/dom/ElementTraversal.h" |
| 9 #include "core/dom/NodeTraversal.h" | 9 #include "core/dom/NodeTraversal.h" |
| 10 #include "core/dom/shadow/ElementShadow.h" | 10 #include "core/dom/shadow/ElementShadow.h" |
| 11 #include "core/dom/shadow/InsertionPoint.h" | 11 #include "core/dom/shadow/InsertionPoint.h" |
| 12 #include "core/dom/shadow/ShadowRoot.h" | 12 #include "core/dom/shadow/ShadowRoot.h" |
| 13 #include "core/html/HTMLSlotElement.h" | 13 #include "core/html/HTMLSlotElement.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 |
| 18 SlotAssignment::SlotAssignment() |
| 19 : m_descendantSlotCount(0) |
| 20 { |
| 21 } |
| 22 |
| 17 HTMLSlotElement* SlotAssignment::assignedSlotFor(const Node& node) const | 23 HTMLSlotElement* SlotAssignment::assignedSlotFor(const Node& node) const |
| 18 { | 24 { |
| 19 return m_assignment.get(const_cast<Node*>(&node)); | 25 return m_assignment.get(const_cast<Node*>(&node)); |
| 20 } | 26 } |
| 21 | 27 |
| 22 static void detachNotAssignedNode(Node& node) | 28 static void detachNotAssignedNode(Node& node) |
| 23 { | 29 { |
| 24 if (node.layoutObject()) | 30 if (node.layoutObject()) |
| 25 node.lazyReattachIfAttached(); | 31 node.lazyReattachIfAttached(); |
| 26 } | 32 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 slot.appendDistributedNodesFrom(toHTMLSlotElement(hostChild)); | 106 slot.appendDistributedNodesFrom(toHTMLSlotElement(hostChild)); |
| 101 else | 107 else |
| 102 slot.appendDistributedNode(hostChild); | 108 slot.appendDistributedNode(hostChild); |
| 103 | 109 |
| 104 if (slot.isChildOfV1ShadowHost()) | 110 if (slot.isChildOfV1ShadowHost()) |
| 105 slot.parentElementShadow()->setNeedsDistributionRecalc(); | 111 slot.parentElementShadow()->setNeedsDistributionRecalc(); |
| 106 } | 112 } |
| 107 | 113 |
| 108 DEFINE_TRACE(SlotAssignment) | 114 DEFINE_TRACE(SlotAssignment) |
| 109 { | 115 { |
| 116 visitor->trace(m_descendantSlots); |
| 110 visitor->trace(m_assignment); | 117 visitor->trace(m_assignment); |
| 111 } | 118 } |
| 112 | 119 |
| 113 } // namespace blink | 120 } // namespace blink |
| OLD | NEW |