Chromium Code Reviews| Index: Source/core/rendering/svg/SVGRenderingContext.cpp |
| diff --git a/Source/core/rendering/svg/SVGRenderingContext.cpp b/Source/core/rendering/svg/SVGRenderingContext.cpp |
| index fade7cdbfc7ac74d9b8230b186e54624e8465a31..80ba33330e7c9be53235cdb9f2df0632f15d71a6 100644 |
| --- a/Source/core/rendering/svg/SVGRenderingContext.cpp |
| +++ b/Source/core/rendering/svg/SVGRenderingContext.cpp |
| @@ -34,6 +34,7 @@ |
| #include "core/rendering/svg/SVGResources.h" |
| #include "core/rendering/svg/SVGResourcesCache.h" |
| #include "platform/FloatConversion.h" |
| +#include "platform/graphics/paint/DrawingRecorder.h" |
| namespace blink { |
| @@ -42,7 +43,13 @@ SVGRenderingContext::~SVGRenderingContext() |
| if (m_filter) { |
| ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); |
| ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->filter() == m_filter); |
| - m_filter->finishEffect(m_object, m_paintInfo.context); |
| + |
| + DrawingRecorder recorder(m_originalPaintInfo->context, m_object->displayItemClient(), DisplayItem::SVGFilter, LayoutRect::infiniteRect()); |
| + m_filter->finishEffect(m_object, m_originalPaintInfo->context); |
| + |
| + // Reset the paint info after the filter effect has been completed. |
| + m_paintInfo.context = m_originalPaintInfo->context; |
| + m_paintInfo.rect = m_originalPaintInfo->rect; |
|
fs
2015/01/26 09:47:11
m_paintInfo.rect is "dead" at this point (not used
pdr.
2015/01/28 01:04:39
Yeah, I thought it would be clean to fully clean u
|
| } |
| if (m_masker) { |
| @@ -149,10 +156,15 @@ bool SVGRenderingContext::applyFilterIfNecessary(SVGResources* resources) |
| if (m_object->style()->svgStyle().hasFilter()) |
| return false; |
| } else if (RenderSVGResourceFilter* filter = resources->filter()) { |
| - if (!filter->prepareEffect(m_object, m_paintInfo.context)) |
| + GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paintInfo.context); |
| + if (!filterContext) |
| return false; |
| m_filter = filter; |
| + // Because the filter needs to cache its contents we replace the context |
| + // during filtering with the filter's context. |
| + m_paintInfo.context = filterContext; |
| + |
| // Because we cache the filter contents and do not invalidate on paint |
| // invalidation rect changes, we need to paint the entire filter region |
| // so elements outside the initial paint (due to scrolling, etc) paint. |