зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1171614 - Remove the special path for data-URI images from the server inspector actor r=jdescottes
MozReview-Commit-ID: 2tWleM1wH1G --HG-- extra : transplant_source : %1B%84h.g%9D%C4%E8S%C6%3F%C3s%B9OoA%84%7D.
This commit is contained in:
Родитель
fde799ec8a
Коммит
7fcd8d58b7
|
@ -3028,22 +3028,15 @@ var imageToImageData = Task.async(function* (node, maxDim) {
|
|||
}
|
||||
|
||||
// Extract the image data
|
||||
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");
|
||||
// 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);
|
||||
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);
|
||||
let imageData = canvas.toDataURL("image/png");
|
||||
|
||||
return {
|
||||
data: imageData,
|
||||
|
|
Загрузка…
Ссылка в новой задаче