[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 16:16:04 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 36dcd3d9d340ca2927e7c50594c4f1731b0976fe
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 20 10:09:56 2010 +0000

    2010-11-20  Helder Correia  <helder at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt] Path fill lacks blur shadow support
            https://bugs.webkit.org/show_bug.cgi?id=49491
    
            Add new test for checking path fill blur shadow.
    
            * fast/canvas/canvas-fillPath-shadow-expected.txt: Added.
            * fast/canvas/canvas-fillPath-shadow.html: Added.
            * fast/canvas/script-tests/canvas-fillPath-shadow.js: Added.
    2010-11-20  Helder Correia  <helder at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt] Path fill lacks blur shadow support
            https://bugs.webkit.org/show_bug.cgi?id=49491
    
            Add blur shadow support to fillPath().
    
            Test: fast/canvas/canvas-fillPath-shadow.html
    
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::GraphicsContext::fillPath):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72472 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e241c42..f97f34f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-20  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Path fill lacks blur shadow support
+        https://bugs.webkit.org/show_bug.cgi?id=49491
+
+        Add new test for checking path fill blur shadow.
+
+        * fast/canvas/canvas-fillPath-shadow-expected.txt: Added.
+        * fast/canvas/canvas-fillPath-shadow.html: Added.
+        * fast/canvas/script-tests/canvas-fillPath-shadow.js: Added.
+
 2010-11-19  W. James MacLean  <wjmaclean at chromium.org>
 
         Reviewed by James Robinson.
diff --git a/LayoutTests/fast/canvas/canvas-fillPath-shadow-expected.txt b/LayoutTests/fast/canvas/canvas-fillPath-shadow-expected.txt
new file mode 100644
index 0000000..6493233
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-fillPath-shadow-expected.txt
@@ -0,0 +1,37 @@
+Ensure correct behavior of canvas with path fill shadow
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS data[0] is 255
+PASS data[1] is 20
+PASS data[2] is 0
+PASS data[0] is 255
+PASS data[1] is 20
+PASS data[2] is 0
+PASS data[0] is 255
+PASS data[1] is 20
+PASS data[2] is 0
+PASS data[0] is 255
+PASS data[1] is 20
+PASS data[2] is 0
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] should not be 255 and it's not.
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] should not be 255 and it's not.
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] should not be 255 and it's not.
+PASS data[0] is 255
+PASS data[1] is 0
+PASS data[2] is 0
+PASS data[3] should not be 255 and it's not.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-fillPath-shadow.html b/LayoutTests/fast/canvas/canvas-fillPath-shadow.html
new file mode 100644
index 0000000..5895420
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-fillPath-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-fillPath-shadow.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-fillPath-shadow.js b/LayoutTests/fast/canvas/script-tests/canvas-fillPath-shadow.js
new file mode 100644
index 0000000..ff55920
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-fillPath-shadow.js
@@ -0,0 +1,114 @@
+description("Ensure correct behavior of canvas with path fill 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 shouldNotBe(a, b)
+{
+    var evalA;
+    try {
+        evalA = eval(a);
+    } catch(e) {
+        evalA = e;
+    }
+
+    if (evalA != b)
+        print("PASS " + a + " should not be " + b + " and it's not.", "green")
+    else
+        print("FAIL " + a + " should not be " + b + " but it is.", "red");
+}
+
+var canvas = document.createElement('canvas');
+document.body.appendChild(canvas);
+canvas.setAttribute('width', '700');
+canvas.setAttribute('height', '700');
+var ctx = canvas.getContext('2d');
+
+ctx.beginPath();
+ctx.moveTo(300, 300);
+ctx.lineTo(300, 50);
+ctx.bezierCurveTo(200, 40, 75, 150, 30, 30);
+ctx.quadraticCurveTo(250, 75, 50, 300);
+ctx.shadowOffsetX = 350;
+ctx.shadowColor = 'rgba(255, 20, 0, 0.5)';
+ctx.shadowBlur = 0;
+ctx.fillStyle = 'rgba(0, 0, 255, 1)';
+ctx.lineWidth = 30;
+ctx.fill();
+
+ctx.beginPath();
+ctx.moveTo(300,650);
+ctx.lineTo(300,400);
+ctx.bezierCurveTo(200, 390, 75, 500, 30, 380);
+ctx.quadraticCurveTo(250, 425, 50, 650);
+ctx.shadowOffsetX = 350;
+ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
+ctx.shadowBlur = 30;
+ctx.fillStyle = 'rgba(0, 0, 255, 1)';
+ctx.lineWidth = 30;
+ctx.fill();
+
+var imageData, data;
+
+// Verify solid shadow.
+imageData = ctx.getImageData(640, 290, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '20');
+shouldBe('data[2]', '0');
+
+imageData = ctx.getImageData(570, 85, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '20');
+shouldBe('data[2]', '0');
+
+imageData = ctx.getImageData(380, 30, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '20');
+shouldBe('data[2]', '0');
+
+imageData = ctx.getImageData(400, 40, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '20');
+shouldBe('data[2]', '0');
+
+// Verify blurry shadow.
+imageData = ctx.getImageData(640, 640, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '0');
+shouldBe('data[2]', '0');
+shouldNotBe('data[3]', '255');
+
+imageData = ctx.getImageData(650, 400, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '0');
+shouldBe('data[2]', '0');
+shouldNotBe('data[3]', '255');
+
+imageData = ctx.getImageData(380, 380, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '0');
+shouldBe('data[2]', '0');
+shouldNotBe('data[3]', '255');
+
+imageData = ctx.getImageData(375, 390, 1, 1);
+data = imageData.data;
+shouldBe('data[0]', '255');
+shouldBe('data[1]', '0');
+shouldBe('data[2]', '0');
+shouldNotBe('data[3]', '255');
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3aca0c3..e204bb8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-20  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Path fill lacks blur shadow support
+        https://bugs.webkit.org/show_bug.cgi?id=49491
+
+        Add blur shadow support to fillPath().
+
+        Test: fast/canvas/canvas-fillPath-shadow.html
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::fillPath):
+
 2010-11-19  W. James MacLean  <wjmaclean at chromium.org>
 
         Reviewed by James Robinson.
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 87e3b50..d1ae51b 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -539,9 +539,22 @@ void GraphicsContext::fillPath()
     path.setFillRule(toQtFillRule(fillRule()));
 
     if (m_data->hasShadow()) {
-        p->translate(m_data->shadow.offset());
-        p->fillPath(path, QColor(m_data->shadow.m_color));
-        p->translate(-m_data->shadow.offset());
+        ContextShadow* shadow = contextShadow();
+        if (shadow->m_type != ContextShadow::BlurShadow
+            && !m_common->state.fillPattern && !m_common->state.fillGradient)
+        {
+            p->translate(m_data->shadow.offset());
+            p->fillPath(path, QColor(m_data->shadow.m_color));
+            p->translate(-m_data->shadow.offset());
+        } else {
+            QPainter* shadowPainter = shadow->beginShadowLayer(p, path.controlPointRect());
+            if (shadowPainter) {
+                shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
+                shadowPainter->fillPath(path, QColor(m_data->shadow.m_color));
+                shadow->endShadowLayer(p);
+            }
+        }
+
     }
     if (m_common->state.fillPattern) {
         AffineTransform affine;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list