[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

krit at webkit.org krit at webkit.org
Thu Oct 29 20:44:48 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 4b3339c55bf5a617073c64ccd328263f1e985013
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 14 23:21:46 2009 +0000

    2009-10-14  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG Masking with wrong offset
            [https://bugs.webkit.org/show_bug.cgi?id=30325]
    
            SVGMaskElement moves the mask image graphics context to the wrong location.
            In objectBoundingBoxMode the maskDestRect gets translated. This transformation
            is not used in the later calculation. Fix by consistenly calculating the translation
            offsets from the final mask destination rect.
    
            Test: svg/custom/mask-with-default-value.svg
    
            * svg/SVGMaskElement.cpp:
            (WebCore::SVGMaskElement::drawMaskerContent):
    
    2009-10-14  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG Masking with wrong offset
            [https://bugs.webkit.org/show_bug.cgi?id=30325]
    
            SVGMaskElement moves the mask image graphics context to the wrong location.
            In objectBoundingBoxMode the maskDestRect gets translated. This transformation
            is not used in the later calculation. Fix by consistenly calculating the translation
            offsets from the final mask destination rect.
    
            Test: svg/custom/mask-with-default-value.svg
    
            * svg/SVGMaskElement.cpp:
            (WebCore::SVGMaskElement::drawMaskerContent):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49598 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c275440..c45bf8a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-14  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Check if the offset of a SVG mask is correct on using default values.
+
+        * platform/mac/svg/custom/mask-with-default-value-expected.checksum: Added.
+        * platform/mac/svg/custom/mask-with-default-value-expected.png: Added.
+        * platform/mac/svg/custom/mask-with-default-value-expected.txt: Added.
+        * svg/custom/mask-with-default-value.svg: Added.
+
 2009-10-14  Darin Adler  <darin at apple.com>
 
         Reviewed by Mark Rowe.
diff --git a/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.checksum b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.checksum
new file mode 100644
index 0000000..a5070ab
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.checksum
@@ -0,0 +1 @@
+8462096e924511b217112ec28c1a0881
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.png b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.png
new file mode 100644
index 0000000..8ea9802
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt
new file mode 100644
index 0000000..06862dd
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt
@@ -0,0 +1,10 @@
+KCanvasResource {id="m1" [type=MASKER]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 120x120
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGContainer {mask} at (0,0) size 800x600
+        RenderPath {rect} at (0,0) size 800x600 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00 L800.00,0.00 L800.00,600.00 L0.00,600.00 Z"]
+    RenderPath {rect} at (0,0) size 120x120 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L120.00,0.00 L120.00,120.00 L0.00,120.00 Z"]
+    RenderPath {rect} at (10,10) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,10.00 L110.00,10.00 L110.00,110.00 L10.00,110.00 Z"]
diff --git a/LayoutTests/svg/custom/mask-with-default-value.svg b/LayoutTests/svg/custom/mask-with-default-value.svg
new file mode 100644
index 0000000..f7f60a9
--- /dev/null
+++ b/LayoutTests/svg/custom/mask-with-default-value.svg
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs>
+<mask id="m1">
+<rect x="0%" y="0%" width="100%" height="100%"/>
+</mask>
+</defs>
+<rect x="0" y="0" width="120" height="120" fill="green"/>
+<rect x="10" y="10" width="100" height="100" fill="red" mask="url(#m1)" />
+</svg>
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2ee5bd1..5c0ac4a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-14  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG Masking with wrong offset
+        [https://bugs.webkit.org/show_bug.cgi?id=30325]
+
+        SVGMaskElement moves the mask image graphics context to the wrong location.
+        In objectBoundingBoxMode the maskDestRect gets translated. This transformation
+        is not used in the later calculation. Fix by consistenly calculating the translation
+        offsets from the final mask destination rect.
+
+        Test: svg/custom/mask-with-default-value.svg
+
+        * svg/SVGMaskElement.cpp:
+        (WebCore::SVGMaskElement::drawMaskerContent):
+
 2009-10-14  Kevin Decker  <kdecker at apple.com>
 
         Rubberstamped by Jon Honeycutt.
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index e769438..4b4833b 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -130,37 +130,30 @@ void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, N
 PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetRect, FloatRect& maskDestRect) const
 {    
     // Determine specified mask size
-    float xValue;
-    float yValue;
-    float widthValue;
-    float heightValue;
-
-    if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
-        xValue = x().valueAsPercentage() * targetRect.width();
-        yValue = y().valueAsPercentage() * targetRect.height();
-        widthValue = width().valueAsPercentage() * targetRect.width();
-        heightValue = height().valueAsPercentage() * targetRect.height();
-    } else {
-        xValue = x().value(this);
-        yValue = y().value(this);
-        widthValue = width().value(this);
-        heightValue = height().value(this);
-    } 
-
-    IntSize imageSize(lroundf(widthValue), lroundf(heightValue));
+    if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+        maskDestRect = FloatRect(x().valueAsPercentage() * targetRect.width(),
+                                 y().valueAsPercentage() * targetRect.height(),
+                                 width().valueAsPercentage() * targetRect.width(),
+                                 height().valueAsPercentage() * targetRect.height());
+    else
+        maskDestRect = FloatRect(x().value(this),
+                                 y().value(this),
+                                 width().value(this),
+                                 height().value(this));
+
+    IntSize imageSize(lroundf(maskDestRect.width()), lroundf(maskDestRect.height()));
     clampImageBufferSizeToViewport(document()->view(), imageSize);
 
-    if (imageSize.width() < static_cast<int>(widthValue))
-        widthValue = imageSize.width();
+    if (imageSize.width() < static_cast<int>(maskDestRect.width()))
+        maskDestRect.setWidth(imageSize.width());
 
-    if (imageSize.height() < static_cast<int>(heightValue))
-        heightValue = imageSize.height();
+    if (imageSize.height() < static_cast<int>(maskDestRect.height()))
+        maskDestRect.setHeight(imageSize.height());
 
     OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(imageSize);
     if (!maskImage)
         return 0;
 
-    maskDestRect = FloatRect(xValue, yValue, widthValue, heightValue);
     if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
         maskDestRect.move(targetRect.x(), targetRect.y());
 
@@ -168,7 +161,7 @@ PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targe
     ASSERT(maskImageContext);
 
     maskImageContext->save();
-    maskImageContext->translate(-xValue, -yValue);
+    maskImageContext->translate(-maskDestRect.x(), -maskDestRect.y());
 
     if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         maskImageContext->save();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list