Index: Source/core/css/resolver/SharedStyleFinder.cpp |
diff --git a/Source/core/css/resolver/SharedStyleFinder.cpp b/Source/core/css/resolver/SharedStyleFinder.cpp |
index 198ac8fcf60f06ad1825b02a425d0bf71c7a8977..8bee74f26697bbc567fb0fe408b0f8666b558224 100644 |
--- a/Source/core/css/resolver/SharedStyleFinder.cpp |
+++ b/Source/core/css/resolver/SharedStyleFinder.cpp |
@@ -266,6 +266,11 @@ bool SharedStyleFinder::canShareStyleWithElement(Element& candidate) const |
return false; |
} |
+ ShadowRoot* root1 = element().containingShadowRoot(); |
+ ShadowRoot* root2 = candidate.containingShadowRoot(); |
+ if (root1 && root2 && root1->type() != root2->type()) |
+ return false; |
+ |
if (document().containsValidityStyleRules()) { |
if (candidate.isValidElement() != element().isValidElement()) |
return false; |