Skip to content
  • schenney@chromium.org's avatar
    feImage should not be allowed to self reference · 42738924
    schenney@chromium.org authored
    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
    42738924