Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp |
| diff --git a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp |
| index 842676fb717292ef5d9e3a5e5a3593b4f4c2d903..7cf33826a864486c11d433f0b03da1c9ea904fa3 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp |
| @@ -198,6 +198,13 @@ bool SharedStyleFinder::sharingCandidateCanShareHostStyles( |
| return elementShadow->hasSameStyles(*candidateShadow); |
| } |
| +bool SharedStyleFinder::sharingCandidateAssignedToSameSlot( |
| + Element& candidate) const { |
| + HTMLSlotElement* slot1 = element().assignedSlot(); |
| + HTMLSlotElement* slot2 = candidate.assignedSlot(); |
| + return slot1 && slot2 && slot1 == slot2; |
|
rune
2017/01/11 11:34:27
The most common case is that slot1 and slot2 are b
|
| +} |
| + |
| bool SharedStyleFinder::sharingCandidateDistributedToSameInsertionPoint( |
| Element& candidate) const { |
| HeapVector<Member<InsertionPoint>, 8> insertionPoints, |
| @@ -251,6 +258,10 @@ bool SharedStyleFinder::canShareStyleWithElement(Element& candidate) const { |
| return false; |
| if (!sharingCandidateCanShareHostStyles(candidate)) |
| return false; |
| + // For Shadow DOM V1 |
| + if (!sharingCandidateAssignedToSameSlot(candidate)) |
| + return false; |
| + // For Shadow DOM V0 |
| if (!sharingCandidateDistributedToSameInsertionPoint(candidate)) |
| return false; |
| if (candidate.isInTopLayer() != element().isInTopLayer()) |