2010-01-17 Oliver Hunt <oliver@apple.com>
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jan 2010 03:59:54 +0000 (03:59 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jan 2010 03:59:54 +0000 (03:59 +0000)
        Reviewed by Dan Bernstein.

        REGRESSION (r52449): SVG mask wrongly clipped when not at origin for recent nightly build
        https://bugs.webkit.org/show_bug.cgi?id=33782

        Testcase for a mask containing transformed elements

        * platform/mac/svg/custom/transformedMaskFails-expected.png: Added.
        * svg/custom/transformedMaskFails-expected.txt: Added.
        * svg/custom/transformedMaskFails.svg: Added.
2010-01-17  Oliver Hunt  <oliver@apple.com>

        Reviewed by Dan Bernstein.

        REGRESSION (r52449): SVG mask wrongly clipped when not at origin for recent nightly build
        https://bugs.webkit.org/show_bug.cgi?id=33782

        Test: svg/custom/transformedMaskFails.svg

        When computing the bounds for elements in a mask, we iterate through
        all of our children requesting their repaint bounds using
        repaintRectInLocalCoordinates(), but we were not converting that
        rect into our own coordinate system, thus leading to an incorrect
        repaint rect.  This patch simply adds the missing localToParent
        transform.

        * svg/SVGMaskElement.cpp:
        (WebCore::SVGMaskElement::drawMaskerContent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@53388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/custom/transformedMaskFails-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/transformedMaskFails-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/transformedMaskFails.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/svg/SVGMaskElement.cpp

index 9b5a170..545c45c 100644 (file)
@@ -1,3 +1,16 @@
+2010-01-17  Oliver Hunt  <oliver@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        REGRESSION (r52449): SVG mask wrongly clipped when not at origin for recent nightly build
+        https://bugs.webkit.org/show_bug.cgi?id=33782
+
+        Testcase for a mask containing transformed elements
+
+        * platform/mac/svg/custom/transformedMaskFails-expected.png: Added.
+        * svg/custom/transformedMaskFails-expected.txt: Added.
+        * svg/custom/transformedMaskFails.svg: Added.
+
 2010-01-15  Jon Honeycutt  <jhoneycutt@apple.com>
 
         MSAA: Screen rect for <option> elements is always the zero rect
diff --git a/LayoutTests/platform/mac/svg/custom/transformedMaskFails-expected.png b/LayoutTests/platform/mac/svg/custom/transformedMaskFails-expected.png
new file mode 100644 (file)
index 0000000..cd5ec1a
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/transformedMaskFails-expected.png differ
diff --git a/LayoutTests/svg/custom/transformedMaskFails-expected.txt b/LayoutTests/svg/custom/transformedMaskFails-expected.txt
new file mode 100644 (file)
index 0000000..04f9995
--- /dev/null
@@ -0,0 +1,11 @@
+KCanvasResource {id="mask" [type=MASKER]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (100,100) size 100x100
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGContainer {mask} at (100,100) size 150x150
+        RenderSVGContainer {g} at (100,100) size 150x150 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,100.00)}]
+          RenderPath {rect} at (100,100) size 150x150 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00 L150.00,0.00 L150.00,150.00 L0.00,150.00 Z"]
+    RenderPath {rect} at (100,100) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M100.00,100.00 L200.00,100.00 L200.00,200.00 L100.00,200.00 Z"]
+    RenderPath {rect} at (100,100) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M100.00,100.00 L200.00,100.00 L200.00,200.00 L100.00,200.00 Z"]
diff --git a/LayoutTests/svg/custom/transformedMaskFails.svg b/LayoutTests/svg/custom/transformedMaskFails.svg
new file mode 100644 (file)
index 0000000..3165ded
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<defs>
+    <mask id="mask">
+    <g transform="translate(100,100)">
+        <rect width="150" height="150" fill="white" />
+    </g>
+    </mask>
+</defs>
+
+<rect x="100" y="100" width="100" height="100" fill="red"/>
+<rect x="100" y="100" width="100" height="100" fill="green" mask="url(#mask)" />
+
+</svg>
index fad5743..4e39701 100644 (file)
@@ -1,3 +1,22 @@
+2010-01-17  Oliver Hunt  <oliver@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        REGRESSION (r52449): SVG mask wrongly clipped when not at origin for recent nightly build
+        https://bugs.webkit.org/show_bug.cgi?id=33782
+
+        Test: svg/custom/transformedMaskFails.svg
+
+        When computing the bounds for elements in a mask, we iterate through
+        all of our children requesting their repaint bounds using
+        repaintRectInLocalCoordinates(), but we were not converting that
+        rect into our own coordinate system, thus leading to an incorrect
+        repaint rect.  This patch simply adds the missing localToParent
+        transform.
+
+        * svg/SVGMaskElement.cpp:
+        (WebCore::SVGMaskElement::drawMaskerContent):
+
 2010-01-17  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Dan Bernstein.
index e7e3e4b..63bd9e6 100644 (file)
@@ -169,7 +169,7 @@ PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const RenderObject* ob
             continue;
 
         rendererList.append(node->renderer());
-        repaintRect.unite(node->renderer()->repaintRectInLocalCoordinates());
+        repaintRect.unite(node->renderer()->localToParentTransform().mapRect(node->renderer()->repaintRectInLocalCoordinates()));
     }
 
     TransformationMatrix contextTransform;