summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGUseElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGUseElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGUseElement.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp
index fd7f2d217..e342ee4ad 100644
--- a/Source/WebCore/svg/SVGUseElement.cpp
+++ b/Source/WebCore/svg/SVGUseElement.cpp
@@ -345,14 +345,21 @@ bool SVGUseElement::willRecalcStyle(StyleChange change)
if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement())
shadowRoot->setNeedsStyleRecalc();
}
+ // Do not do style calculation during shadow tree construction because it may cause nodes to
+ // be attached before they should be. Style recalc will happen when the tree is constructed
+ // and explicitly attached.
+ if (m_updatesBlocked)
+ return false;
return true;
}
void SVGUseElement::didRecalcStyle(StyleChange change)
{
// Assure that the shadow tree has not been marked for recreation, while we're building it.
- if (m_updatesBlocked)
- ASSERT(!m_needsShadowTreeRecreation);
+ if (m_updatesBlocked && m_needsShadowTreeRecreation) {
+ // We are about to recreate the tree while in the middle of recreating the tree.
+ return;
+ }
RenderSVGShadowTreeRootContainer* shadowRoot = static_cast<RenderSVGShadowTreeRootContainer*>(renderer());
if (!shadowRoot)