| 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/InsertionPoint.h" | 10 #include "core/dom/shadow/InsertionPoint.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static void detachNotAssignedNode(Node& node) | 21 static void detachNotAssignedNode(Node& node) |
| 22 { | 22 { |
| 23 if (node.layoutObject()) | 23 if (node.layoutObject()) |
| 24 node.lazyReattachIfAttached(); | 24 node.lazyReattachIfAttached(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot) | 27 void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot) |
| 28 { | 28 { |
| 29 m_assignment.clear(); | 29 m_assignment.clear(); |
| 30 | 30 |
| 31 using Name2Slot = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<HTMLSlo
tElement>>; | 31 using Name2Slot = HeapHashMap<AtomicString, Member<HTMLSlotElement>>; |
| 32 Name2Slot name2slot; | 32 Name2Slot name2slot; |
| 33 HTMLSlotElement* defaultSlot = nullptr; | 33 HTMLSlotElement* defaultSlot = nullptr; |
| 34 | 34 |
| 35 const WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>>& slots = shadowR
oot.descendantSlots(); | 35 const HeapVector<Member<HTMLSlotElement>>& slots = shadowRoot.descendantSlot
s(); |
| 36 | 36 |
| 37 for (RefPtrWillBeMember<HTMLSlotElement> slot : slots) { | 37 for (Member<HTMLSlotElement> slot : slots) { |
| 38 slot->clearDistribution(); | 38 slot->clearDistribution(); |
| 39 AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr); | 39 AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr); |
| 40 if (name.isNull() || name.isEmpty()) { | 40 if (name.isNull() || name.isEmpty()) { |
| 41 if (!defaultSlot) | 41 if (!defaultSlot) |
| 42 defaultSlot = slot.get(); | 42 defaultSlot = slot.get(); |
| 43 } else { | 43 } else { |
| 44 name2slot.add(name, slot.get()); | 44 name2slot.add(name, slot.get()); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 DEFINE_TRACE(SlotAssignment) | 91 DEFINE_TRACE(SlotAssignment) |
| 92 { | 92 { |
| 93 #if ENABLE(OILPAN) | 93 #if ENABLE(OILPAN) |
| 94 visitor->trace(m_assignment); | 94 visitor->trace(m_assignment); |
| 95 #endif | 95 #endif |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace blink | 98 } // namespace blink |
| OLD | NEW |