From 1c044aaf5a7675b18c4157579aeb2757f2a2242b Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 29 Dec 2015 08:23:30 +0000 Subject: [PATCH] Bug 1214428 - Scale tab-preview image properly for hi-dpi displays with e10s. r=gabor --- browser/base/content/tabbrowser.xml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 98017e91752c..a04a8c3df2ea 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -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