LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jul 2007 20:42:50 +0000 (20:42 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jul 2007 20:42:50 +0000 (20:42 +0000)
        - test for <rdar://problem/5292364> REGRESSION: ZX Spectrum 3.0 widget - graphic anomalies in widget window frame

        * fast/canvas/fill-stroke-clip-reset-path-expected.checksum: Added.
        * fast/canvas/fill-stroke-clip-reset-path-expected.png: Added.
        * fast/canvas/fill-stroke-clip-reset-path-expected.txt: Added.
        * fast/canvas/fill-stroke-clip-reset-path.html: Added.

WebCore:

        Reviewed by Oliver Hunt.

        - fix <rdar://problem/5292364> REGRESSION: ZX Spectrum 3.0 widget - graphic anomalies in widget window frame

        Updated Dashboard quirk so it affects fill, stroke, and clip, rather than just stroke.

        Test: fast/canvas/fill-stroke-clip-reset-path.html

        * html/CanvasRenderingContext2D.h: Added clearPathForDashboardBackwardCompatibilityMode.
        * html/CanvasRenderingContext2D.cpp:
        (WebCore::CanvasRenderingContext2D::clearPathForDashboardBackwardCompatibilityMode): Added.
        (WebCore::CanvasRenderingContext2D::fill): Call the new function.
        (WebCore::CanvasRenderingContext2D::stroke): Replaced in-line code with a call to the new function.
        (WebCore::CanvasRenderingContext2D::clip): Call the new function.

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

LayoutTests/ChangeLog
LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.checksum [new file with mode: 0644]
LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.png [new file with mode: 0644]
LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/fill-stroke-clip-reset-path.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/CanvasRenderingContext2D.cpp
WebCore/html/CanvasRenderingContext2D.h

index 4d0452bd4923daa68a0fa26aa3c64341fdabf362..82a9026648db503aba529c73262ac8475ac5e858 100644 (file)
@@ -1,3 +1,12 @@
+2007-07-07  Darin Adler  <darin@apple.com>
+
+        - test for <rdar://problem/5292364> REGRESSION: ZX Spectrum 3.0 widget - graphic anomalies in widget window frame
+
+        * fast/canvas/fill-stroke-clip-reset-path-expected.checksum: Added.
+        * fast/canvas/fill-stroke-clip-reset-path-expected.png: Added.
+        * fast/canvas/fill-stroke-clip-reset-path-expected.txt: Added.
+        * fast/canvas/fill-stroke-clip-reset-path.html: Added.
+
 2007-07-07  Rob Buis  <buis@kde.org>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.checksum b/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.checksum
new file mode 100644 (file)
index 0000000..d33cee0
--- /dev/null
@@ -0,0 +1 @@
+1c51dcf67abf153e8bcd2811d8f95e30
\ No newline at end of file
diff --git a/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.png b/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.png
new file mode 100644 (file)
index 0000000..d5fd75d
Binary files /dev/null and b/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.png differ
diff --git a/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.txt b/LayoutTests/fast/canvas/fill-stroke-clip-reset-path-expected.txt
new file mode 100644 (file)
index 0000000..21515aa
--- /dev/null
@@ -0,0 +1,32 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 365x18
+          text run at (0,0) width 365: "All three of these small canvases should be green, not red."
+      RenderBlock (anonymous) at (0,34) size 784x24
+        RenderHTMLCanvas {CANVAS} at (0,0) size 20x20
+        RenderText {#text} at (20,6) size 4x18
+          text run at (20,6) width 4: " "
+        RenderHTMLCanvas {CANVAS} at (24,0) size 20x20
+        RenderText {#text} at (44,6) size 4x18
+          text run at (44,6) width 4: " "
+        RenderHTMLCanvas {CANVAS} at (48,0) size 20x20
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {P} at (0,74) size 784x36
+        RenderText {#text} at (0,0) size 742x36
+          text run at (0,0) width 742: "All three of these small canvases should be green, not red, too, but these test the Dashboard quirks mode so they work"
+          text run at (0,18) width 248: "properly only under DumpRenderTree."
+      RenderBlock (anonymous) at (0,126) size 784x24
+        RenderHTMLCanvas {CANVAS} at (0,0) size 20x20
+        RenderText {#text} at (20,6) size 4x18
+          text run at (20,6) width 4: " "
+        RenderHTMLCanvas {CANVAS} at (24,0) size 20x20
+        RenderText {#text} at (44,6) size 4x18
+          text run at (44,6) width 4: " "
+        RenderHTMLCanvas {CANVAS} at (48,0) size 20x20
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/fast/canvas/fill-stroke-clip-reset-path.html b/LayoutTests/fast/canvas/fill-stroke-clip-reset-path.html
new file mode 100644 (file)
index 0000000..45e71a2
--- /dev/null
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script>
+function testOne(operation, quirk)
+{
+    if (window.layoutTestController)
+        if (layoutTestController.setUseDashboardCompatiblityMode)
+            layoutTestController.setUseDashboardCompatiblityMode(quirk);
+
+    var canvas = document.getElementById(operation + "-" + (quirk ? "" : "no-") + "quirk");
+    var context = canvas.getContext('2d');
+
+    context.fillStyle = quirk ? "green" : "red";
+    context.fillRect(0, 0, 1000, 1000);
+
+    context.moveTo(0, 0);
+    context.lineTo(0, 1000);
+    context.lineTo(1000, 1000);
+    context.lineTo(1000, 0);
+    context.closePath();
+    context[operation]();
+
+    context.fillStyle = quirk ? "red" : "green";
+    context.fill();
+}
+function test()
+{
+    testOne("fill", false);
+    testOne("stroke", false);
+    testOne("clip", false);
+    testOne("fill", true);
+    testOne("stroke", true);
+    testOne("clip", true);
+}
+</script>
+</head>
+<body onload="test()">
+<p>All three of these small canvases should be green, not red.</p>
+<canvas id="fill-no-quirk" width="20" height="20"></canvas>
+<canvas id="stroke-no-quirk" width="20" height="20"></canvas>
+<canvas id="clip-no-quirk" width="20" height="20"></canvas>
+<p>All three of these small canvases should be green, not red, too, but these test the Dashboard compatibility mode so they work properly only under DumpRenderTree.</p>
+<canvas id="fill-quirk" width="20" height="20"></canvas>
+<canvas id="stroke-quirk" width="20" height="20"></canvas>
+<canvas id="clip-quirk" width="20" height="20"></canvas>
+</body>
+</html>
index 5d544f3af132ca45fd841287d18877cc5f9e46ee..010aa1fa0d05ed260cf179e82c9ed82265dafd6d 100644 (file)
@@ -1,3 +1,20 @@
+2007-07-07  Darin Adler  <darin@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        - fix <rdar://problem/5292364> REGRESSION: ZX Spectrum 3.0 widget - graphic anomalies in widget window frame
+
+        Updated Dashboard quirk so it affects fill, stroke, and clip, rather than just stroke.
+
+        Test: fast/canvas/fill-stroke-clip-reset-path.html
+
+        * html/CanvasRenderingContext2D.h: Added clearPathForDashboardBackwardCompatibilityMode.
+        * html/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::clearPathForDashboardBackwardCompatibilityMode): Added.
+        (WebCore::CanvasRenderingContext2D::fill): Call the new function.
+        (WebCore::CanvasRenderingContext2D::stroke): Replaced in-line code with a call to the new function.
+        (WebCore::CanvasRenderingContext2D::clip): Call the new function.
+
 2007-07-07  Rob Buis  <buis@kde.org>
 
         Reviewed and tweaked by Darin.
index ff55173d7a49588a68cc863ad6500513deaa0d21..2a2e43d6639a6dcd6134aa365c4ab65fdb0b06f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
  * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
@@ -430,6 +430,14 @@ void CanvasRenderingContext2D::rect(float x, float y, float width, float height,
     state().m_path.addRect(FloatRect(x, y, width, height));
 }
 
+void CanvasRenderingContext2D::clearPathForDashboardBackwardCompatibilityMode()
+{
+    if (m_canvas)
+        if (Settings* settings = m_canvas->document()->settings())
+            if (settings->usesDashboardBackwardCompatibilityMode())
+                state().m_path.clear();
+}
+
 void CanvasRenderingContext2D::fill()
 {
     GraphicsContext* c = drawingContext();
@@ -467,6 +475,8 @@ void CanvasRenderingContext2D::fill()
         p->fillPath(*path, p->brush());
     }
 #endif
+
+    clearPathForDashboardBackwardCompatibilityMode();
 }
 
 void CanvasRenderingContext2D::stroke()
@@ -512,9 +522,7 @@ void CanvasRenderingContext2D::stroke()
     }
 #endif
 
-    Settings* settings = m_canvas ? m_canvas->document()->settings() : 0;
-    if (settings && settings->usesDashboardBackwardCompatibilityMode())
-        state().m_path.clear();
+    clearPathForDashboardBackwardCompatibilityMode();
 }
 
 void CanvasRenderingContext2D::clip()
@@ -523,6 +531,7 @@ void CanvasRenderingContext2D::clip()
     if (!c)
         return;
     c->clip(state().m_path);
+    clearPathForDashboardBackwardCompatibilityMode();
 }
 
 void CanvasRenderingContext2D::clearRect(float x, float y, float width, float height, ExceptionCode& ec)
index f3cfdff7a9b5a04b57eb7ac85e9ca68cf08d2b7a..a25b515b64746f42dd318514fe6b3c24025a82f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -199,6 +199,8 @@ namespace WebCore {
         void applyStrokePattern();
         void applyFillPattern();
 
+        void clearPathForDashboardBackwardCompatibilityMode();
+
         HTMLCanvasElement* m_canvas;
         Vector<State, 1> m_stateStack;
     };