Skip to content
  • zimmermann@webkit.org's avatar
    SVG animation repaint issue with image and dynamic clipPath · 6ec5f2fb
    zimmermann@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=76559
    
    Reviewed by Zoltan Herczeg.
    
    Source/WebCore:
    
    Based on patch by Kelly Norton <knorton@google.com>. I extended the patch
    to correctly handle relative length resolution as well.
    
    RenderSVGImage doesn't react on setNeedsBoundariesUpdate() calls
    and thus fails to update its boundaries in some cases.
    
    The logic is also inconsistent, compared to the other renderers.
    Fix that properly, by reusing the method used in RenderSVGViewportContainer.
    Call calculateImageViewport() immediately, after initializing the LayoutRepainter.
    Previously we resolved the image viewport in RenderSVGImage::updateFromElement. This is
    wrong, as it queries the frameRect() of the RenderSVGRoot in a state, where the renderer
    still needs layout, leading to wrong results.
    
    I turned Kellys manual testcase into a predictable test, see svg/repaint/image-with-clip-path.svg
    Relative sized image handling is tested in svg/custom/relative-sized-image.xhtml now.
    
    Tests: svg/custom/relative-sized-image.xhtml
           svg/repaint/image-with-clip-path.svg
    
    * rendering/svg/RenderSVGImage.cpp:
    (WebCore::RenderSVGImage::RenderSVGImage):
    (WebCore::RenderSVGImage::updateImageViewport):
    (WebCore::RenderSVGImage::layout):
    * rendering/svg/RenderSVGImage.h:
    (WebCore::RenderSVGImage::setNeedsBoundariesUpdate):
    * svg/SVGImageElement.cpp:
    (WebCore::SVGImageElement::svgAttributeChanged):
    
    LayoutTests:
    
    Update results after fixing RenderSVGImage repainting.
    
    * platform/chromium-win/svg/W3C-SVG-1.1/masking-path-04-b-expected.txt:
    * platform/chromium/test_expectations.txt:
    * platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.png:
    * platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.txt:
    * platform/mac/svg/custom/relative-sized-image-expected.png: Added.
    * platform/mac/svg/custom/relative-sized-image-expected.txt: Added.
    * platform/mac/svg/repaint/image-with-clip-path-expected.png: Added.
    * svg/custom/relative-sized-image.xhtml: Added.
    * svg/repaint/image-with-clip-path-expected.txt: Added.
    * svg/repaint/image-with-clip-path.svg: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    6ec5f2fb