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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 2789363002: Styling slot fallback content with ::slotted()
Patch Set: clean up 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
index 1961ee2b71074feb66eb0e58fcbea1b8ba00d91b..89a5abb6336cc1a2bce2221d6794c02983864d61 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -267,8 +267,14 @@ static void MatchHostRules(const Element& element,
static void MatchSlottedRules(const Element& element,
ElementRuleCollector& collector) {
HTMLSlotElement* slot = element.AssignedSlot();
- if (!slot)
- return;
+ if (!slot) {
+ // Check if |element| is a fallback content.
+ Element* parent = element.parentElement();
+ if (!parent || !isHTMLSlotElement(parent) ||
+ !toHTMLSlotElement(parent)->AssignedNodes().IsEmpty())
+ return;
+ slot = toHTMLSlotElement(parent);
+ }
hayato 2017/04/13 05:50:40 I don't think this is correct. Can this handle nes
kochi 2017/04/14 02:15:13 Good catch, let me work on it.
HeapVector<Member<ScopedStyleResolver>> resolvers;
for (; slot; slot = slot->AssignedSlot()) {

Powered by Google App Engine
This is Rietveld 408576698