Bug 478445 and bug 499628. strokeText needs to not re-stroke the current path. r=vlad, a=vlad

This commit is contained in:
Boris Zbarsky 2010-11-30 13:19:56 -05:00
Родитель 01bf8d9c4f
Коммит 8bfb93c8f3
4 изменённых файлов: 62 добавлений и 2 удалений

Просмотреть файл

@ -2799,9 +2799,11 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
gfxContextPathAutoSaveRestore pathSR(mThebes, PR_FALSE);
// back up path if stroking
if (aOp == nsCanvasRenderingContext2D::TEXT_DRAW_OPERATION_STROKE)
// back up and clear path if stroking
if (aOp == nsCanvasRenderingContext2D::TEXT_DRAW_OPERATION_STROKE) {
pathSR.Save();
mThebes->NewPath();
}
// doUseIntermediateSurface is mutually exclusive to op == STROKE
else {
if (doUseIntermediateSurface) {

Просмотреть файл

@ -39,3 +39,5 @@ asserts-if(cocoaWidget,0-2) == size-change-1.html size-change-1-ref.html
== text-bidi-rtl-test.html text-bidi-rtl-ref.html
!= text-font-lang.html text-font-lang-notref.html
== strokeText-path.html strokeText-path-ref.html

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"><!--
window.onload = function () {
var canvas = document.getElementById('testCanvas'),
context = canvas.getContext('2d');
// draw some text
context.font = 'bold 40px sans-serif';
context.strokeText("Hello world!", 10, 50);
};
// --></script>
</head>
<body>
<p>You should see only see "Hello world!" below, without any additional
line. JavaScript is required.</p>
<p><canvas id="testCanvas" width="400" height="300">You need Canvas
support.</canvas></p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"><!--
window.onload = function () {
var canvas = document.getElementById('testCanvas'),
context = canvas.getContext('2d');
// draw a path
context.beginPath();
context.moveTo(10, 10);
context.lineTo(200, 10);
context.lineTo(200, 200);
context.stroke();
context.closePath();
context.clearRect(0, 0, canvas.width, canvas.height);
// draw some text
context.font = 'bold 40px sans-serif';
context.strokeText("Hello world!", 10, 50);
};
// --></script>
</head>
<body>
<p>You should see only see "Hello world!" below, without any additional
line. JavaScript is required.</p>
<p><canvas id="testCanvas" width="400" height="300">You need Canvas
support.</canvas></p>
</body>
</html>