Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/SlotScopedTraversal.cpp

Issue 1840333002: Support slots' fallback contents in focus navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698