Index: Source/core/css/resolver/SharedStyleFinder.cpp |
diff --git a/Source/core/css/resolver/SharedStyleFinder.cpp b/Source/core/css/resolver/SharedStyleFinder.cpp |
index e1a5a7e069a570f4e3d76b30b495ac075e39be6c..afef6c1c54c322057cdc7561c63298ba1104767a 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; |