A crash reproducible in Path::isEmpty() under RenderSVGShape::paint()
[WebKit-https.git] / Source / WebCore / rendering / svg / SVGResources.cpp
index 2e1f2ab..0aaa1ad 100644 (file)
@@ -25,6 +25,7 @@
 #include "RenderSVGResourceFilter.h"
 #include "RenderSVGResourceMarker.h"
 #include "RenderSVGResourceMasker.h"
+#include "RenderSVGRoot.h"
 #include "SVGGradientElement.h"
 #include "SVGNames.h"
 #include "SVGPaint.h"
@@ -283,6 +284,27 @@ bool SVGResources::buildCachedResources(const RenderElement& renderer, const Ren
     return foundResources;
 }
 
+void SVGResources::layoutDifferentRootIfNeeded(const RenderSVGRoot* svgRoot)
+{
+    if (clipper() && svgRoot != SVGRenderSupport::findTreeRootObject(*clipper()))
+        clipper()->layoutIfNeeded();
+
+    if (masker() && svgRoot != SVGRenderSupport::findTreeRootObject(*masker()))
+        masker()->layoutIfNeeded();
+
+    if (filter() && svgRoot != SVGRenderSupport::findTreeRootObject(*filter()))
+        filter()->layoutIfNeeded();
+
+    if (markerStart() && svgRoot != SVGRenderSupport::findTreeRootObject(*markerStart()))
+        markerStart()->layoutIfNeeded();
+
+    if (markerMid() && svgRoot != SVGRenderSupport::findTreeRootObject(*markerMid()))
+        markerMid()->layoutIfNeeded();
+
+    if (markerEnd() && svgRoot != SVGRenderSupport::findTreeRootObject(*markerEnd()))
+        markerEnd()->layoutIfNeeded();
+}
+
 void SVGResources::removeClientFromCache(RenderElement& renderer, bool markForInvalidation) const
 {
     if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource)