| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/SlotScopedTraversal.h" | 5 #include "core/dom/shadow/SlotScopedTraversal.h" |
| 6 | 6 |
| 7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
| 8 #include "core/dom/ElementTraversal.h" | 8 #include "core/dom/ElementTraversal.h" |
| 9 #include "core/html/HTMLSlotElement.h" | 9 #include "core/html/HTMLSlotElement.h" |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 return nullptr; | 77 return nullptr; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool SlotScopedTraversal::isSlotScoped(const Element& current) | 80 bool SlotScopedTraversal::isSlotScoped(const Element& current) |
| 81 { | 81 { |
| 82 return SlotScopedTraversal::nearestAncestorAssignedToSlot(current); | 82 return SlotScopedTraversal::nearestAncestorAssignedToSlot(current); |
| 83 } | 83 } |
| 84 | 84 |
| 85 HTMLSlotElement* SlotScopedTraversal::findFallbackScopeOwnerSlot(const Element&
current) |
| 86 { |
| 87 Element* parent = const_cast<Element*>(current.parentElement()); |
| 88 while (parent) { |
| 89 if (isHTMLSlotElement(parent)) |
| 90 return toHTMLSlotElement(parent)->getAssignedNodes().isEmpty() ? toH
TMLSlotElement(parent) : nullptr; |
| 91 parent = parent->parentElement(); |
| 92 } |
| 93 return nullptr; |
| 94 } |
| 95 |
| 96 bool SlotScopedTraversal::isSlotFallbackScoped(const Element& current) |
| 97 { |
| 98 return SlotScopedTraversal::findFallbackScopeOwnerSlot(current); |
| 99 } |
| 100 |
| 85 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |