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