From 81f1570669ff1af2fbb26cf91109ffb14ae3fec0 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 30 Nov 2010 13:19:56 -0500 Subject: [PATCH] Bug 478445 and bug 499628. strokeText needs to not re-stroke the current path. r=vlad, a=vlad --- .../canvas/src/nsCanvasRenderingContext2D.cpp | 6 ++-- layout/reftests/canvas/reftest.list | 2 ++ .../reftests/canvas/strokeText-path-ref.html | 23 +++++++++++++ layout/reftests/canvas/strokeText-path.html | 33 +++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 layout/reftests/canvas/strokeText-path-ref.html create mode 100644 layout/reftests/canvas/strokeText-path.html diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index c6a1f8befc4..3a75c69d5c7 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 a6af36696a6..89074530989 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 00000000000..475e0d60a5e --- /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 00000000000..c90ea70f80c --- /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.

+ + +