Reviewed by Eric.
authorrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2006 08:20:13 +0000 (08:20 +0000)
committerrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2006 08:20:13 +0000 (08:20 +0000)
        http://bugzilla.opendarwin.org/show_bug.cgi?id=10405
        REPRO: SVG Maze crashes in RenderPath code

        Do not render a path when it is empty so maze15.svg does not crash anymore.
        Also get rid of a runtime warning issued by CGContextGetPathBoundingBox.

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/dynamic-empty-path-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/dynamic-empty-path-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/dynamic-empty-path-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/dynamic-empty-path.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/kcanvas/RenderPath.cpp
WebCore/kcanvas/device/quartz/KCanvasPathQuartz.mm

index 82ad1d5..a14974e 100644 (file)
@@ -1,3 +1,16 @@
+2006-08-22  Rob Buis  <buis@kde.org>
+
+        Reviewed by Eric.
+
+        Testcase needed for:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10405
+        REPRO: SVG Maze crashes in RenderPath code
+
+        * svg/custom/dynamic-empty-path-expected.checksum: Added.
+        * svg/custom/dynamic-empty-path-expected.png: Added.
+        * svg/custom/dynamic-empty-path-expected.txt: Added.
+        * svg/custom/dynamic-empty-path.svg: Added.
+
 2006-08-21  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Eric.
diff --git a/LayoutTests/svg/custom/dynamic-empty-path-expected.checksum b/LayoutTests/svg/custom/dynamic-empty-path-expected.checksum
new file mode 100644 (file)
index 0000000..54508cd
--- /dev/null
@@ -0,0 +1 @@
+b6fc66bf9e76b4e2b2bcab6743de6675
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/dynamic-empty-path-expected.png b/LayoutTests/svg/custom/dynamic-empty-path-expected.png
new file mode 100644 (file)
index 0000000..bb6be4b
Binary files /dev/null and b/LayoutTests/svg/custom/dynamic-empty-path-expected.png differ
diff --git a/LayoutTests/svg/custom/dynamic-empty-path-expected.txt b/LayoutTests/svg/custom/dynamic-empty-path-expected.txt
new file mode 100644 (file)
index 0000000..8d758b7
--- /dev/null
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+    KCanvasContainer {svg} at (37.75,37.75) size 75.50x75.50
+      KCanvasItem {path} at (37.75,37.75) size 75.50x75.50 [fill={[type=SOLID] [color=#008000]}] [data="M100.00,100.00L300.00,100.00L200.00,300.00"]
+      KCanvasItem {path} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FF0000]}] [data=""]
diff --git a/LayoutTests/svg/custom/dynamic-empty-path.svg b/LayoutTests/svg/custom/dynamic-empty-path.svg
new file mode 100644 (file)
index 0000000..154abda
--- /dev/null
@@ -0,0 +1,10 @@
+<svg width="4cm" height="4cm" viewBox="0 0 400 400"
+     xmlns="http://www.w3.org/2000/svg" version="1.1">
+  <path id="y" d="M 100 100 L 300 100 L 200 300"
+        fill="green" />
+  <path id="x" d="M 100 100 L 300 100 L 200 300"
+        fill="red" />
+  <script type="text/javascript">
+    document.getElementById('x').attributes['d'].value='';
+  </script>
+</svg>
index 100abec..d296613 100644 (file)
@@ -1,3 +1,18 @@
+2006-08-22  Rob Buis  <buis@kde.org>
+
+        Reviewed by Eric.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10405
+        REPRO: SVG Maze crashes in RenderPath code
+
+        Do not render a path when it is empty so maze15.svg does not crash anymore.
+        Also get rid of a runtime warning issued by CGContextGetPathBoundingBox.
+
+        * kcanvas/RenderPath.cpp:
+        (WebCore::RenderPath::paint):
+        * kcanvas/device/quartz/KCanvasPathQuartz.mm:
+        (WebCore::KCanvasPathQuartz::strokeBoundingBox):
+
 2006-08-21  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Maciej
index 6562028..bf6d151 100644 (file)
@@ -198,7 +198,7 @@ void RenderPath::paint(PaintInfo &paintInfo, int parentX, int parentY)
     //ASSERT(parentX == 0);
     //ASSERT(parentY == 0);
 
-    if (paintInfo.p->paintingDisabled() || (paintInfo.phase != PaintPhaseForeground) || style()->visibility() == HIDDEN)
+    if (paintInfo.p->paintingDisabled() || (paintInfo.phase != PaintPhaseForeground) || style()->visibility() == HIDDEN || !path())
         return;
     
     KRenderingDevice* device = renderingDevice();
index fa7811c..5115225 100644 (file)
@@ -97,6 +97,8 @@ FloatRect KCanvasPathQuartz::strokeBoundingBox(const KRenderingStrokePainter& st
     // perhaps it would be sufficien to just outset the fill bbox by
     // the stroke width - that should be way cheaper and simpler than
     // what we do here.
+    if (isEmpty())
+        return CGRectNull;
 
     CGContextRef context = scratchContext();
     CGContextSaveGState(context);