[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:28:10 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit d7140cc39ee43e614f0b05b393142c721c49ca11
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 21:26:37 2011 +0000

    2011-01-20  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Rob Buis.
    
            SVG Pattern doesn't take preserveAspectRatio of references Pattern
            https://bugs.webkit.org/show_bug.cgi?id=52802
    
            SVGPattern didn't take preserveAspectRatio of a referenced SVGPattern into account. Store preserveAspectRatio
            in PatternAttributes as well, if the attribute was set on the referenced SVGPattern element.
    
            Test: svg/custom/pattern-referencing-preserve-aspect-ratio.svg
    
            * rendering/svg/RenderSVGResourcePattern.cpp:
            (WebCore::RenderSVGResourcePattern::buildTileImageTransform):
            * svg/PatternAttributes.h:
            (WebCore::PatternAttributes::PatternAttributes):
            (WebCore::PatternAttributes::preserveAspectRatio):
            (WebCore::PatternAttributes::setPreserveAspectRatio):
            (WebCore::PatternAttributes::hasPreserveAspectRatio):
            * svg/SVGPatternElement.cpp:
            (WebCore::SVGPatternElement::collectPatternAttributes):
    2011-01-20  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Rob Buis.
    
            SVG Pattern doesn't take preserveAspectRatio of references Pattern
            https://bugs.webkit.org/show_bug.cgi?id=52802
    
            Added a test case to check that we take preserveAspectRatio of a referenced SVGPattern into account.
    
            * platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.checksum: Added.
            * platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.png: Added.
            * platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt: Added.
            * svg/custom/pattern-referencing-preserve-aspect-ratio.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76274 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b11637e..a562a16 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-20  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Rob Buis.
+
+        SVG Pattern doesn't take preserveAspectRatio of references Pattern
+        https://bugs.webkit.org/show_bug.cgi?id=52802
+
+        Added a test case to check that we take preserveAspectRatio of a referenced SVGPattern into account.
+
+        * platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.checksum: Added.
+        * platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.png: Added.
+        * platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt: Added.
+        * svg/custom/pattern-referencing-preserve-aspect-ratio.svg: Added.
+
 2011-01-20  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Adele Peterson.
diff --git a/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.checksum b/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.checksum
new file mode 100644
index 0000000..cefb087
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.checksum
@@ -0,0 +1 @@
+5e59a146f9355b8d0c18a3b311ad035a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.png b/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.png
new file mode 100644
index 0000000..9072f06
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt b/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt
new file mode 100644
index 0000000..0e2657e
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (80,0) size 60x80
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourcePattern {pattern} [id="pattern1"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+        RenderSVGPath {rect} at (0,0) size 30x40 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [x=0.50] [y=0.50] [width=29.00] [height=39.00]
+        RenderSVGContainer {g} at (5,10) size 20x20 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,5.00)}]
+          RenderSVGPath {circle} at (5,10) size 20x20 [fill={[type=SOLID] [color=#FFFF00]}] [cx=15.00] [cy=15.00] [r=10.00]
+          RenderSVGPath {circle} at (10,15) size 4x4 [fill={[type=SOLID] [color=#000000]}] [cx=12.00] [cy=12.00] [r=1.50]
+          RenderSVGPath {circle} at (15,15) size 4x4 [fill={[type=SOLID] [color=#000000]}] [cx=17.00] [cy=12.00] [r=1.50]
+          RenderSVGPath {path} at (9,23) size 12x5 [stroke={[type=SOLID] [color=#000000] [stroke width=2.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 10 19 C 12.9227 21.34 17.0773 21.34 20 19"]
+      RenderSVGResourcePattern {pattern} [id="pattern2"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+    RenderSVGPath {rect} at (80,0) size 20x80 [fill={[type=PATTERN] [id="pattern1"]}] [x=80.00] [y=0.00] [width=20.00] [height=80.00]
+    RenderSVGPath {rect} at (100,0) size 40x80 [fill={[type=PATTERN] [id="pattern2"]}] [x=100.00] [y=0.00] [width=40.00] [height=80.00]
diff --git a/LayoutTests/svg/custom/pattern-referencing-preserve-aspect-ratio.svg b/LayoutTests/svg/custom/pattern-referencing-preserve-aspect-ratio.svg
new file mode 100644
index 0000000..77ddb46
--- /dev/null
+++ b/LayoutTests/svg/custom/pattern-referencing-preserve-aspect-ratio.svg
@@ -0,0 +1,16 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <defs>
+        <pattern id="pattern1"  patternUnits="userSpaceOnUse" preserveAspectRatio="xMinYMid" x="-20" y="0" width="100" height="80" viewBox="0 0 20 40">
+            <rect x='.5' y='.5' width='29' height='39' fill='black' stroke='red'/>
+            <g transform='translate(0, 5)'>
+                <circle cx='15' cy='15' r='10' fill='yellow'/>
+                <circle cx='12' cy='12' r='1.5' fill='black'/>
+                <circle cx='17' cy='12' r='1.5' fill='black'/>
+                <path d='M 10 19 A 8 8 0 0 0 20 19' stroke='black' stroke-width='2'/>
+            </g>
+        </pattern>
+        <pattern id="pattern2" x="80" xlink:href="#pattern1" viewBox="0 0 20 40"/>
+    </defs>
+    <rect x="80" y="0" width="20" height="80" fill="url(#pattern1)"/>
+    <rect x="100" y="0" width="40" height="80" fill="url(#pattern2)"/>
+</svg>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b1ed296..c975d66 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2011-01-20  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Rob Buis.
+
+        SVG Pattern doesn't take preserveAspectRatio of references Pattern
+        https://bugs.webkit.org/show_bug.cgi?id=52802
+
+        SVGPattern didn't take preserveAspectRatio of a referenced SVGPattern into account. Store preserveAspectRatio
+        in PatternAttributes as well, if the attribute was set on the referenced SVGPattern element.
+
+        Test: svg/custom/pattern-referencing-preserve-aspect-ratio.svg
+
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::buildTileImageTransform):
+        * svg/PatternAttributes.h:
+        (WebCore::PatternAttributes::PatternAttributes):
+        (WebCore::PatternAttributes::preserveAspectRatio):
+        (WebCore::PatternAttributes::setPreserveAspectRatio):
+        (WebCore::PatternAttributes::hasPreserveAspectRatio):
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::collectPatternAttributes):
+
 2011-01-20  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Adele Peterson.
diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
index be97568..1b14ce4 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(attributes.viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
+    AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(attributes.viewBox(), attributes.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 e4897b0..28a29c4 100644
--- a/Source/WebCore/svg/PatternAttributes.h
+++ b/Source/WebCore/svg/PatternAttributes.h
@@ -22,13 +22,12 @@
 
 #if ENABLE(SVG)
 #include "SVGLength.h"
+#include "SVGPreserveAspectRatio.h"
 
 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()
@@ -36,6 +35,7 @@ struct PatternAttributes {
         , m_width()
         , m_height()
         , m_viewBox()
+        , m_preserveAspectRatio()
         , m_boundingBoxMode(true)
         , m_boundingBoxModeContent(false)
         , m_patternContentElement(0)
@@ -43,11 +43,12 @@ struct PatternAttributes {
         , m_ySet(false)
         , m_widthSet(false)
         , m_heightSet(false)
+        , m_viewBoxSet(false)
+        , m_preserveAspectRatioSet(false)
         , m_boundingBoxModeSet(false)
         , m_boundingBoxModeContentSet(false)
         , m_patternTransformSet(false)
         , m_patternContentElementSet(false)
-        , m_viewBoxSet(false)
     {
     }
 
@@ -56,6 +57,7 @@ struct PatternAttributes {
     SVGLength width() const { return m_width; }
     SVGLength height() const { return m_height; }
     FloatRect viewBox() const { return m_viewBox; }
+    SVGPreserveAspectRatio preserveAspectRatio() const { return m_preserveAspectRatio; }
     bool boundingBoxMode() const { return m_boundingBoxMode; }
     bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
     AffineTransform patternTransform() const { return m_patternTransform; }
@@ -91,6 +93,12 @@ struct PatternAttributes {
         m_viewBoxSet = true;
     }
 
+    void setPreserveAspectRatio(const SVGPreserveAspectRatio& value)
+    {
+        m_preserveAspectRatio = value;
+        m_preserveAspectRatioSet = true;
+    }
+
     void setBoundingBoxMode(bool value)
     {
         m_boundingBoxMode = value;
@@ -120,6 +128,7 @@ struct PatternAttributes {
     bool hasWidth() const { return m_widthSet; }
     bool hasHeight() const { return m_heightSet; }
     bool hasViewBox() const { return m_viewBoxSet; }
+    bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; }
     bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
     bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; }
     bool hasPatternTransform() const { return m_patternTransformSet; }
@@ -132,6 +141,7 @@ private:
     SVGLength m_width;
     SVGLength m_height;
     FloatRect m_viewBox;
+    SVGPreserveAspectRatio m_preserveAspectRatio;
     bool m_boundingBoxMode;
     bool m_boundingBoxModeContent;
     AffineTransform m_patternTransform;
@@ -142,11 +152,12 @@ private:
     bool m_ySet : 1;
     bool m_widthSet : 1;
     bool m_heightSet : 1;
+    bool m_viewBoxSet : 1;
+    bool m_preserveAspectRatioSet : 1;
     bool m_boundingBoxModeSet : 1;
     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 669d554..60dfeaf 100644
--- a/Source/WebCore/svg/SVGPatternElement.cpp
+++ b/Source/WebCore/svg/SVGPatternElement.cpp
@@ -231,6 +231,9 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
         if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr))
             attributes.setViewBox(current->viewBox());
 
+        if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNames::preserveAspectRatioAttr))
+            attributes.setPreserveAspectRatio(current->preserveAspectRatio());
+
         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