[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

krit at webkit.org krit at webkit.org
Sun Feb 20 23:25:58 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 7d34db720c45d1bb65faf195bb9a9af07004ff77
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 14:11:33 2011 +0000

    2011-01-20  Dirk Schulze  <krit at 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 at 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
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index eb9ab32..ca90a4c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2011-01-20  Dirk Schulze  <krit at 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
+
 2011-01-19  Stephen White  <senorblanco at chromium.org>
 
         Reviewed by James Robinson. 
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.checksum
new file mode 100644
index 0000000..23d9290
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.checksum
@@ -0,0 +1 @@
+cab9f490ff83da5ab791dccdeadd3f17
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png
new file mode 100644
index 0000000..016f6f5
Binary files /dev/null and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt
new file mode 100644
index 0000000..7b92153
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 480x360
+  RenderView at (0,0) size 480x360
+layer at (0,0) size 480x360
+  RenderSVGRoot {svg} at (0,0) size 480x360
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGContainer {g} at (1,1) size 200x200
+      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+        RenderSVGResourcePattern {pattern} [id="pattern1"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+          RenderSVGPath {circle} at (3,3) size 4x4 [fill={[type=SOLID] [color=#FF0000]}] [cx=5.00] [cy=5.00] [r=1.90]
+        RenderSVGResourcePattern {pattern} [id="pattern2"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+          RenderSVGPath {circle} at (3,0) size 4x4 [fill={[type=SOLID] [color=#00FF00]}] [cx=5.00] [cy=2.00] [r=2.00]
+      RenderSVGPath {rect} at (1,1) size 200x200 [fill={[type=PATTERN] [id="pattern1"]}] [x=1.00] [y=1.00] [width=200.00] [height=200.00]
+      RenderSVGPath {rect} at (1,1) size 200x200 [fill={[type=PATTERN] [id="pattern2"]}] [x=1.00] [y=1.00] [width=200.00] [height=200.00]
+    RenderSVGContainer {g} at (10,310) size 231x37
+      RenderSVGText {text} at (10,310) size 231x37 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 231x37
+          chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 231.00: "$Revision: 1.3 $"
+    RenderSVGPath {rect} at (0,0) size 480x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
diff --git a/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg
new file mode 100644
index 0000000..3a365d0
--- /dev/null
+++ b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg
@@ -0,0 +1,63 @@
+<svg id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <!--======================================================================-->
+  <!--=  Copyright 2008 World Wide Web Consortium, (Massachusetts          =-->
+  <!--=  Institute of Technology, European Research Consortium for         =-->
+  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
+  <!--=  All Rights Reserved.                                              =-->
+  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
+  <!--======================================================================-->
+  <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" template-version="1.4" reviewer="ED" author="Microsoft" status="accepted" version="$Revision: 1.3 $" testname="$RCSfile: pservers-pattern-04-f.svg,v $">
+    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/pservers.html#Patterns">
+      <p>
+        Inherited attributes from a referenced 'pattern' are not applied if they are already defined on the referencing 'pattern' element.
+      </p>
+      <p>
+        Define a pattern 'pattern1' with circles that have red fill. Inherit 'pattern1' into 'pattern2' and add circles at different 'y'
+        attribute and with 'fill' set to 'lime' on 'pattern2'. Reference 'pattern1' from a square using 'fill' attribute. Reference 'pattern2'
+        from a different square using 'fill' attribute. Position the second square directly over the first square.  Verify that there is green visible.
+      </p>
+    </d:testDescription>
+    <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        Run the test. No interaction required.
+      </p>
+    </d:operatorScript>
+    <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        The test is passed if there are four green circles visible on the page, and no red.
+      </p>
+    </d:passCriteria>
+  </d:SVGTestCase>
+  <title id="test-title">$RCSfile: pservers-pattern-04-f.svg,v $</title>
+  <defs>
+    <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
+      <font-face-src>
+        <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
+      </font-face-src>
+    </font-face>
+  </defs>
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+    <defs>
+        <pattern id="pattern1" patternUnits="userSpaceOnUse" x="0" y="0" width="100" height="100" viewBox="0 0 10 10">
+            <circle cx="5" cy="5" r="1.9" fill="red"/>
+        </pattern>
+        <pattern id="pattern2" xlink:href="#pattern1" y="30">
+            <circle cx="5" cy="2" r="2" fill="lime"/>
+        </pattern>
+    </defs>
+    <rect fill="url(#pattern1)" stroke="none" x="1" y="1" width="200" height="200"/>
+    <rect fill="url(#pattern2)" stroke="none" x="1" y="1" width="200" height="200"/>
+  </g>
+  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
+    <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.3 $</text>
+  </g>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <!-- comment out this watermark once the test is approved -->
+  <!--
+  <g id="draft-watermark">
+    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
+    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
+      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
+  </g>
+  -->
+</svg>
\ No newline at end of file
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b38ceb8..5c14b4b 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2011-01-20  Dirk Schulze  <krit at 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-19  Stephen White  <senorblanco at chromium.org>
 
         [Re-land of r76159 with a compile fix for the Chromium linux shlib
diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
index 2113a25..be97568 100644
--- a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
+++ b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
@@ -228,7 +228,7 @@ bool RenderSVGResourcePattern::buildTileImageTransform(RenderObject* renderer,
     if (patternBoundaries.width() <= 0 || patternBoundaries.height() <= 0)
         return false;
 
-    AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
+    AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(attributes.viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
 
     // Apply viewBox/objectBoundingBox transformations.
     if (!viewBoxCTM.isIdentity())
diff --git a/Source/WebCore/svg/PatternAttributes.h b/Source/WebCore/svg/PatternAttributes.h
index 613ab94..e4897b0 100644
--- a/Source/WebCore/svg/PatternAttributes.h
+++ b/Source/WebCore/svg/PatternAttributes.h
@@ -27,12 +27,15 @@ namespace WebCore {
 
 class SVGPatternElement;
 
+// FIXME: We need to add PreserveAspectRatio as well.
+// see https://bugs.webkit.org/show_bug.cgi?id=52802
 struct PatternAttributes {
     PatternAttributes()
         : m_x()
         , m_y()
         , m_width()
         , m_height()
+        , m_viewBox()
         , m_boundingBoxMode(true)
         , m_boundingBoxModeContent(false)
         , m_patternContentElement(0)
@@ -44,6 +47,7 @@ struct PatternAttributes {
         , m_boundingBoxModeContentSet(false)
         , m_patternTransformSet(false)
         , m_patternContentElementSet(false)
+        , m_viewBoxSet(false)
     {
     }
 
@@ -51,6 +55,7 @@ struct PatternAttributes {
     SVGLength y() const { return m_y; }
     SVGLength width() const { return m_width; }
     SVGLength height() const { return m_height; }
+    FloatRect viewBox() const { return m_viewBox; }
     bool boundingBoxMode() const { return m_boundingBoxMode; }
     bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
     AffineTransform patternTransform() const { return m_patternTransform; }
@@ -79,6 +84,12 @@ struct PatternAttributes {
         m_height = value;
         m_heightSet = true;
     }
+    
+    void setViewBox(const FloatRect& value)
+    {
+        m_viewBox = value;
+        m_viewBoxSet = true;
+    }
 
     void setBoundingBoxMode(bool value)
     {
@@ -108,6 +119,7 @@ struct PatternAttributes {
     bool hasY() const { return m_ySet; }
     bool hasWidth() const { return m_widthSet; }
     bool hasHeight() const { return m_heightSet; }
+    bool hasViewBox() const { return m_viewBoxSet; }
     bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
     bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; }
     bool hasPatternTransform() const { return m_patternTransformSet; }
@@ -119,6 +131,7 @@ private:
     SVGLength m_y;
     SVGLength m_width;
     SVGLength m_height;
+    FloatRect m_viewBox;
     bool m_boundingBoxMode;
     bool m_boundingBoxModeContent;
     AffineTransform m_patternTransform;
@@ -133,6 +146,7 @@ private:
     bool m_boundingBoxModeContentSet : 1;
     bool m_patternTransformSet : 1;
     bool m_patternContentElementSet : 1;
+    bool m_viewBoxSet : 1;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp
index 29723e7..669d554 100644
--- a/Source/WebCore/svg/SVGPatternElement.cpp
+++ b/Source/WebCore/svg/SVGPatternElement.cpp
@@ -228,6 +228,9 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
         if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAttr))
             attributes.setHeight(current->height());
 
+        if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr))
+            attributes.setViewBox(current->viewBox());
+
         if (!attributes.hasBoundingBoxMode() && current->hasAttribute(SVGNames::patternUnitsAttr))
             attributes.setBoundingBoxMode(current->patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list