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" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } else if (defaultSlot && child.isTextNode()) { | 69 } else if (defaultSlot && child.isTextNode()) { |
70 assign(child, *defaultSlot); | 70 assign(child, *defaultSlot); |
71 } else { | 71 } else { |
72 detachNotAssignedNode(child); | 72 detachNotAssignedNode(child); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 // Update each slot's distribution in reverse tree order so that a child slo
t is visited before its parent slot. | 76 // Update each slot's distribution in reverse tree order so that a child slo
t is visited before its parent slot. |
77 for (auto slot = slots.rbegin(); slot != slots.rend(); ++slot) | 77 for (auto slot = slots.rbegin(); slot != slots.rend(); ++slot) |
78 (*slot)->updateDistributedNodesWithFallback(); | 78 (*slot)->updateDistributedNodesWithFallback(); |
| 79 for (const auto& slot : slots) |
| 80 slot->didUpdateDistribution(); |
79 } | 81 } |
80 | 82 |
81 void SlotAssignment::assign(Node& hostChild, HTMLSlotElement& slot) | 83 void SlotAssignment::assign(Node& hostChild, HTMLSlotElement& slot) |
82 { | 84 { |
83 ASSERT(hostChild.isSlotAssignable()); | 85 ASSERT(hostChild.isSlotAssignable()); |
84 m_assignment.add(&hostChild, &slot); | 86 m_assignment.add(&hostChild, &slot); |
85 slot.appendAssignedNode(hostChild); | 87 slot.appendAssignedNode(hostChild); |
86 if (isHTMLSlotElement(hostChild)) | 88 if (isHTMLSlotElement(hostChild)) |
87 slot.appendDistributedNodesFrom(toHTMLSlotElement(hostChild)); | 89 slot.appendDistributedNodesFrom(toHTMLSlotElement(hostChild)); |
88 else | 90 else |
89 slot.appendDistributedNode(hostChild); | 91 slot.appendDistributedNode(hostChild); |
90 if (slot.isChildOfV1ShadowHost()) | 92 if (slot.isChildOfV1ShadowHost()) |
91 slot.parentElementShadow()->setNeedsDistributionRecalc(); | 93 slot.parentElementShadow()->setNeedsDistributionRecalc(); |
92 } | 94 } |
93 | 95 |
94 DEFINE_TRACE(SlotAssignment) | 96 DEFINE_TRACE(SlotAssignment) |
95 { | 97 { |
96 #if ENABLE(OILPAN) | 98 #if ENABLE(OILPAN) |
97 visitor->trace(m_assignment); | 99 visitor->trace(m_assignment); |
98 #endif | 100 #endif |
99 } | 101 } |
100 | 102 |
101 } // namespace blink | 103 } // namespace blink |
OLD | NEW |