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

Side by Side Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 2789363002: Styling slot fallback content with ::slotted()
Patch Set: rebase Created 3 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return context.element->parentElement(); 116 return context.element->parentElement();
117 } 117 }
118 118
119 // If context has scope, return slot that matches the scope, otherwise return 119 // If context has scope, return slot that matches the scope, otherwise return
120 // the assigned slot for scope-less matching of ::slotted pseudo element. 120 // the assigned slot for scope-less matching of ::slotted pseudo element.
121 static const HTMLSlotElement* FindSlotElementInScope( 121 static const HTMLSlotElement* FindSlotElementInScope(
122 const SelectorChecker::SelectorCheckingContext& context) { 122 const SelectorChecker::SelectorCheckingContext& context) {
123 if (!context.scope) 123 if (!context.scope)
124 return context.element->AssignedSlot(); 124 return context.element->AssignedSlot();
125 125
126 for (const HTMLSlotElement* slot = context.element->AssignedSlot(); slot; 126 const HTMLSlotElement* slot = context.element->AssignedSlot();
127 slot = slot->AssignedSlot()) { 127 if (!slot)
128 slot = HTMLSlotElement::FindFallbackSlotElementFor(*context.element);
129
130 // Find the slot element that matches the scope.
131 for (; slot; slot = slot->AssignedSlot()) {
128 if (slot->GetTreeScope() == context.scope->GetTreeScope()) 132 if (slot->GetTreeScope() == context.scope->GetTreeScope())
129 return slot; 133 return slot;
130 } 134 }
131 return nullptr; 135 return nullptr;
132 } 136 }
133 137
134 static bool ScopeContainsLastMatchedElement( 138 static bool ScopeContainsLastMatchedElement(
135 const SelectorChecker::SelectorCheckingContext& context) { 139 const SelectorChecker::SelectorCheckingContext& context) {
136 // If this context isn't scoped, skip checking. 140 // If this context isn't scoped, skip checking.
137 if (!context.scope) 141 if (!context.scope)
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { 1365 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) {
1362 bool force_pseudo_state = false; 1366 bool force_pseudo_state = false;
1363 probe::forcePseudoState(const_cast<Element*>(&element), 1367 probe::forcePseudoState(const_cast<Element*>(&element),
1364 CSSSelector::kPseudoFocus, &force_pseudo_state); 1368 CSSSelector::kPseudoFocus, &force_pseudo_state);
1365 if (force_pseudo_state) 1369 if (force_pseudo_state)
1366 return true; 1370 return true;
1367 return element.IsFocused() && IsFrameFocused(element); 1371 return element.IsFocused() && IsFrameFocused(element);
1368 } 1372 }
1369 1373
1370 } // namespace blink 1374 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698