| Index: third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp b/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
|
| index 2c8a2ed430baf716e62b7bb6cdb3b1f2d016f00d..12632179e87871347659c0991a8d4657bd557cab 100644
|
| --- a/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
|
| @@ -25,57 +25,36 @@ static void detachNotAssignedNode(Node& node)
|
| node.lazyReattachIfAttached();
|
| }
|
|
|
| -inline static bool isDefaultSlotName(const AtomicString& name)
|
| -{
|
| - return name.isNull() || name.isEmpty();
|
| -}
|
| -
|
| void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot)
|
| {
|
| m_assignment.clear();
|
|
|
| using Name2Slot = HeapHashMap<AtomicString, Member<HTMLSlotElement>>;
|
| Name2Slot name2slot;
|
| - HTMLSlotElement* defaultSlot = nullptr;
|
|
|
| const HeapVector<Member<HTMLSlotElement>>& slots = shadowRoot.descendantSlots();
|
|
|
| for (Member<HTMLSlotElement> slot : slots) {
|
| slot->willUpdateDistribution();
|
| - AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr);
|
| - if (isDefaultSlotName(name)) {
|
| - if (!defaultSlot)
|
| - defaultSlot = slot.get();
|
| - } else {
|
| - name2slot.add(name, slot.get());
|
| - }
|
| + name2slot.add(slot->name(), slot.get());
|
| }
|
|
|
| for (Node& child : NodeTraversal::childrenOf(*shadowRoot.host())) {
|
| - if (child.isElementNode()) {
|
| - if (isActiveInsertionPoint(child)) {
|
| - // TODO(hayato): Support re-distribution across v0 and v1 shadow trees
|
| - detachNotAssignedNode(child);
|
| - continue;
|
| - }
|
| - AtomicString slotName = toElement(child).fastGetAttribute(HTMLNames::slotAttr);
|
| - if (isDefaultSlotName(slotName)) {
|
| - if (defaultSlot)
|
| - assign(child, *defaultSlot);
|
| - else
|
| - detachNotAssignedNode(child);
|
| - } else {
|
| - HTMLSlotElement* slot = name2slot.get(slotName);
|
| - if (slot)
|
| - assign(child, *slot);
|
| - else
|
| - detachNotAssignedNode(child);
|
| - }
|
| - } else if (defaultSlot && child.isTextNode()) {
|
| - assign(child, *defaultSlot);
|
| - } else {
|
| + if (child.isElementNode() && isActiveInsertionPoint(child)) {
|
| + // TODO(hayato): Support re-distribution across v0 and v1 shadow trees
|
| detachNotAssignedNode(child);
|
| + continue;
|
| }
|
| + if (!child.slottable()) {
|
| + detachNotAssignedNode(child);
|
| + continue;
|
| + }
|
| + AtomicString slotName = child.slotName();
|
| + HTMLSlotElement* slot = name2slot.get(slotName);
|
| + if (slot)
|
| + assign(child, *slot);
|
| + else
|
| + detachNotAssignedNode(child);
|
| }
|
|
|
| // Update each slot's distribution in reverse tree order so that a child slot is visited before its parent slot.
|
|
|