feImage should not be allowed to self reference
authorschenney <schenney@chromium.org>
Mon, 29 Oct 2012 23:15:35 +0000 (23:15 +0000)
committerschenney <schenney@chromium.org>
Mon, 29 Oct 2012 23:15:35 +0000 (23:15 +0000)
commit3b674b627abccd4ab14cbad57595aa8861f7562e
tree87b85c41b64abf7e1f30cec29322a36e8404e5c3
parent1c6df80a86a669c09ea764bfe684c7851122f96f
feImage should not be allowed to self reference
https://bugs.webkit.org/show_bug.cgi?id=94652

Reviewed by Eric Seidel.

Source/WebCore:

Add cycle detection for SVG filter application, and also fix a problem
with graphics context restore when filters are applied. This also
converts the flags in FilterData to a state tracking system, as the
number of flags was getting messy and only one flag is valid at any given time.

Test: svg/filters/feImage-self-and-other-referencing.html

* rendering/svg/RenderSVGResourceFilter.cpp: Convert to new FilterData
state management and enable cycle detection.
(WebCore):
(WebCore::RenderSVGResourceFilter::removeClientFromCache): Change isBuilt and markedForRemoval flags to state enums.
(WebCore::RenderSVGResourceFilter::applyResource): Change flags to state enums and detect cycles.
(WebCore::RenderSVGResourceFilter::postApplyResource): Change flags to state and add handling
for the various states.
(WebCore::RenderSVGResourceFilter::primitiveAttributeChanged): Change isBuilt flag to state enums.
* rendering/svg/RenderSVGResourceFilter.h:
(WebCore::FilterData::FilterData):
(FilterData): Convert to a state tracking system.
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::paintReplaced): Add a block around the
SVGRenderingContext so that it applies the filter and reverts the
context before the calling method restores the context.

LayoutTests:

Additional test case for situations when the filter is applied to multiple objects that it also references.

* svg/filters/feImage-self-and-other-referencing-expected.html: Added.
* svg/filters/feImage-self-and-other-referencing.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132856 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/svg/filters/feImage-self-and-other-referencing-expected.html [new file with mode: 0644]
LayoutTests/svg/filters/feImage-self-and-other-referencing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
Source/WebCore/rendering/svg/RenderSVGResourceFilter.h
Source/WebCore/rendering/svg/RenderSVGRoot.cpp