diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index c6a1f8befc49..3a75c69d5c7a 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -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) { diff --git a/layout/reftests/canvas/reftest.list b/layout/reftests/canvas/reftest.list index a6af36696a6f..890745309893 100644 --- a/layout/reftests/canvas/reftest.list +++ b/layout/reftests/canvas/reftest.list @@ -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 diff --git a/layout/reftests/canvas/strokeText-path-ref.html b/layout/reftests/canvas/strokeText-path-ref.html new file mode 100644 index 000000000000..475e0d60a5e0 --- /dev/null +++ b/layout/reftests/canvas/strokeText-path-ref.html @@ -0,0 +1,23 @@ + + + + + + +

You should see only see "Hello world!" below, without any additional + line. JavaScript is required.

+ +

You need Canvas + support.

+ + + diff --git a/layout/reftests/canvas/strokeText-path.html b/layout/reftests/canvas/strokeText-path.html new file mode 100644 index 000000000000..c90ea70f80cd --- /dev/null +++ b/layout/reftests/canvas/strokeText-path.html @@ -0,0 +1,33 @@ + + + + + + +

You should see only see "Hello world!" below, without any additional + line. JavaScript is required.

+ +

You need Canvas + support.

+ + +