LayoutTests/ChangeLog

 12009-06-09 Dean McNamee <deanm@chromium.org>
 2
 3 Make sure the graphics backends are in sync with the canvas lineWidth state.
 4 https://bugs.webkit.org/show_bug.cgi?id=26187
 5
 6 * fast/canvas/canvas-lineWidth.html: Added.
 7 * fast/canvas/canvas-lineWidth.js: Added.
 8 (compareRows):
 9
1102009-06-08 Brady Eidson <beidson@apple.com>
211
312 Reviewed by Antti Koivisto

LayoutTests/fast/canvas/canvas-lineWidth.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="../js/resources/js-test-style.css">
 5<script src="../js/resources/js-test-pre.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<canvas id="canvas" width=600 height=300 style="border:5px solid black">
 11<script src="canvas-lineWidth.js"></script>
 12<script src="../js/resources/js-test-post.js"></script>
 13</body>
 14</html>

LayoutTests/fast/canvas/canvas-lineWidth.js

 1// Compare sections of a <canvas> to assert they are identical.
 2function compareRows(ctx, y0, y1, width, height) {
 3 var data0 = ctx.getImageData(0, y0, width, height).data;
 4 var data1 = ctx.getImageData(0, y1, width, height).data;
 5 for (var i = 0, il = data0.length; i < il; ++i) {
 6 if (data0[i] != data1[i]) {
 7 testFailed("Pixel at " + i + " should be " + data0[i] + " but was " + data1[i]);
 8 break;
 9 }
 10 }
 11}
 12
 13description("Test the default lineWidth is consistent.");
 14
 15ctx = document.getElementById("canvas").getContext("2d");
 16
 17ctx.strokeStyle = 'blue';
 18
 19for (var j = 0; j < 3; ++j) {
 20 ctx.beginPath();
 21 for (var i = 0; i < 60; ++i) {
 22 var x = i * 10;
 23 var y = j * 100 + 30 + (i % 15);
 24 if (i == 0) {
 25 ctx.moveTo(x, y);
 26 } else {
 27 ctx.lineTo(x, y);
 28 }
 29 }
 30 ctx.stroke();
 31
 32 if (j == 0) {
 33 shouldBe("ctx.lineWidth", "1");
 34 ctx.lineWidth = ctx.lineWidth;
 35 shouldBe("ctx.lineWidth", "1");
 36 } else {
 37 shouldBe("ctx.lineWidth", "1");
 38 ctx.lineWidth = 1;
 39 shouldBe("ctx.lineWidth", "1");
 40 }
 41}
 42
 43// Make sure that all rows are identical.
 44compareRows(ctx, 0, 100, 600, 100);
 45compareRows(ctx, 0, 200, 600, 100);
 46
 47var successfullyParsed = true;

WebCore/ChangeLog

 12009-06-09 Dean McNamee <deanm@chromium.org>
 2
 3 Make sure the graphics backends are in sync with the canvas lineWidth state.
 4 https://bugs.webkit.org/show_bug.cgi?id=26187
 5
 6 Test: fast/canvas/canvas-line-width.html
 7
 8 * html/CanvasRenderingContext2D.cpp:
 9 (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
 10
1112009-06-09 Simon Hausmann <simon.hausmann@nokia.com>
212
313 Fix the Qt build, the time functions moved into the WTF namespace.

WebCore/html/CanvasRenderingContext2D.cpp

@@CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas)
9696 : m_canvas(canvas)
9797 , m_stateStack(1)
9898{
 99 // Make sure that even if the drawingContext() has a different default
 100 // thickness, it is in sync with the canvas thickness.
 101 setLineWidth(lineWidth());
99102}
100103
101104void CanvasRenderingContext2D::ref()