Changeset 76236 in webkit


Ignore:
Timestamp:
Jan 20, 2011 6:11:33 AM (13 years ago)
Author:
krit@webkit.org
Message:

2011-01-20 Dirk Schulze <krit@webkit.org>

Reviewed by Andreas Kling.

SVG Pattern doesn't take the viewBox of a referenced Pattern
https://bugs.webkit.org/show_bug.cgi?id=52804


SVGPattern element didn't use the viewBox of another SVGPattern element, referenced
by xlink:href. Modified PatternAttributes, to take the value of the viewBox of the
SVGPattern element as well, if the attribute was set.
This gets checked by a W3C SVG test case.

Test: svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg

  • rendering/svg/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::buildTileImageTransform):
  • svg/PatternAttributes.h: (WebCore::PatternAttributes::PatternAttributes): (WebCore::PatternAttributes::viewBox): (WebCore::PatternAttributes::setViewBox): (WebCore::PatternAttributes::hasViewBox):
  • svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::collectPatternAttributes):

2011-01-20 Dirk Schulze <krit@webkit.org>

Reviewed by Andreas Kling.

SVG Pattern doesn't take the viewBox of a referenced Pattern
https://bugs.webkit.org/show_bug.cgi?id=52804


Added a test case of the W3C SVG test suite to check, if we take
the viewBox of a referenced SVGPattern.

  • svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg: Added.
  • platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.checksum
  • platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png
  • platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76235 r76236  
     12011-01-20  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        SVG Pattern doesn't take the viewBox of a referenced Pattern
     6        https://bugs.webkit.org/show_bug.cgi?id=52804
     7       
     8        Added a test case of the W3C SVG test suite to check, if we take
     9        the viewBox of a referenced SVGPattern.
     10
     11        * svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg: Added.
     12        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.checksum
     13        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png
     14        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt
     15
    1162011-01-19  Stephen White  <senorblanco@chromium.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r76235 r76236  
     12011-01-20  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        SVG Pattern doesn't take the viewBox of a referenced Pattern
     6        https://bugs.webkit.org/show_bug.cgi?id=52804
     7       
     8        SVGPattern element didn't use the viewBox of another SVGPattern element, referenced
     9        by xlink:href. Modified PatternAttributes, to take the value of the viewBox of the
     10        SVGPattern element as well, if the attribute was set.
     11        This gets checked by a W3C SVG test case.       
     12
     13        Test: svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg
     14
     15        * rendering/svg/RenderSVGResourcePattern.cpp:
     16        (WebCore::RenderSVGResourcePattern::buildTileImageTransform):
     17        * svg/PatternAttributes.h:
     18        (WebCore::PatternAttributes::PatternAttributes):
     19        (WebCore::PatternAttributes::viewBox):
     20        (WebCore::PatternAttributes::setViewBox):
     21        (WebCore::PatternAttributes::hasViewBox):
     22        * svg/SVGPatternElement.cpp:
     23        (WebCore::SVGPatternElement::collectPatternAttributes):
     24
    1252011-01-19  Stephen White  <senorblanco@chromium.org>
    226
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp

    r76146 r76236  
    229229        return false;
    230230
    231     AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
     231    AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(attributes.viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
    232232
    233233    // Apply viewBox/objectBoundingBox transformations.
  • trunk/Source/WebCore/svg/PatternAttributes.h

    r64579 r76236  
    2828class SVGPatternElement;
    2929
     30// FIXME: We need to add PreserveAspectRatio as well.
     31// see https://bugs.webkit.org/show_bug.cgi?id=52802
    3032struct PatternAttributes {
    3133    PatternAttributes()
     
    3436        , m_width()
    3537        , m_height()
     38        , m_viewBox()
    3639        , m_boundingBoxMode(true)
    3740        , m_boundingBoxModeContent(false)
     
    4548        , m_patternTransformSet(false)
    4649        , m_patternContentElementSet(false)
     50        , m_viewBoxSet(false)
    4751    {
    4852    }
     
    5256    SVGLength width() const { return m_width; }
    5357    SVGLength height() const { return m_height; }
     58    FloatRect viewBox() const { return m_viewBox; }
    5459    bool boundingBoxMode() const { return m_boundingBoxMode; }
    5560    bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
     
    7984        m_height = value;
    8085        m_heightSet = true;
     86    }
     87   
     88    void setViewBox(const FloatRect& value)
     89    {
     90        m_viewBox = value;
     91        m_viewBoxSet = true;
    8192    }
    8293
     
    109120    bool hasWidth() const { return m_widthSet; }
    110121    bool hasHeight() const { return m_heightSet; }
     122    bool hasViewBox() const { return m_viewBoxSet; }
    111123    bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
    112124    bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; }
     
    120132    SVGLength m_width;
    121133    SVGLength m_height;
     134    FloatRect m_viewBox;
    122135    bool m_boundingBoxMode;
    123136    bool m_boundingBoxModeContent;
     
    134147    bool m_patternTransformSet : 1;
    135148    bool m_patternContentElementSet : 1;
     149    bool m_viewBoxSet : 1;
    136150};
    137151
  • trunk/Source/WebCore/svg/SVGPatternElement.cpp

    r73254 r76236  
    229229            attributes.setHeight(current->height());
    230230
     231        if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr))
     232            attributes.setViewBox(current->viewBox());
     233
    231234        if (!attributes.hasBoundingBoxMode() && current->hasAttribute(SVGNames::patternUnitsAttr))
    232235            attributes.setBoundingBoxMode(current->patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
Note: See TracChangeset for help on using the changeset viewer.