mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 1753995 - Remove non-test usage of WindowUtils.screenPixelsPerCSSPixel. r=mconley
It does the same as window.devicePixelRatio. However a bunch of this code is copy-pasted code trying to scale a canvas, but not messing with full zoom is the right thing to do. The full zoom value in the top level browser.xhtml page is always 1 anyways, and WindowsPreviewPerTab looking at the current browser tab's full zoom is just bizarre... Differential Revision: https://phabricator.services.mozilla.com/D138020
This commit is contained in:
parent
03ade0a619
commit
00cc720134
@ -1279,8 +1279,7 @@ var gIdentityHandler = {
|
||||
let urlString = value + "\n" + gBrowser.contentTitle;
|
||||
let htmlString = '<a href="' + value + '">' + value + "</a>";
|
||||
|
||||
let windowUtils = window.windowUtils;
|
||||
let scale = windowUtils.screenPixelsPerCSSPixel / windowUtils.fullZoom;
|
||||
let scale = window.devicePixelRatio;
|
||||
let canvas = document.createElementNS(
|
||||
"http://www.w3.org/1999/xhtml",
|
||||
"canvas"
|
||||
|
@ -432,8 +432,7 @@
|
||||
// Until canvas is HiDPI-aware (bug 780362), we need to scale the desired
|
||||
// canvas size (in CSS pixels) to the window's backing resolution in order
|
||||
// to get a full-resolution drag image for use on HiDPI displays.
|
||||
let windowUtils = window.windowUtils;
|
||||
let scale = windowUtils.screenPixelsPerCSSPixel / windowUtils.fullZoom;
|
||||
let scale = window.devicePixelRatio;
|
||||
let canvas = this._dndCanvas;
|
||||
if (!canvas) {
|
||||
this._dndCanvas = canvas = document.createElementNS(
|
||||
|
@ -474,7 +474,7 @@ class SearchOneOffs {
|
||||
// This is likely because the clientWidth getter rounds the value, but
|
||||
// the panel's border width is not an integer.
|
||||
// As a workaround, decrement the width if the scale is not an integer.
|
||||
let scale = this.window.windowUtils.screenPixelsPerCSSPixel;
|
||||
let scale = this.window.devicePixelRatio;
|
||||
if (Math.floor(scale) != scale) {
|
||||
--buttonsWidth;
|
||||
}
|
||||
|
@ -202,20 +202,6 @@ PreviewController.prototype = {
|
||||
this.canvasPreview.height = aRequestedHeight;
|
||||
},
|
||||
|
||||
get zoom() {
|
||||
// Note that winutils.fullZoom accounts for "quantization" of the zoom factor
|
||||
// from nsIContentViewer due to conversion through appUnits.
|
||||
// We do -not- want screenPixelsPerCSSPixel here, because that would -also-
|
||||
// incorporate any scaling that is applied due to hi-dpi resolution options.
|
||||
return this.tab.linkedBrowser.fullZoom;
|
||||
},
|
||||
|
||||
get screenPixelsPerCSSPixel() {
|
||||
let chromeWin = this.tab.ownerGlobal;
|
||||
let windowUtils = chromeWin.windowUtils;
|
||||
return windowUtils.screenPixelsPerCSSPixel;
|
||||
},
|
||||
|
||||
get browserDims() {
|
||||
return this.tab.linkedBrowser.getBoundingClientRect();
|
||||
},
|
||||
@ -295,7 +281,7 @@ PreviewController.prototype = {
|
||||
composite.mozOpaque = false;
|
||||
|
||||
let ctx = composite.getContext("2d");
|
||||
let scale = this.screenPixelsPerCSSPixel / this.zoom;
|
||||
let scale = this.win.devicePixelRatio;
|
||||
|
||||
composite.width = winWidth * scale;
|
||||
composite.height = winHeight * scale;
|
||||
|
Loading…
Reference in New Issue
Block a user