Bug 1214428 - Scale tab-preview image properly for hi-dpi displays with e10s. r=gabor

This commit is contained in:
Jonathan Kew 2015-12-29 08:23:30 +00:00
Родитель f90087f1fa
Коммит 1c044aaf5a
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -5537,6 +5537,7 @@
canvas.width = 160 * scale;
canvas.height = 90 * scale;
let toDrag;
let dragImageOffset = -16;
if (gMultiProcessBrowser) {
var context = canvas.getContext('2d');
context.fillStyle = "white";
@ -5548,7 +5549,13 @@
this._dndCanvas = canvas;
this._dndPanel = document.createElement("panel");
this._dndPanel.setAttribute("type", "drag");
this._dndPanel.appendChild(canvas);
let wrapper = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
wrapper.style.width = "160px";
wrapper.style.height = "90px";
wrapper.appendChild(canvas);
canvas.style.width = "100%";
canvas.style.height = "100%";
this._dndPanel.appendChild(wrapper);
document.documentElement.appendChild(this._dndPanel);
}
// PageThumb is async with e10s but that's fine
@ -5561,8 +5568,9 @@
// be fine, so let's use the canvas for setDragImage.
PageThumbs.captureToCanvas(browser, canvas);
toDrag = canvas;
dragImageOffset = dragImageOffset * scale;
}
dt.setDragImage(toDrag, -16 * scale, -16 * scale);
dt.setDragImage(toDrag, dragImageOffset, dragImageOffset);
// _dragData.offsetX/Y give the coordinates that the mouse should be
// positioned relative to the corner of the new window created upon