Skip to content
  • krit@webkit.org's avatar
    SVG radialGradient should support 'fr' for focal radius (just like Canvas) · c021e2bf
    krit@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=97986
    
    Reviewed by Daniel Bates.
    
    Source/WebCore:
    
    Update SVGRadialGradient to the changed behavior in SVG2: http://www.w3.org/TR/SVG2/pservers.html#RadialGradients
    SVG2 adds the focal radius for radial gradients. Color stops will start from the edge of
    the focal radius.
    The new specification does not limit the focal point to be inside the radial gradients radius.
    This makes SVGRadialGradient consistent with the radial gradient on Canvas.
    
    Test: svg/custom/radialGradient-focal-radius.svg
    
    * rendering/svg/RenderSVGResourceRadialGradient.cpp:
        Remove checks for position of focal point. The focal point
        can be placed every where outside the radius of the gradient now.
    (WebCore::RenderSVGResourceRadialGradient::focalRadius):
        Add new method to get the focal radius from SVGRadialGradientElement.
    (WebCore::RenderSVGResourceRadialGradient::buildGradient):
    * rendering/svg/RenderSVGResourceRadialGradient.h:
    (RenderSVGResourceRadialGradient):
    * rendering/svg/SVGRenderTreeAsText.cpp:
    (WebCore::writeSVGResourceContainer):
        Modify DRT output to include the focal radius.
    * svg/RadialGradientAttributes.h:
    (WebCore::RadialGradientAttributes::RadialGradientAttributes):
    (WebCore::RadialGradientAttributes::fr):
    (WebCore::RadialGradientAttributes::setFr):
    (WebCore::RadialGradientAttributes::hasFr):
    (RadialGradientAttributes):
        New setters and getters for focal radius.
    * svg/SVGRadialGradientElement.cpp:
    (WebCore):
    (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
    (WebCore::SVGRadialGradientElement::isSupportedAttribute):
    (WebCore::SVGRadialGradientElement::parseAttribute):
    (WebCore::SVGRadialGradientElement::collectGradientAttributes):
    (WebCore::SVGRadialGradientElement::selfHasRelativeLengths):
        Ditto.
    * svg/SVGRadialGradientElement.h:
    (SVGRadialGradientElement):
    * svg/SVGRadialGradientElement.idl:
    * svg/svgattrs.in:
        Add 'fr' as new attribute to the SVG attribute list.
    
    LayoutTests:
    
    DRT changed the output to reflect the new added focal radius. A bunch of tests need
    a rebaseline on DRT.
    Added a new test for focal radius and changed behavior of focal point.
    
    * platform/chromium/TestExpectations:
    * platform/efl/TestExpectations:
    * platform/gtk/TestExpectations:
    * platform/qt/TestExpectations:
    * platform/mac/svg/W3C-SVG-1.1-SE/styling-pres-02-f-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/coords-units-01-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-02-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-04-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-05-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-06-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-11-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-12-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-14-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/pservers-grad-15-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/struct-use-05-b-expected.txt:
    * platform/mac/svg/W3C-SVG-1.1/styling-inherit-01-b-expected.txt:
    * platform/mac/svg/batik/paints/gradientLimit-expected.txt:
    * platform/mac/svg/batik/paints/patternRegions-expected.txt:
    * platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.txt:
    * platform/mac/svg/batik/text/textEffect-expected.txt:
    * platform/mac/svg/batik/text/textEffect3-expected.txt:
    * platform/mac/svg/custom/gradient-attr-update-expected.txt:
    * platform/mac/svg/custom/gradient-deep-referencing-expected.txt:
    * platform/mac/svg/custom/gradient-rotated-bbox-expected.txt:
    * platform/mac/svg/custom/gradient-userSpaceOnUse-with-percentage-expected.txt:
    * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.txt:
    * platform/mac/svg/custom/large-bounding-box-percents-expected.txt:
    * platform/mac/svg/custom/radialGradient-focal-radius-expected.png: Added.
    * platform/mac/svg/custom/radialGradient-focal-radius-expected.txt: Added.
    * platform/mac/svg/custom/recursive-gradient-expected.txt:
    * platform/mac/svg/custom/relative-sized-content-with-resources-expected.txt:
    * platform/mac/svg/custom/stroked-pattern-expected.txt:
    * platform/mac/svg/filters/feDisplacementMap-expected.txt:
    * platform/mac/svg/filters/filterRes-expected.txt:
    * platform/mac/svg/hixie/perf/006-expected.txt:
    * svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt:
    * svg/custom/gradient-stroke-width-expected.txt:
    * svg/custom/radial-gradient-with-outstanding-focalPoint-expected.txt:
    * svg/custom/radialGradient-focal-radius.svg: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    c021e2bf