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

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 16:23:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b60af4001aa1f6b89a0dc73f9dda80d5b170eda6
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 23 01:47:04 2010 +0000

    2010-11-22  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Ariya Hidayat.
    
            [Qt] Canvas: strokeText() and fillText() produce same shadow
            https://bugs.webkit.org/show_bug.cgi?id=48845
    
            Test: fast/canvas/canvas-strokeText-strokes-shadow.html
    
            * platform/graphics/qt/FontQt.cpp:
            (WebCore::drawTextCommon): Stroke the shadow rather than filling it in the cTextStroke case.
    2010-11-22  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Ariya Hidayat.
    
            [Qt] Canvas: strokeText() and fillText() produce same shadow
            https://bugs.webkit.org/show_bug.cgi?id=48845
    
            Add test to verify that strokeText() doesn't produce a fillText() shadow.
    
            * fast/canvas/canvas-strokeText-strokes-shadow.html: Added.
            * fast/canvas/canvas-strokeText-strokes-shadow-expected.txt: Added.
            * fast/canvas/script-tests/canvas-strokeText-strokes-shadow.js: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72577 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 895ba31..79820a3 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-22  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Ariya Hidayat.
+
+        [Qt] Canvas: strokeText() and fillText() produce same shadow
+        https://bugs.webkit.org/show_bug.cgi?id=48845
+
+        Add test to verify that strokeText() doesn't produce a fillText() shadow.
+
+        * fast/canvas/canvas-strokeText-strokes-shadow.html: Added.
+        * fast/canvas/canvas-strokeText-strokes-shadow-expected.txt: Added.
+        * fast/canvas/script-tests/canvas-strokeText-strokes-shadow.js: Added.
+
 2010-11-22  Adam Roben  <aroben at apple.com>
 
         Update Windows 7 results for two tests
diff --git a/LayoutTests/fast/canvas/canvas-strokeText-strokes-shadow-expected.txt b/LayoutTests/fast/canvas/canvas-strokeText-strokes-shadow-expected.txt
new file mode 100644
index 0000000..4628590
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-strokeText-strokes-shadow-expected.txt
@@ -0,0 +1,13 @@
+Test that strokeText() doesn't produce a filled shadow.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 128
+PASS imgdata[2] is 0
+PASS imgdata[3] is 255
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-strokeText-strokes-shadow.html b/LayoutTests/fast/canvas/canvas-strokeText-strokes-shadow.html
new file mode 100644
index 0000000..3cbab8c
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-strokeText-strokes-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-strokeText-strokes-shadow.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-strokeText-strokes-shadow.js b/LayoutTests/fast/canvas/script-tests/canvas-strokeText-strokes-shadow.js
new file mode 100644
index 0000000..97b8e80
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-strokeText-strokes-shadow.js
@@ -0,0 +1,23 @@
+description("Test that strokeText() doesn't produce a filled shadow.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = 'green';
+ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+
+// Stroke an 'I' with its shadow in the upper left corner.
+ctx.strokeStyle = 'white';
+ctx.lineWidth = 2;
+ctx.shadowColor = 'red';
+ctx.shadowOffsetX = -15;
+ctx.shadowOffsetY = 0;
+ctx.font = '128px sans-serif';
+ctx.strokeText("I", 0, 50);
+
+imageData = ctx.getImageData(0, 0, 1, 1);
+imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "128");
+shouldBe("imgdata[2]", "0");
+shouldBe("imgdata[3]", "255");
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index aad616a..152621a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-22  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Ariya Hidayat.
+
+        [Qt] Canvas: strokeText() and fillText() produce same shadow
+        https://bugs.webkit.org/show_bug.cgi?id=48845
+
+        Test: fast/canvas/canvas-strokeText-strokes-shadow.html
+
+        * platform/graphics/qt/FontQt.cpp:
+        (WebCore::drawTextCommon): Stroke the shadow rather than filling it in the cTextStroke case.
+
 2010-11-22  Patrick Gansterer  <paroga at webkit.org>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index b049181..c0acc7c 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -182,32 +182,54 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
     if (!isComplexText && !(ctx->textDrawingMode() & cTextStroke))
         flags |= Qt::TextBypassShaping;
 #endif
-    if (ctx->contextShadow()->m_type != ContextShadow::NoShadow) {
-        ContextShadow* ctxShadow = ctx->contextShadow();
-        if (ctxShadow->m_type != ContextShadow::BlurShadow) {
-            p->save();
-            p->setPen(ctxShadow->m_color);
-            p->translate(ctxShadow->offset());
-            p->drawText(pt, string, flags, run.padding());
-            p->restore();
-        } else {
-            QFontMetrics fm(font);
-            QRectF boundingRect(point.x(), point.y() - fm.ascent(), fm.width(string), fm.height());
-            QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect);
-            if (shadowPainter) {
-                // Since it will be blurred anyway, we don't care about render hints.
-                shadowPainter->setFont(p->font());
-                shadowPainter->setPen(ctxShadow->m_color);
-                shadowPainter->drawText(pt, string, flags, run.padding());
-                ctxShadow->endShadowLayer(p);
+
+    QPainterPath textStrokePath;
+    if (ctx->textDrawingMode() & cTextStroke)
+        textStrokePath.addText(pt, font, string);
+
+    ContextShadow* ctxShadow = ctx->contextShadow();
+    if (ctxShadow->m_type != ContextShadow::NoShadow) {
+        if (ctx->textDrawingMode() & cTextFill) {
+            if (ctxShadow->m_type != ContextShadow::BlurShadow) {
+                p->save();
+                p->setPen(ctxShadow->m_color);
+                p->translate(ctxShadow->offset());
+                p->drawText(pt, string, flags, run.padding());
+                p->restore();
+            } else {
+                QFontMetrics fm(font);
+                QRectF boundingRect(point.x(), point.y() - fm.ascent(), fm.width(string), fm.height());
+                QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect);
+                if (shadowPainter) {
+                    // Since it will be blurred anyway, we don't care about render hints.
+                    shadowPainter->setFont(p->font());
+                    shadowPainter->setPen(ctxShadow->m_color);
+                    shadowPainter->drawText(pt, string, flags, run.padding());
+                    ctxShadow->endShadowLayer(p);
+                }
+            }
+        } else if (ctx->textDrawingMode() & cTextStroke) {
+            if (ctxShadow->m_type != ContextShadow::BlurShadow) {
+                p->translate(ctxShadow->offset());
+                p->strokePath(textStrokePath, QPen(ctxShadow->m_color));
+                p->translate(-ctxShadow->offset());
+            } else {
+                QFontMetrics fm(font);
+                QRectF boundingRect(point.x(), point.y() - fm.ascent(), fm.width(string), fm.height());
+                QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect);
+                if (shadowPainter) {
+                    // Since it will be blurred anyway, we don't care about render hints.
+                    shadowPainter->setFont(p->font());
+                    shadowPainter->strokePath(textStrokePath, QPen(ctxShadow->m_color));
+                    ctxShadow->endShadowLayer(p);
+                }
             }
         }
     }
-    if (ctx->textDrawingMode() & cTextStroke) {
-        QPainterPath path;
-        path.addText(pt, font, string);
-        p->strokePath(path, textStrokePen);
-    }
+
+    if (ctx->textDrawingMode() & cTextStroke)
+        p->strokePath(textStrokePath, textStrokePen);
+
     if (ctx->textDrawingMode() & cTextFill) {
         QPen previousPen = p->pen();
         p->setPen(textFillPen);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list