Bug 672013. Drawing an SVG image to a canvas need not clear its origin-clean flag. r=dholbert,sr=bzbarsky

This commit is contained in:
Robert O'Callahan 2011-12-19 10:57:41 +13:00
Родитель 763cffbfd2
Коммит 250d419dde
3 изменённых файлов: 28 добавлений и 5 удалений

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

@ -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 <foreignObject> and/or <image> 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;

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

@ -0,0 +1,24 @@
<html>
<head>
<script type="text/javascript">
function go() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var image = document.getElementById("image");
// Draw the SVG image
ctx.drawImage(image, 0, 0);
try {
canvas.toDataURL();
} catch (ex) {
document.body.textContent = ex;
}
}
</script>
</head>
<body onload="go()">
<canvas id="canvas" width="200" height="200"></canvas>
<img id="image" src="lime100x100.svg" style="display: none">
</body>
</html>

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

@ -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 <img> tests
== img-simple-1.html lime100x100-ref.html
== img-simple-2.html lime100x100-ref.html