Reviewed by Eric.
authoroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2007 12:19:39 +0000 (12:19 +0000)
committeroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2007 12:19:39 +0000 (12:19 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=14051
        <svg:image> fails to position correctly when <svg> is inside an inline <div>

        Leave parent translation to the containers.

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/image-parent-translation-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/image-parent-translation-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/image-parent-translation-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/image-parent-translation.xhtml [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderSVGImage.cpp

index 1a0713d9db91f6422be189caf02ea191875056fc..c478cfb561db7595aa290148b2474fda16c39949 100644 (file)
@@ -1,3 +1,16 @@
+2007-06-15  Rob Buis  <buis@kde.org>
+
+        Reviewed by Eric.
+
+        Testcase for:
+        http://bugs.webkit.org/show_bug.cgi?id=14051
+        <svg:image> fails to position correctly when <svg> is inside an inline <div>
+
+        * svg/custom/image-parent-translation-expected.checksum: Added.
+        * svg/custom/image-parent-translation-expected.png: Added.
+        * svg/custom/image-parent-translation-expected.txt: Added.
+        * svg/custom/image-parent-translation.xhtml: Added.
+
 2007-06-14  Rob Buis  <buis@kde.org>
 
         Reviewed by Eric.
diff --git a/LayoutTests/svg/custom/image-parent-translation-expected.checksum b/LayoutTests/svg/custom/image-parent-translation-expected.checksum
new file mode 100644 (file)
index 0000000..5c1aab1
--- /dev/null
@@ -0,0 +1 @@
+81157aaf37c322f5784e23291935dc62
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/image-parent-translation-expected.png b/LayoutTests/svg/custom/image-parent-translation-expected.png
new file mode 100644 (file)
index 0000000..e8d55ac
Binary files /dev/null and b/LayoutTests/svg/custom/image-parent-translation-expected.png differ
diff --git a/LayoutTests/svg/custom/image-parent-translation-expected.txt b/LayoutTests/svg/custom/image-parent-translation-expected.txt
new file mode 100644 (file)
index 0000000..93f5fd9
--- /dev/null
@@ -0,0 +1,28 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x218
+  RenderBlock {html} at (0,0) size 800x218
+    RenderBody {body} at (8,21) size 784x189
+      RenderBlock {h1} at (0,0) size 784x37
+        RenderText {#text} at (0,0) size 495x37
+          text run at (0,0) width 495: "SVG Images in Inline CSS Elements"
+      RenderBlock {p} at (0,58) size 784x36
+        RenderText {#text} at (0,0) size 756x36
+          text run at (0,0) width 756: "The two following blocks should display side-by-side a 75x75 pixels image with a 3 pixels border overlaid on top of the"
+          text run at (0,18) width 127: "image (Bug 14051)."
+      RenderBlock (anonymous) at (0,110) size 784x79
+        RenderInline {div} at (0,0) size 79x18
+          RenderText {#text} at (0,0) size 0x0
+          RenderSVGContainer {svg} at (5,128) size 81x81
+            RenderImage {image} at (0,0) size 75x75
+            RenderPath {rect} at (5,128) size 81x81 [stroke={[type=SOLID] [color=#FF0000] [stroke width=6.00]}] [data="M0.00,0.00L75.00,0.00L75.00,75.00L0.00,75.00"]
+          RenderText {#text} at (75,61) size 4x18
+            text run at (75,61) width 4: " "
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {div} at (0,0) size 75x18
+          RenderText {#text} at (0,0) size 0x0
+          RenderSVGContainer {svg} at (5,128) size 81x81
+            RenderImage {image} at (0,0) size 75x75
+            RenderPath {rect} at (5,128) size 81x81 [stroke={[type=SOLID] [color=#FF0000] [stroke width=6.00]}] [data="M0.00,0.00L75.00,0.00L75.00,75.00L0.00,75.00"]
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/svg/custom/image-parent-translation.xhtml b/LayoutTests/svg/custom/image-parent-translation.xhtml
new file mode 100644 (file)
index 0000000..80a9922
--- /dev/null
@@ -0,0 +1,29 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <head>
+    <title> &lt;svg:image&gt; fails to position correctly when &lt;svg&gt; is inside an inline &lt;div&gt; (Bug 14051)</title>
+    <style>
+      div {
+        display: inline;
+      }
+    </style>
+  </head>
+
+  <body>
+    <h1>SVG Images in Inline CSS Elements</h1>
+    <p>
+      The two following blocks should display side-by-side a 75x75 pixels image with a 3 pixels border overlaid on top of the image (Bug 14051).
+    </p>
+    <div>
+      <svg xmlns="http://www.w3.org/2000/svg" width="75" height="75">
+        <image xlink:href="resources/green-checker.png" width="75" height="75" />
+        <rect width="75" height="75" stroke="red" stroke-width="6" fill="none" />
+      </svg>        
+    </div>
+    <div>
+      <svg xmlns="http://www.w3.org/2000/svg" width="75" height="75">
+        <image xlink:href="resources/green-checker.png" width="75" height="75" />
+        <rect width="75" height="75" stroke="red" stroke-width="6" fill="none" />
+      </svg>        
+    </div>
+  </body>
+</html>
index e1d6a60fd24a5baa4eb43e06ee88df7ede1925c5..93e8e9f23ee6c128f7149b551c0d59c1d26903d2 100644 (file)
@@ -1,3 +1,15 @@
+2007-06-15  Rob Buis  <buis@kde.org>
+
+        Reviewed by Eric.
+
+        http://bugs.webkit.org/show_bug.cgi?id=14051
+        <svg:image> fails to position correctly when <svg> is inside an inline <div>
+
+        Leave parent translation to the containers.
+
+        * rendering/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::paint):
+
 2007-06-15  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Eric.
index 392ff97e63dda74423e7c89a565462345ef2f5d0..04d820cab2c71160abbcf26a3b44fe09b3675a5b 100644 (file)
@@ -124,13 +124,12 @@ void RenderSVGImage::adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& s
     }
 }
 
-void RenderSVGImage::paint(PaintInfo& paintInfo, int parentX, int parentY)
+void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
 {
     if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN)
         return;
     
     paintInfo.context->save();
-    paintInfo.context->concatCTM(AffineTransform().translate(parentX, parentY));
     paintInfo.context->concatCTM(localTransform());
     paintInfo.context->concatCTM(translationForAttributes());
     
@@ -172,7 +171,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int parentX, int parentY)
     }
     
     if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
-        paintOutline(paintInfo.context, parentX, parentY, width(), height(), style());
+        paintOutline(paintInfo.context, 0, 0, width(), height(), style());
 
     paintInfo.context->restore();
 }