Reviewed by Eric.
authorrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Sep 2006 09:22:18 +0000 (09:22 +0000)
committerrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Sep 2006 09:22:18 +0000 (09:22 +0000)
        http://bugzilla.opendarwin.org/show_bug.cgi?id=6546
        clipPath data does not respect transforms

        Get the transform from the dom element and adjust
        the clip path with it.

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/clip-path-with-transform-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/clip-path-with-transform-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/clip-path-with-transform-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/clip-path-with-transform.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/ksvg2/svg/SVGClipPathElement.cpp

index cc3f08ab2db86bb8beb6950dfb9e5bec07de3cb8..ac345aa4e4479997d7acb51f48a4a56fcb5ad039 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-04  Rob Buis  <buis@kde.org>
+
+        Reviewed by Eric.
+
+        Testcase needed for:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=6546
+        clipPath data does not respect transforms
+
+        * svg/custom/clip-path-with-transform-expected.checksum: Added.
+        * svg/custom/clip-path-with-transform-expected.png: Added.
+        * svg/custom/clip-path-with-transform-expected.txt: Added.
+        * svg/custom/clip-path-with-transform.svg: Added.
+
 2006-09-03  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Tim H.
diff --git a/LayoutTests/svg/custom/clip-path-with-transform-expected.checksum b/LayoutTests/svg/custom/clip-path-with-transform-expected.checksum
new file mode 100644 (file)
index 0000000..3a4f1f7
--- /dev/null
@@ -0,0 +1 @@
+16310588467cfc20d551635abc59b784
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/clip-path-with-transform-expected.png b/LayoutTests/svg/custom/clip-path-with-transform-expected.png
new file mode 100644 (file)
index 0000000..3db2634
Binary files /dev/null and b/LayoutTests/svg/custom/clip-path-with-transform-expected.png differ
diff --git a/LayoutTests/svg/custom/clip-path-with-transform-expected.txt b/LayoutTests/svg/custom/clip-path-with-transform-expected.txt
new file mode 100644 (file)
index 0000000..7f41d60
--- /dev/null
@@ -0,0 +1,8 @@
+KCanvasResource {id="myclip" [type=CLIPPER] [clip data=[[winding=NON-ZERO] [path=M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00]]]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+    KCanvasContainer {svg} at (0,0) size 200x200
+      KCanvasContainer {defs} at (0,0) size 0x0
+      KCanvasContainer {g} at (0,0) size 200x200 [clip path="#myclip"]
+        KCanvasItem {rect} at (0,0) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00L200.00,0.00L200.00,200.00L0.00,200.00"]
+        KCanvasItem {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
diff --git a/LayoutTests/svg/custom/clip-path-with-transform.svg b/LayoutTests/svg/custom/clip-path-with-transform.svg
new file mode 100644 (file)
index 0000000..441163d
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+    <clipPath id="myclip">
+        <path transform="scale(.5)" d="M 0 0 l 200 0 l 0 200 l -200 0 Z"/>
+    </clipPath>
+</defs>
+<g  clip-path="url(#myclip)">
+<rect x="0" y="0" width="200" height="200" fill="red"/>
+<rect x="0" y="0" width="100" height="100" fill="green"/>
+</g>
+</svg>
+
index 8403ec081b66c454ca8b04a9f4f46a9b754c4005..615108a49de2e493ab48999758c316559a4b3e63 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-04  Rob Buis  <buis@kde.org>
+
+        Reviewed by Eric.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=6546
+        clipPath data does not respect transforms
+
+        Get the transform from the dom element and adjust
+        the clip path with it.
+
+        * ksvg2/svg/SVGClipPathElement.cpp:
+        (SVGClipPathElement::canvasResource):
+
 2006-09-04  Rob Buis  <buis@kde.org>
 
         Reviewed by Eric.
index d8c19ae22091adf9061e30421558030e2b4c0494..f8e2769bf6d8264c0d320d8bfd7e52d6e9d91e84 100644 (file)
@@ -30,6 +30,7 @@
 #include "SVGAnimatedEnumeration.h"
 #include "SVGHelper.h"
 #include "SVGNames.h"
+#include "SVGMatrix.h"
 #include "SVGRenderStyle.h"
 #include "cssstyleselector.h"
 #include "ksvg.h"
@@ -96,6 +97,8 @@ KCanvasClipper *SVGClipPathElement::canvasResource()
             SVGStyledElement *styled = static_cast<SVGStyledElement *>(e);
             RenderStyle *pathStyle = document()->styleSelector()->styleForElement(styled, clipPathStyle);
             Path pathData = styled->toPathData();
+            if (e->isStyledTransformable())
+                pathData.transform(static_cast<SVGStyledTransformableElement *>(e)->localMatrix()->matrix());
             if (!pathData.isEmpty())
                 m_clipper->addClipData(pathData, pathStyle->svgStyle()->clipRule(), bbox);
             pathStyle->deref(view()->renderArena());