Index: Source/core/dom/shadow/ShadowRoot.cpp |
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp |
index fc40ea28119bf6fcbc608b8217aa42c25d944a7c..4780751a18aca586711f657738b4958305a7da38 100644 |
--- a/Source/core/dom/shadow/ShadowRoot.cpp |
+++ b/Source/core/dom/shadow/ShadowRoot.cpp |
@@ -145,6 +145,14 @@ void ShadowRoot::recalcStyle(StyleChange change) |
if (styleChangeType() == FullStyleChange) |
change = Force; |
+ if (!attached()) { |
+ attach(); |
+ // attach recalculates the style for all children. No need to do it twice. |
+ clearNeedsStyleRecalc(); |
+ clearChildNeedsStyleRecalc(); |
+ return; |
+ } |
+ |
StyleResolver* styleResolver = document()->styleResolver(); |
styleResolver->pushParentShadowRoot(this); |