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

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

Issue 2613213002: Support Style Sharing for Shadow DOM V1 (Closed)
Patch Set: update Created 3 years, 11 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/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..27dc1c6c58c3e139f572f5bbfcee5b5c120a0c70 100644
--- a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp
@@ -198,6 +198,15 @@ bool SharedStyleFinder::sharingCandidateCanShareHostStyles(
return elementShadow->hasSameStyles(*candidateShadow);
}
+bool SharedStyleFinder::sharingCandidateAssignedToSameSlot(
+ Element& candidate) const {
+ HTMLSlotElement* elementSlot = element().assignedSlot();
+ HTMLSlotElement* candidateSlot = candidate.assignedSlot();
+ if (!elementSlot && !candidateSlot)
+ return true;
+ return elementSlot == candidateSlot;
+}
+
bool SharedStyleFinder::sharingCandidateDistributedToSameInsertionPoint(
Element& candidate) const {
HeapVector<Member<InsertionPoint>, 8> insertionPoints,
@@ -251,6 +260,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())

Powered by Google App Engine
This is Rietveld 408576698