Chromium Code Reviews| 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; |
| } |