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 18 matching lines...) Expand all Loading... |
29 { | 29 { |
30 m_assignment.clear(); | 30 m_assignment.clear(); |
31 | 31 |
32 using Name2Slot = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<HTMLSlo
tElement>>; | 32 using Name2Slot = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<HTMLSlo
tElement>>; |
33 Name2Slot name2slot; | 33 Name2Slot name2slot; |
34 HTMLSlotElement* defaultSlot = nullptr; | 34 HTMLSlotElement* defaultSlot = nullptr; |
35 | 35 |
36 const WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>>& slots = shadowR
oot.descendantSlots(); | 36 const WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>>& slots = shadowR
oot.descendantSlots(); |
37 | 37 |
38 for (RefPtrWillBeMember<HTMLSlotElement> slot : slots) { | 38 for (RefPtrWillBeMember<HTMLSlotElement> slot : slots) { |
39 slot->clearDistribution(); | 39 slot->willUpdateDistribution(); |
40 AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr); | 40 AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr); |
41 if (name.isNull() || name.isEmpty()) { | 41 if (name.isNull() || name.isEmpty()) { |
42 if (!defaultSlot) | 42 if (!defaultSlot) |
43 defaultSlot = slot.get(); | 43 defaultSlot = slot.get(); |
44 } else { | 44 } else { |
45 name2slot.add(name, slot.get()); | 45 name2slot.add(name, slot.get()); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 for (Node& child : NodeTraversal::childrenOf(*shadowRoot.host())) { | 49 for (Node& child : NodeTraversal::childrenOf(*shadowRoot.host())) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 DEFINE_TRACE(SlotAssignment) | 96 DEFINE_TRACE(SlotAssignment) |
97 { | 97 { |
98 #if ENABLE(OILPAN) | 98 #if ENABLE(OILPAN) |
99 visitor->trace(m_assignment); | 99 visitor->trace(m_assignment); |
100 #endif | 100 #endif |
101 } | 101 } |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
OLD | NEW |