| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 inline static bool isDefaultSlotName(const AtomicString& name) | 28 inline static bool isDefaultSlotName(const AtomicString& name) |
| 29 { | 29 { |
| 30 return name.isNull() || name.isEmpty(); | 30 return name.isNull() || name.isEmpty(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot) | 33 void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot) |
| 34 { | 34 { |
| 35 m_assignment.clear(); | 35 m_assignment.clear(); |
| 36 | 36 |
| 37 using Name2Slot = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<HTMLSlo
tElement>>; | 37 using Name2Slot = HeapHashMap<AtomicString, Member<HTMLSlotElement>>; |
| 38 Name2Slot name2slot; | 38 Name2Slot name2slot; |
| 39 HTMLSlotElement* defaultSlot = nullptr; | 39 HTMLSlotElement* defaultSlot = nullptr; |
| 40 | 40 |
| 41 const WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>>& slots = shadowR
oot.descendantSlots(); | 41 const HeapVector<Member<HTMLSlotElement>>& slots = shadowRoot.descendantSlot
s(); |
| 42 | 42 |
| 43 for (RefPtrWillBeMember<HTMLSlotElement> slot : slots) { | 43 for (Member<HTMLSlotElement> slot : slots) { |
| 44 slot->willUpdateDistribution(); | 44 slot->willUpdateDistribution(); |
| 45 AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr); | 45 AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr); |
| 46 if (isDefaultSlotName(name)) { | 46 if (isDefaultSlotName(name)) { |
| 47 if (!defaultSlot) | 47 if (!defaultSlot) |
| 48 defaultSlot = slot.get(); | 48 defaultSlot = slot.get(); |
| 49 } else { | 49 } else { |
| 50 name2slot.add(name, slot.get()); | 50 name2slot.add(name, slot.get()); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 DEFINE_TRACE(SlotAssignment) | 101 DEFINE_TRACE(SlotAssignment) |
| 102 { | 102 { |
| 103 #if ENABLE(OILPAN) | 103 #if ENABLE(OILPAN) |
| 104 visitor->trace(m_assignment); | 104 visitor->trace(m_assignment); |
| 105 #endif | 105 #endif |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |