Backed out changeset 52434d177be3 (bug 1171614) for test failures in clipboard tests

This commit is contained in:
Carsten "Tomcat" Book 2016-07-07 08:39:18 +02:00
parent 6f0f8498d5
commit 2f13468501

View File

@ -3028,15 +3028,22 @@ var imageToImageData = Task.async(function* (node, maxDim) {
}
// Extract the image data
// Create a canvas to copy the rawNode into and get the imageData from
let canvas = node.ownerDocument.createElementNS(XHTML_NS, "canvas");
canvas.width = imgWidth * resizeRatio;
canvas.height = imgHeight * resizeRatio;
let ctx = canvas.getContext("2d");
let imageData;
// The image may already be a data-uri, in which case, save ourselves the
// trouble of converting via the canvas.drawImage.toDataURL method
if (isImg && node.src.startsWith("data:")) {
imageData = node.src;
} else {
// Create a canvas to copy the rawNode into and get the imageData from
let canvas = node.ownerDocument.createElementNS(XHTML_NS, "canvas");
canvas.width = imgWidth * resizeRatio;
canvas.height = imgHeight * resizeRatio;
let ctx = canvas.getContext("2d");
// Copy the rawNode image or canvas in the new canvas and extract data
ctx.drawImage(node, 0, 0, canvas.width, canvas.height);
let imageData = canvas.toDataURL("image/png");
// Copy the rawNode image or canvas in the new canvas and extract data
ctx.drawImage(node, 0, 0, canvas.width, canvas.height);
imageData = canvas.toDataURL("image/png");
}
return {
data: imageData,