Index: third_party/WebKit/Source/core/paint/SVGPaintContext.cpp |
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp |
index e080d685791c1709bce9a0a71d30e6d68f78ecac..399d69fbb1ecada0d28799ad71e6b663c43b9fd8 100644 |
--- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp |
+++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp |
@@ -78,7 +78,14 @@ bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() |
return true; |
} |
- applyCompositingIfNecessary(); |
+ bool isSVGRoot = m_object.isSVGRoot(); |
+ |
+ // Layer takes care of root opacity and blend mode. |
+ if (isSVGRoot) { |
+ DCHECK(!(m_object.isTransparent() || m_object.styleRef().hasBlendMode()) || m_object.hasLayer()); |
+ } else { |
+ applyCompositingIfNecessary(); |
+ } |
if (!applyClipIfNecessary(resources)) |
return false; |
@@ -86,8 +93,11 @@ bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() |
if (!applyMaskIfNecessary(resources)) |
return false; |
- if (!applyFilterIfNecessary(resources)) |
+ if (isSVGRoot) { |
+ DCHECK(!m_object.styleRef().hasFilter() || m_object.hasLayer()); |
+ } else if (!applyFilterIfNecessary(resources)) { |
return false; |
+ } |
if (!isIsolationInstalled() && SVGLayoutSupport::isIsolationRequired(&m_object)) |
m_compositingRecorder = wrapUnique(new CompositingRecorder(paintInfo().context, m_object, SkXfermode::kSrcOver_Mode, 1)); |
@@ -99,10 +109,6 @@ void SVGPaintContext::applyCompositingIfNecessary() |
{ |
ASSERT(!paintInfo().isRenderingClipPathAsMaskImage()); |
- // Layer takes care of root opacity and blend mode. |
- if (m_object.isSVGRoot()) |
- return; |
- |
const ComputedStyle& style = m_object.styleRef(); |
float opacity = style.opacity(); |
WebBlendMode blendMode = style.hasBlendMode() && m_object.isBlendingAllowed() ? |
@@ -148,7 +154,7 @@ bool SVGPaintContext::applyMaskIfNecessary(SVGResources* resources) |
bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) |
{ |
if (!resources) { |
- if (m_object.style()->svgStyle().hasFilter()) |
+ if (m_object.style()->hasFilter()) |
return false; |
} else if (LayoutSVGResourceFilter* filter = resources->filter()) { |
m_filterRecordingContext = wrapUnique(new SVGFilterRecordingContext(paintInfo().context)); |