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

Unified Diff: third_party/WebKit/Source/core/css/SelectorChecker.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/SelectorChecker.cpp
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
index de3cc38e0a99f0391d090692b2529de9cd044b6b..6106d846915d593e0f9d9a0ef61aad7bd079e73f 100644
--- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp
+++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -123,8 +123,17 @@ static const HTMLSlotElement* FindSlotElementInScope(
if (!context.scope)
return context.element->AssignedSlot();
- for (const HTMLSlotElement* slot = context.element->AssignedSlot(); slot;
- slot = slot->AssignedSlot()) {
+ const HTMLSlotElement* slot = context.element->AssignedSlot();
+ if (!slot) {
hayato 2017/04/13 05:50:40 Looks the dupe of code. It would be better to extr
+ Element* parent = context.element->parentElement();
+ if (!parent || !isHTMLSlotElement(parent) ||
+ !toHTMLSlotElement(parent)->AssignedNodes().IsEmpty())
+ return nullptr;
+ slot = toHTMLSlotElement(parent);
+ }
+
+ // Find the slot element that matches the scope.
+ for (; slot; slot = slot->AssignedSlot()) {
if (slot->GetTreeScope() == context.scope->GetTreeScope())
return slot;
}

Powered by Google App Engine
This is Rietveld 408576698