[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

commit-queue at webkit.org commit-queue at webkit.org
Sun Feb 20 23:22:30 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 3b7f79bfb6c3d6ef1e341428c4e05bf103f1c41f
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 05:57:51 2011 +0000

    2011-01-19  Helder Correia  <helder at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt] GraphicsContext::strokePath() paints solid shadows with incorrect alpha
            https://bugs.webkit.org/show_bug.cgi?id=52705
    
            This is related to bug 52611. The shadow color alpha must be multiplied
            by the context pen alpha. Fixing this results in correct behavior for
            Canvas path stroke() and strokeRect() [which relies on stroke()].
    
            * fast/canvas/canvas-strokePath-alpha-shadow-expected.txt: Added.
            * fast/canvas/canvas-strokePath-alpha-shadow.html: Added.
            * fast/canvas/canvas-strokeRect-alpha-shadow-expected.txt: Added.
            * fast/canvas/canvas-strokeRect-alpha-shadow.html: Added.
            * fast/canvas/script-tests/canvas-strokePath-alpha-shadow.js: Added.
            * fast/canvas/script-tests/canvas-strokeRect-alpha-shadow.js: Added.
    2011-01-19  Helder Correia  <helder at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt] GraphicsContext::strokePath() paints solid shadows with incorrect alpha
            https://bugs.webkit.org/show_bug.cgi?id=52705
    
            This is related to bug 52611. The shadow color alpha must be multiplied
            by the context pen alpha. Fixing this results in correct behavior for
            Canvas path stroke() and strokeRect() [which relies on stroke()].
    
            Tests: fast/canvas/canvas-strokePath-alpha-shadow.html
                   fast/canvas/canvas-strokeRect-alpha-shadow.html
    
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::GraphicsContext::strokePath):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76206 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e8c116e..1f6f4eb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-19  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] GraphicsContext::strokePath() paints solid shadows with incorrect alpha
+        https://bugs.webkit.org/show_bug.cgi?id=52705
+
+        This is related to bug 52611. The shadow color alpha must be multiplied
+        by the context pen alpha. Fixing this results in correct behavior for
+        Canvas path stroke() and strokeRect() [which relies on stroke()].
+
+        * fast/canvas/canvas-strokePath-alpha-shadow-expected.txt: Added.
+        * fast/canvas/canvas-strokePath-alpha-shadow.html: Added.
+        * fast/canvas/canvas-strokeRect-alpha-shadow-expected.txt: Added.
+        * fast/canvas/canvas-strokeRect-alpha-shadow.html: Added.
+        * fast/canvas/script-tests/canvas-strokePath-alpha-shadow.js: Added.
+        * fast/canvas/script-tests/canvas-strokeRect-alpha-shadow.js: Added.
+
 2011-01-14  Darin Fisher  <darin at chromium.org>
 
         Reviewed by Mihai Parparita.
diff --git a/LayoutTests/fast/canvas/canvas-strokePath-alpha-shadow-expected.txt b/LayoutTests/fast/canvas/canvas-strokePath-alpha-shadow-expected.txt
new file mode 100644
index 0000000..d4ac238
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-strokePath-alpha-shadow-expected.txt
@@ -0,0 +1,97 @@
+Ensure correct behavior of canvas with path stroke using a strokeStyle color with alpha and a shadow
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Verifying alpha shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+ 
+Verifying blurry shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+ 
+Verifying rotated alpha shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+ 
+Verifying rotated blurry shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 31
+ 
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-strokePath-alpha-shadow.html b/LayoutTests/fast/canvas/canvas-strokePath-alpha-shadow.html
new file mode 100644
index 0000000..6b8838a
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-strokePath-alpha-shadow.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/canvas-strokePath-alpha-shadow.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/canvas-strokeRect-alpha-shadow-expected.txt b/LayoutTests/fast/canvas/canvas-strokeRect-alpha-shadow-expected.txt
new file mode 100644
index 0000000..67726ad
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-strokeRect-alpha-shadow-expected.txt
@@ -0,0 +1,213 @@
+Ensure correct behavior of canvas with strokeRect using a semi-transparent solid strokeStyle and a shadow
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Verifying alpha shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+ 
+Verifying blurry shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+ 
+Verifying rotated alpha shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+ 
+Verifying rotated blurry shadow...
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is around 64
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+PASS data[0] is 0
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] is 0
+ 
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-strokeRect-alpha-shadow.html b/LayoutTests/fast/canvas/canvas-strokeRect-alpha-shadow.html
new file mode 100644
index 0000000..bf8b4b2
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-strokeRect-alpha-shadow.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/canvas-strokeRect-alpha-shadow.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-strokePath-alpha-shadow.js b/LayoutTests/fast/canvas/script-tests/canvas-strokePath-alpha-shadow.js
new file mode 100644
index 0000000..d063c7a
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-strokePath-alpha-shadow.js
@@ -0,0 +1,114 @@
+description("Ensure correct behavior of canvas with path stroke using a strokeStyle color with alpha and a shadow");
+
+function print(message, color)
+{
+    var paragraph = document.createElement("div");
+    paragraph.appendChild(document.createTextNode(message));
+    paragraph.style.fontFamily = "monospace";
+    if (color)
+        paragraph.style.color = color;
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function shouldBeAround(a, b)
+{
+    var evalA;
+    try {
+        evalA = eval(a);
+    } catch(e) {
+        evalA = e;
+    }
+
+    if (Math.abs(evalA - b) < 15)
+        print("PASS " + a + " is around " + b , "green")
+    else
+        print("FAIL " + a + " is not around " + b + " (actual: " + evalA + ")", "red");
+}
+
+var canvas = document.createElement('canvas');
+document.body.appendChild(canvas);
+canvas.setAttribute('width', '600');
+canvas.setAttribute('height', '1100');
+var ctx = canvas.getContext('2d');
+
+ctx.save();
+ctx.strokeStyle = 'rgba(0, 0, 255, 0.5)';
+ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
+ctx.shadowOffsetX = 250;
+ctx.lineWidth = 50;
+
+function strokePath(x, y) {
+    ctx.beginPath();
+    ctx.arc(x, y, 75, 0, Math.PI*2, true);
+    ctx.stroke();
+}
+
+// Alpha shadow.
+ctx.shadowBlur = 0;
+strokePath(150, 150);
+
+// Blurry shadow.
+ctx.shadowBlur = 10;
+strokePath(150, 400);
+
+ctx.rotate(Math.PI/2);
+
+// Rotated alpha shadow.
+ctx.shadowBlur = 0;
+strokePath(650, -150);
+
+// Rotated blurry shadow.
+ctx.shadowBlur = 10;
+strokePath(900, -150);
+
+ctx.restore();
+
+var imageData, data;
+ctx.fillStyle = 'black';
+
+function test(alphaTestFunction, x, y, r, g, b, a) {
+    // Get pixel.
+    imageData = ctx.getImageData(x, y, 1, 1);
+    data = imageData.data;
+    // Test pixel color components.
+    shouldBe('data[0]', r+'');
+    shouldBe('data[1]', g+'');
+    shouldBe('data[2]', b+'');
+    alphaTestFunction('data[3]', a+'');
+    // Plot test point.
+    ctx.fillRect(x, y, 3, 3);
+}
+
+print('Verifying alpha shadow...');
+test(shouldBe, 400, 150, 0, 0, 0, 0);
+test(shouldBeAround, 400, 75, 255,  0, 0, 64);
+test(shouldBeAround, 400, 225, 255, 0, 0, 64);
+test(shouldBeAround, 325, 150, 255, 0, 0, 64);
+test(shouldBeAround, 475, 150, 255, 0, 0, 64);
+
+print(' ');
+print('Verifying blurry shadow...');
+test(shouldBe, 400, 400, 0, 0, 0, 0);
+test(shouldBeAround, 400, 300, 255, 0, 0, 31);
+test(shouldBeAround, 400, 500, 255, 0, 0, 31);
+test(shouldBeAround, 300, 400, 255, 0, 0, 31);
+test(shouldBeAround, 500, 400, 255, 0, 0, 31);
+
+print(' ');
+print('Verifying rotated alpha shadow...');
+test(shouldBe, 400, 650, 0, 0, 0, 0);
+test(shouldBeAround, 400, 575, 255, 0, 0, 64);
+test(shouldBeAround, 400, 725, 255, 0, 0, 64);
+test(shouldBeAround, 325, 650, 255, 0, 0, 64);
+test(shouldBeAround, 475, 650, 255, 0, 0, 64);
+
+print(' ');
+print('Verifying rotated blurry shadow...');
+test(shouldBe, 400, 900, 0, 0, 0, 0);
+test(shouldBeAround, 400, 800, 255, 0, 0, 31);
+test(shouldBeAround, 400, 1000, 255, 0, 0, 31);
+test(shouldBeAround, 300, 900, 255, 0, 0, 31);
+test(shouldBeAround, 500, 900, 255, 0, 0, 31);
+
+print(' ');
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-strokeRect-alpha-shadow.js b/LayoutTests/fast/canvas/script-tests/canvas-strokeRect-alpha-shadow.js
new file mode 100644
index 0000000..d8e2df1
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-strokeRect-alpha-shadow.js
@@ -0,0 +1,151 @@
+description("Ensure correct behavior of canvas with strokeRect using a semi-transparent solid strokeStyle and a shadow");
+
+function print(message, color)
+{
+    var paragraph = document.createElement("div");
+    paragraph.appendChild(document.createTextNode(message));
+    paragraph.style.fontFamily = "monospace";
+    if (color)
+        paragraph.style.color = color;
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function shouldBeAround(a, b)
+{
+    var evalA;
+    try {
+        evalA = eval(a);
+    } catch(e) {
+        evalA = e;
+    }
+
+    if (Math.abs(evalA - b) < 15)
+        print("PASS " + a + " is around " + b , "green")
+    else
+        print("FAIL " + a + " is not around " + b + " (actual: " + evalA + ")", "red");
+}
+
+var canvas = document.createElement('canvas');
+document.body.appendChild(canvas);
+canvas.setAttribute('width', '600');
+canvas.setAttribute('height', '1100');
+var ctx = canvas.getContext('2d');
+
+ctx.save();
+ctx.strokeStyle = 'rgba(0, 0, 255, 0.5)';
+ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
+ctx.shadowOffsetX = 250;
+ctx.lineWidth = 25;
+
+var side = 200;
+
+// Alpha shadow.
+ctx.shadowBlur = 0;
+ctx.strokeRect(50, 50, side, side);
+
+// Blurry shadow.
+ctx.shadowBlur = 10;
+ctx.strokeRect(50, 300, side, side);
+
+ctx.rotate(Math.PI / 2);
+
+// Rotated alpha shadow.
+ctx.shadowBlur = 0;
+ctx.strokeRect(550, -250, side, side);
+
+// Rotated blurry shadow.
+ctx.shadowBlur = 10;
+ctx.strokeRect(800, -250, side, side);
+
+ctx.restore();
+
+var imageData, data;
+ctx.fillStyle = 'black';
+
+function test(alphaTestFunction, x, y, r, g, b, a) {
+    // Get pixel.
+    imageData = ctx.getImageData(x, y, 1, 1);
+    data = imageData.data;
+    // Test pixel color components.
+    shouldBe('data[0]', r+'');
+    shouldBe('data[1]', g+'');
+    shouldBe('data[2]', b+'');
+    alphaTestFunction('data[3]', a+'');
+    // Plot test point.
+    ctx.fillRect(x, y, 3, 3);
+}
+
+print('Verifying alpha shadow...');
+test(shouldBe, 400, 150, 0, 0, 0, 0);
+
+test(shouldBe, 400, 75,  0, 0, 0, 0);
+test(shouldBe, 400, 225, 0, 0, 0, 0);
+test(shouldBe, 325, 150, 0, 0, 0, 0);
+test(shouldBe, 475, 150, 0, 0, 0, 0);
+
+test(shouldBeAround, 400,  50, 255, 0, 0, 64);
+test(shouldBeAround, 500, 150, 255, 0, 0, 64);
+test(shouldBeAround, 400, 250, 255, 0, 0, 64);
+test(shouldBeAround, 300, 150, 255, 0, 0, 64);
+
+test(shouldBe, 400, 25,  0, 0, 0, 0);
+test(shouldBe, 525, 150, 0, 0, 0, 0);
+test(shouldBe, 400, 275, 0, 0, 0, 0);
+test(shouldBe, 275, 150, 0, 0, 0, 0);
+
+print(' ');
+print('Verifying blurry shadow...');
+test(shouldBe, 400, 400, 0, 0, 0, 0);
+
+test(shouldBe, 400, 325, 0, 0, 0, 0);
+test(shouldBe, 475, 400, 0, 0, 0, 0);
+test(shouldBe, 400, 475, 0, 0, 0, 0);
+test(shouldBe, 325, 400, 0, 0, 0, 0);
+
+test(shouldBeAround, 400, 300, 255, 0, 0, 64);
+test(shouldBeAround, 400, 500, 255, 0, 0, 64);
+test(shouldBeAround, 300, 400, 255, 0, 0, 64);
+test(shouldBeAround, 500, 400, 255, 0, 0, 64);
+
+test(shouldBe, 525, 400, 0, 0, 0, 0);
+test(shouldBe, 275, 400, 0, 0, 0, 0);
+
+print(' ');
+print('Verifying rotated alpha shadow...');
+test(shouldBe, 400, 650, 0, 0, 0, 0);
+
+test(shouldBe, 400, 575, 0, 0, 0, 0);
+test(shouldBe, 400, 725, 0, 0, 0, 0);
+test(shouldBe, 325, 650, 0, 0, 0, 0);
+test(shouldBe, 475, 650, 0, 0, 0, 0);
+
+test(shouldBeAround, 400, 550, 255, 0, 0, 64);
+test(shouldBeAround, 500, 650, 255, 0, 0, 64);
+test(shouldBeAround, 400, 750, 255, 0, 0, 64);
+test(shouldBeAround, 300, 650, 255, 0, 0, 64);
+
+test(shouldBe, 400, 525, 0, 0, 0, 0);
+test(shouldBe, 525, 650, 0, 0, 0, 0);
+test(shouldBe, 400, 775, 0, 0, 0, 0);
+test(shouldBe, 275, 650, 0, 0, 0, 0);
+
+print(' ');
+print('Verifying rotated blurry shadow...');
+test(shouldBe, 400, 900, 0, 0, 0, 0);
+
+test(shouldBe, 400, 825, 0, 0, 0, 0);
+test(shouldBe, 475, 900, 0, 0, 0, 0);
+test(shouldBe, 400, 975, 0, 0, 0, 0);
+test(shouldBe, 325, 900, 0, 0, 0, 0);
+
+test(shouldBeAround, 400, 800,  255, 0, 0, 64);
+test(shouldBeAround, 400, 1000, 255, 0, 0, 64);
+test(shouldBeAround, 300, 900,  255, 0, 0, 64);
+test(shouldBeAround, 500, 900,  255, 0, 0, 64);
+
+test(shouldBe, 525, 900,  0, 0, 0, 0);
+test(shouldBe, 275, 900,  0, 0, 0, 0);
+test(shouldBe, 400, 1025, 0, 0, 0, 0);
+
+print(' ');
+var successfullyParsed = true;
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 0594c66..c404e6f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2011-01-19  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] GraphicsContext::strokePath() paints solid shadows with incorrect alpha
+        https://bugs.webkit.org/show_bug.cgi?id=52705
+
+        This is related to bug 52611. The shadow color alpha must be multiplied
+        by the context pen alpha. Fixing this results in correct behavior for
+        Canvas path stroke() and strokeRect() [which relies on stroke()].
+
+        Tests: fast/canvas/canvas-strokePath-alpha-shadow.html
+               fast/canvas/canvas-strokeRect-alpha-shadow.html
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::strokePath):
+
 2011-01-19  Darin Fisher  <darin at chromium.org>
 
         Reviewed by Mihai Parparita.
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 33731dd..c21b4ee 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -555,10 +555,12 @@ void GraphicsContext::strokePath(const Path& path)
                 shadow->endShadowLayer(this);
             }
         } else {
-            QPen shadowPen(pen);
-            shadowPen.setColor(m_data->shadow.m_color);
             QPointF offset = shadow->offset();
             p->translate(offset);
+            QColor shadowColor = shadow->m_color;
+            shadowColor.setAlphaF(shadowColor.alphaF() * pen.color().alphaF());
+            QPen shadowPen(pen);
+            shadowPen.setColor(shadowColor);
             p->strokePath(platformPath, shadowPen);
             p->translate(-offset);
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list