Reviewed by Nikolas.
authoroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2007 13:34:50 +0000 (13:34 +0000)
committeroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2007 13:34:50 +0000 (13:34 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=11909
        Regression: large SVG from Illustrator comes out blank

        Fix last issue with the Illustrator file by making relativeBBox
        calculation take into account viewBox.

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/container-opacity-clip-viewBox.svg [new file with mode: 0644]
LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/root-container-opacity-clip-viewBox.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderSVGContainer.cpp
WebCore/rendering/RenderSVGRoot.cpp

index 4280941611c9156abb20203625d9a9aaf8f97a90..2a0e9d1d16f80ebe4219530d998c27fddb3104c0 100644 (file)
@@ -1,3 +1,40 @@
+2007-08-08  Rob Buis  <buis@kde.org>
+
+        Reviewed by Nikolas.
+
+        Added testcases for:
+        http://bugs.webkit.org/show_bug.cgi?id=11909
+        Regression: large SVG from Illustrator comes out blank
+
+        Also changed results are included, no pixel tests changed.
+
+        * svg/W3C-SVG-1.1/coords-viewattr-01-b-expected.txt:
+        * svg/W3C-SVG-1.1/coords-viewattr-03-b-expected.txt:
+        * svg/W3C-SVG-1.1/filters-color-01-b-expected.txt:
+        * svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt:
+        * svg/W3C-SVG-1.1/filters-example-01-b-expected.txt:
+        * svg/W3C-SVG-1.1/painting-marker-02-f-expected.txt:
+        * svg/W3C-SVG-1.1/struct-symbol-01-b-expected.txt:
+        * svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
+        * svg/carto.net/textbox-expected.txt:
+        * svg/custom/circular-marker-reference-4-expected.txt:
+        * svg/custom/container-opacity-clip-viewBox-expected.checksum: Added.
+        * svg/custom/container-opacity-clip-viewBox-expected.png: Added.
+        * svg/custom/container-opacity-clip-viewBox-expected.txt: Added.
+        * svg/custom/container-opacity-clip-viewBox.svg: Added.
+        * svg/custom/feComponentTransfer-Discrete-expected.txt:
+        * svg/custom/feComponentTransfer-Gamma-expected.txt:
+        * svg/custom/feComponentTransfer-Linear-expected.txt:
+        * svg/custom/feComponentTransfer-Table-expected.txt:
+        * svg/custom/marker-overflow-clip-expected.txt:
+        * svg/custom/preserve-aspect-ratio-syntax-expected.txt:
+        * svg/custom/root-container-opacity-clip-viewBox-expected.checksum: Added.
+        * svg/custom/root-container-opacity-clip-viewBox-expected.png: Added.
+        * svg/custom/root-container-opacity-clip-viewBox-expected.txt: Added.
+        * svg/custom/root-container-opacity-clip-viewBox.svg: Added.
+        * svg/custom/use-css-events-expected.txt:
+        * svg/custom/viewbox-syntax-expected.txt:
+
 2007-08-08  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Rubber stamped by Oliver.
diff --git a/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.checksum b/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.checksum
new file mode 100644 (file)
index 0000000..443d519
--- /dev/null
@@ -0,0 +1 @@
+8f66467faafc097b1d9a3cbb1d8b8fa8
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.png b/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.png
new file mode 100644 (file)
index 0000000..99c485c
Binary files /dev/null and b/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.png differ
diff --git a/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.txt b/LayoutTests/svg/custom/container-opacity-clip-viewBox-expected.txt
new file mode 100644 (file)
index 0000000..72b9754
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (50,38.20) size 363x225.80
+    RenderSVGContainer {svg} at (59.52,38.20) size 166x148 [opacity=0.90]
+      RenderSVGContainer {g} at (59.52,38.20) size 166x148 [transform={m=((1.00,0.00)(0.00,1.00)) t=(59.52,38.20)}]
+        RenderSVGContainer {svg} at (59.52,38.20) size 166x148
+          RenderPath {rect} at (59.52,38.20) size 166x148 [fill={[type=SOLID] [color=#008000]}] [data="M-83.00,-84.00L83.00,-84.00L83.00,64.00L-83.00,64.00"]
+    RenderSVGContainer {g} at (50,216) size 363x48 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,230.00)}]
+      RenderSVGText {text} at (0,0) size 363x48 contains 3 chunk(s)
+        RenderSVGTSpan {tspan} at (0,0) size 261x18
+          RenderSVGInlineText {#text} at (0,-14) size 261x18
+            chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 45 width 261.00: "For this test case to be successful, the rect"
+        RenderSVGInlineText {#text} at (261,-14) size 4x18
+          chunk 1 text run 2 at (261.00,0.00) startOffset 0 endOffset 1 width 4.00: " "
+        RenderSVGTSpan {tspan} at (0,0) size 359x18
+          RenderSVGInlineText {#text} at (0,1) size 359x18
+            chunk 2 text run 1 at (0.00,15.00) startOffset 0 endOffset 55 width 359.00: "above should be .9 transparant green and 200x200 pixels"
+        RenderSVGInlineText {#text} at (359,1) size 4x18
+          chunk 2 text run 2 at (359.00,15.00) startOffset 0 endOffset 1 width 4.00: " "
+        RenderSVGTSpan {tspan} at (0,0) size 71x18
+          RenderSVGInlineText {#text} at (0,16) size 71x18
+            chunk 3 text run 1 at (0.00,30.00) startOffset 0 endOffset 9 width 71.00: "Bug 11909"
+        RenderSVGInlineText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/svg/custom/container-opacity-clip-viewBox.svg b/LayoutTests/svg/custom/container-opacity-clip-viewBox.svg
new file mode 100644 (file)
index 0000000..562af79
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+
+<svg opacity=".9">
+<g transform="matrix(1 0 0 1 59.5225 38.2007)">
+<svg width="200" height="200" viewBox="-83 -84 200 200">
+<rect x="-83" y="-84" width="166" height="148" fill="green"/>
+</svg>
+</g>
+</svg>
+
+    <g transform="matrix(1 0 0 1 50 230)" pointer-events="none" >
+        <text>
+            <tspan x="0" y="0">For this test case to be successful, the rect</tspan>
+            <tspan x="0" y="15">above should be .9 transparant green and 200x200 pixels</tspan>
+            <tspan x="0" y="30">Bug 11909</tspan>
+        </text>
+    </g>
+
+</svg>
diff --git a/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.checksum b/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.checksum
new file mode 100644 (file)
index 0000000..81da122
--- /dev/null
@@ -0,0 +1 @@
+a217b7c5d6ca903e4b3724c42a815193
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.png b/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.png
new file mode 100644 (file)
index 0000000..3b4e601
Binary files /dev/null and b/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.png differ
diff --git a/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.txt b/LayoutTests/svg/custom/root-container-opacity-clip-viewBox-expected.txt
new file mode 100644 (file)
index 0000000..e949d6d
--- /dev/null
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 166x148 [opacity=0.90]
+    RenderSVGContainer {svg} at (0,0) size 166x148
+      RenderPath {rect} at (0,0) size 166x148 [fill={[type=SOLID] [color=#008000]}] [data="M-83.00,-84.00L83.00,-84.00L83.00,64.00L-83.00,64.00"]
diff --git a/LayoutTests/svg/custom/root-container-opacity-clip-viewBox.svg b/LayoutTests/svg/custom/root-container-opacity-clip-viewBox.svg
new file mode 100644 (file)
index 0000000..91943b5
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" opacity=".9">
+<svg width="200" height="200" viewBox="-83 -84 200 200">
+<rect x="-83" y="-84" width="166" height="148" fill="green"/>
+</svg>
+</svg>
index 60ad1b18a2e35b9e31f295c62ed7e67421e8e769..f53441592e25e60e44a31431a3b19ee699069885 100644 (file)
@@ -1,3 +1,18 @@
+2007-08-08  Rob Buis  <buis@kde.org>
+
+        Reviewed by Nikolas.
+
+        http://bugs.webkit.org/show_bug.cgi?id=11909
+        Regression: large SVG from Illustrator comes out blank
+
+        Fix last issue with the Illustrator file by making relativeBBox
+        calculation take into account viewBox.
+
+        * rendering/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::relativeBBox):
+        * rendering/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::relativeBBox):
+
 2007-08-08  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Oliver.
index 980fbd2c9c64284e8c2bcd974c0af3abd2d0cdc9..a7258b952114fb3e4afa71d117fdbb1970a8f67c 100644 (file)
@@ -495,6 +495,9 @@ FloatRect RenderSVGContainer::relativeBBox(bool includeStroke) const
     for (; current != 0; current = current->nextSibling()) {
         FloatRect childBBox = current->relativeBBox(includeStroke);
         FloatRect mappedBBox = current->localTransform().mapRect(childBBox);
+        // <svg> can have a viewBox contributing to the bbox
+        if (current->isSVGContainer())
+            mappedBBox = static_cast<RenderSVGContainer*>(current)->viewportTransform().mapRect(mappedBBox);
         rect.unite(mappedBBox);
     }
 
index 210c5291a57576e3d2464d6c7220d794db6789ad..17af6743c86404561333a366e4706f2aef96b04d 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "GraphicsContext.h"
 #include "RenderPath.h"
+#include "RenderSVGContainer.h"
 #include "RenderView.h"
 #include "SVGLength.h"
 #include "SVGRenderSupport.h"
@@ -300,6 +301,9 @@ FloatRect RenderSVGRoot::relativeBBox(bool includeStroke) const
     for (; current != 0; current = current->nextSibling()) {
         FloatRect childBBox = current->relativeBBox(includeStroke);
         FloatRect mappedBBox = current->localTransform().mapRect(childBBox);
+        // <svg> can have a viewBox contributing to the bbox
+        if (current->isSVGContainer())
+            mappedBBox = static_cast<RenderSVGContainer*>(current)->viewportTransform().mapRect(mappedBBox);
         rect.unite(mappedBBox);
     }