[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 13:52:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit eb229442f9dec4afbe28cac8235f94827357f918
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 19:19:13 2010 +0000

    2010-09-28  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Text drawing taints GraphicsContext's QPainter::pen()
            https://bugs.webkit.org/show_bug.cgi?id=46744
    
            Test: fast/canvas/canvas-style-intact-after-text.html
    
            * platform/graphics/qt/FontQt.cpp:
            (WebCore::drawTextCommon): Make sure the QPainter's pen is
            restored after filling and/or stroking text.
    2010-09-28  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Text drawing taints GraphicsContext's QPainter::pen()
            https://bugs.webkit.org/show_bug.cgi?id=46744
    
            Add test to check that strokeText() doesn't break the fillStyle
            and fillText() doesn't break the strokeStyle.
    
            * fast/canvas/canvas-style-intact-after-text-expected.txt: Added.
            * fast/canvas/canvas-style-intact-after-text.html: Added.
            * fast/canvas/script-tests/canvas-style-intact-after-text.js: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68549 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 94aac8e..5e711a7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-28  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Text drawing taints GraphicsContext's QPainter::pen()
+        https://bugs.webkit.org/show_bug.cgi?id=46744
+
+        Add test to check that strokeText() doesn't break the fillStyle
+        and fillText() doesn't break the strokeStyle.
+
+        * fast/canvas/canvas-style-intact-after-text-expected.txt: Added.
+        * fast/canvas/canvas-style-intact-after-text.html: Added.
+        * fast/canvas/script-tests/canvas-style-intact-after-text.js: Added.
+
 2010-09-28  Andrei Popescu  <andreip at google.com>
 
         Reviewed by Jeremy Orlow.
diff --git a/LayoutTests/fast/canvas/canvas-style-intact-after-text-expected.txt b/LayoutTests/fast/canvas/canvas-style-intact-after-text-expected.txt
new file mode 100644
index 0000000..9c755fa
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-style-intact-after-text-expected.txt
@@ -0,0 +1,31 @@
+Test that the rendering context's strokeStyle and fillStyle are intact after calling strokeText() and fillText()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Checking initial state for sanity
+PASS ctx.fillStyle is '#ff0000'
+PASS imgdata[0] is 255
+PASS imgdata[1] is 0
+PASS imgdata[2] is 0
+PASS imgdata[3] is 255
+PASS imgdata[4] is 0
+PASS imgdata[5] is 0
+PASS imgdata[6] is 0
+PASS imgdata[7] is 0
+Calling fillText() to try and break the strokeStyle.
+PASS ctx.strokeStyle is '#008000'
+PASS imgdata[0] is 0
+PASS imgdata[1] is 128
+PASS imgdata[2] is 0
+PASS imgdata[3] is 255
+Calling strokeText() to try and break the fillStyle.
+PASS ctx.fillStyle is '#008000'
+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-style-intact-after-text.html b/LayoutTests/fast/canvas/canvas-style-intact-after-text.html
new file mode 100644
index 0000000..d2cf8da
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-style-intact-after-text.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-style-intact-after-text.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-style-intact-after-text.js b/LayoutTests/fast/canvas/script-tests/canvas-style-intact-after-text.js
new file mode 100644
index 0000000..a44a713
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-style-intact-after-text.js
@@ -0,0 +1,51 @@
+description("Test that the rendering context's strokeStyle and fillStyle are intact after calling strokeText() and fillText()");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = 'red';
+ctx.fillRect(0, 0, 1, 1);
+
+debug("Checking initial state for sanity");
+var imageData = ctx.getImageData(0, 0, 2, 1);
+var imgdata = imageData.data;
+shouldBe("ctx.fillStyle", "'#ff0000'");
+shouldBe("imgdata[0]", "255");
+shouldBe("imgdata[1]", "0");
+shouldBe("imgdata[2]", "0");
+shouldBe("imgdata[3]", "255");
+shouldBe("imgdata[4]", "0");
+shouldBe("imgdata[5]", "0");
+shouldBe("imgdata[6]", "0");
+shouldBe("imgdata[7]", "0");
+
+debug("Calling fillText() to try and break the strokeStyle.");
+ctx.strokeStyle = 'green';
+ctx.lineWidth = 10;
+ctx.fillStyle = 'red';
+ctx.fillText("X", 0, 0);
+shouldBe("ctx.strokeStyle", "'#008000'");
+ctx.beginPath();
+ctx.moveTo(0, 0);
+ctx.lineTo(10, 10);
+ctx.stroke();
+imageData = ctx.getImageData(2, 2, 1, 1);
+imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "128");
+shouldBe("imgdata[2]", "0");
+shouldBe("imgdata[3]", "255");
+
+debug("Calling strokeText() to try and break the fillStyle.");
+ctx.strokeStyle = 'red';
+ctx.lineWidth = 100;
+ctx.fillStyle = 'green';
+ctx.strokeText("X", 0, 0);
+shouldBe("ctx.fillStyle", "'#008000'");
+ctx.fillRect(0, 0, 10, 10);
+imageData = ctx.getImageData(2, 2, 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 357c044..a99550f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-28  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Text drawing taints GraphicsContext's QPainter::pen()
+        https://bugs.webkit.org/show_bug.cgi?id=46744
+
+        Test: fast/canvas/canvas-style-intact-after-text.html
+
+        * platform/graphics/qt/FontQt.cpp:
+        (WebCore::drawTextCommon): Make sure the QPainter's pen is
+        restored after filling and/or stroking text.
+
 2010-09-28  Jia Pu  <jpu at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index db9d7e8..e7566eb 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -206,12 +206,13 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
     if (ctx->textDrawingMode() & cTextStroke) {
         QPainterPath path;
         path.addText(pt, font, string);
-        p->setPen(textStrokePen);
-        p->strokePath(path, p->pen());
+        p->strokePath(path, textStrokePen);
     }
     if (ctx->textDrawingMode() & cTextFill) {
+        QPen previousPen = p->pen();
         p->setPen(textFillPen);
         p->drawText(pt, string, flags, run.padding());
+        p->setPen(previousPen);
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list