Changeset 63415 in webkit


Ignore:
Timestamp:
Jul 15, 2010 1:25:18 AM (14 years ago)
Author:
Nikolas Zimmermann
Message:

2010-07-15 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Eric Seidel.

SVG patterns and masks should not be able to reference themselves
https://bugs.webkit.org/show_bug.cgi?id=32171

Pattern still had an issue, when using constructs like:
<pattern id="pattern1" xlink:href="#pattern2"/>
<pattern id="pattern2"><rect fill="url(#pattern1)"/></pattern>

Extended test svg/custom/recursive-pattern.svg to cover this situation.

  • rendering/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::applyResource): Don't perform the cycle check against node()... (WebCore::RenderSVGResourcePattern::createTileImage): .. but against the "patternContentElement" which respect the xlink:href chaining.

2010-07-15 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Eric Seidel.

SVG patterns and masks should not be able to reference themselves
https://bugs.webkit.org/show_bug.cgi?id=32171

Pattern still had an issue, when using constructs like:
<pattern id="pattern1" xlink:href="#pattern2"/>
<pattern id="pattern2"><rect fill="url(#pattern1)"/></pattern>

  • platform/mac/svg/custom/recursive-pattern-expected.checksum:
  • platform/mac/svg/custom/recursive-pattern-expected.png:
  • platform/mac/svg/custom/recursive-pattern-expected.txt:
  • svg/custom/recursive-pattern.svg: Add new subtest.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63414 r63415  
     12010-07-15  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        SVG patterns and masks should not be able to reference themselves
     6        https://bugs.webkit.org/show_bug.cgi?id=32171
     7
     8        Pattern still had an issue, when using constructs like:
     9        <pattern id="pattern1" xlink:href="#pattern2"/>
     10        <pattern id="pattern2"><rect fill="url(#pattern1)"/></pattern>
     11
     12        * platform/mac/svg/custom/recursive-pattern-expected.checksum:
     13        * platform/mac/svg/custom/recursive-pattern-expected.png:
     14        * platform/mac/svg/custom/recursive-pattern-expected.txt:
     15        * svg/custom/recursive-pattern.svg: Add new subtest.
     16
    1172010-07-15  Nikolas Zimmermann  <nzimmermann@rim.com>
    218
  • trunk/LayoutTests/platform/mac/svg/custom/recursive-pattern-expected.checksum

    r63300 r63415  
    1 4de93deb4103eaf64c73e4c897f42cf5
     1072328919c08c17ef70c206e80d348dd
  • trunk/LayoutTests/platform/mac/svg/custom/recursive-pattern-expected.txt

    r63300 r63415  
    22  RenderView at (0,0) size 800x600
    33layer at (0,0) size 800x600
    4   RenderSVGRoot {svg} at (0,0) size 201x201
     4  RenderSVGRoot {svg} at (0,0) size 201x301
    55    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
    66      RenderSVGResourcePattern {pattern} [id="pattern1"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
     
    1010      RenderSVGResourcePattern {pattern} [id="pattern3"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
    1111      RenderSVGResourcePattern {pattern} [id="pattern4"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
     12      RenderSVGResourcePattern {pattern} [id="pattern6"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
     13      RenderSVGResourcePattern {pattern} [id="pattern5"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
     14        RenderPath {rect} at (0,0) size 100x100 [fill={[type=PATTERN] [id="pattern6"]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
    1215    RenderPath {rect} at (0,0) size 101x101 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=PATTERN] [id="pattern1"]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
    1316    RenderPath {rect} at (0,99) size 101x102 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=PATTERN] [id="pattern2"]}] [data="M0.00,100.00 L100.00,100.00 L100.00,200.00 L0.00,200.00 Z"]
    1417    RenderPath {rect} at (99,0) size 102x101 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=PATTERN] [id="pattern3"]}] [data="M100.00,0.00 L200.00,0.00 L200.00,100.00 L100.00,100.00 Z"]
    1518    RenderPath {rect} at (99,99) size 102x102 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=PATTERN] [id="pattern4"]}] [data="M100.00,100.00 L200.00,100.00 L200.00,200.00 L100.00,200.00 Z"]
     19    RenderPath {rect} at (0,199) size 101x102 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=PATTERN] [id="pattern5"]}] [data="M0.00,200.00 L100.00,200.00 L100.00,300.00 L0.00,300.00 Z"]
     20    RenderPath {rect} at (99,199) size 102x102 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=PATTERN] [id="pattern6"]}] [data="M100.00,200.00 L200.00,200.00 L200.00,300.00 L100.00,300.00 Z"]
  • trunk/LayoutTests/svg/custom/recursive-pattern.svg

    r63300 r63415  
    1111    <pattern id="pattern3" x="0" y="0" width="100" height="100" xlink:href="#pattern1"/>
    1212    <pattern id="pattern4" x="0" y="0" width="100" height="100" xlink:href="#pattern2"/>
     13
     14    <pattern id="pattern6" xlink:href="#pattern5"/>
     15    <pattern id="pattern5" x="0" y="0" width="100" height="100">
     16        <rect x="0" y="0" width="100" height="100" fill="url(#pattern6)"/>
     17    </pattern>
    1318</defs>
    1419
     
    1823<rect x="100" y="0" width="100" height="100" fill="url(#pattern3)" stroke="green"/>
    1924<rect x="100" y="100" width="100" height="100" fill="url(#pattern4)" stroke="green"/>
     25<rect x="0" y="200" width="100" height="100" fill="url(#pattern5)" stroke="green"/>
     26<rect x="100" y="200" width="100" height="100" fill="url(#pattern6)" stroke="green"/>
    2027</svg>
  • trunk/WebCore/ChangeLog

    r63413 r63415  
     12010-07-15  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        SVG patterns and masks should not be able to reference themselves
     6        https://bugs.webkit.org/show_bug.cgi?id=32171
     7
     8        Pattern still had an issue, when using constructs like:
     9        <pattern id="pattern1" xlink:href="#pattern2"/>
     10        <pattern id="pattern2"><rect fill="url(#pattern1)"/></pattern>
     11
     12        Extended test svg/custom/recursive-pattern.svg to cover this situation.
     13
     14        * rendering/RenderSVGResourcePattern.cpp:
     15        (WebCore::RenderSVGResourcePattern::applyResource): Don't perform the cycle check against node()...
     16        (WebCore::RenderSVGResourcePattern::createTileImage): .. but against the "patternContentElement" which respect the xlink:href chaining.
     17
    1182010-07-15  Nikolas Zimmermann  <nzimmermann@rim.com>
    219
  • trunk/WebCore/rendering/RenderSVGResourcePattern.cpp

    r63300 r63415  
    107107    PatternData* patternData = m_pattern.get(object);
    108108    if (!patternData->pattern) {
    109         // Early exit, if this resource contains a child which references ourselves.
    110         if (containsCyclicReference(node()))
    111             return false;
    112 
    113109        // Create tile image
    114110        OwnPtr<ImageBuffer> tileImage = createTileImage(patternData, patternElement, object);
     
    254250        return 0;
    255251
     252    // Early exit, if this resource contains a child which references ourselves.
     253    if (containsCyclicReference(attributes.patternContentElement()))
     254        return 0;
     255
    256256    FloatRect objectBoundingBox = object->objectBoundingBox();   
    257257    FloatRect patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement);
Note: See TracChangeset for help on using the changeset viewer.