From 250d419dded9ba9d1d356a12ea191ef142d9d7a7 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 19 Dec 2011 10:57:41 +1300 Subject: [PATCH] Bug 672013. Drawing an SVG image to a canvas need not clear its origin-clean flag. r=dholbert,sr=bzbarsky --- layout/base/nsLayoutUtils.cpp | 7 ++---- .../canvas-drawImage-origin-clean-1.html | 24 +++++++++++++++++++ layout/reftests/svg/as-image/reftest.list | 2 ++ 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 layout/reftests/svg/as-image/canvas-drawImage-origin-clean-1.html diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index a0fe01b3b057..3fedc9fa189a 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -4111,11 +4111,8 @@ nsLayoutUtils::SurfaceFromElement(dom::Element* aElement, result.mSurface = gfxsurf; result.mSize = gfxIntSize(imgWidth, imgHeight); result.mPrincipal = principal.forget(); - // SVG images could have and/or elements that load - // content from another domain. For safety, they make the canvas write-only. - // XXXdholbert We could probably be more permissive here if we check that our - // helper SVG document has no elements that could load remote content. - result.mIsWriteOnly = (imgContainer->GetType() == imgIContainer::TYPE_VECTOR); + // no images, including SVG images, can load content from another domain. + result.mIsWriteOnly = false; result.mImageRequest = imgRequest.forget(); return result; diff --git a/layout/reftests/svg/as-image/canvas-drawImage-origin-clean-1.html b/layout/reftests/svg/as-image/canvas-drawImage-origin-clean-1.html new file mode 100644 index 000000000000..c363bad581fe --- /dev/null +++ b/layout/reftests/svg/as-image/canvas-drawImage-origin-clean-1.html @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/layout/reftests/svg/as-image/reftest.list b/layout/reftests/svg/as-image/reftest.list index c82bbc713ce4..0293a1f7680e 100644 --- a/layout/reftests/svg/as-image/reftest.list +++ b/layout/reftests/svg/as-image/reftest.list @@ -41,6 +41,8 @@ fails == canvas-drawImage-scale-2b.html canvas-drawImage-scale-2-ref.html # XXX == canvas-drawImage-slice-1a.html lime100x100-ref.html fails == canvas-drawImage-slice-1b.html lime100x100-ref.html # XXX all edges fuzzy +== canvas-drawImage-origin-clean-1.html lime100x100-ref.html + # Simple tests == img-simple-1.html lime100x100-ref.html == img-simple-2.html lime100x100-ref.html