mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 104332 - Calculate active DPI value using getComputedStyle.
r=samuel@sieb.net
This commit is contained in:
parent
30bcec1891
commit
9ca2a8518a
@ -830,13 +830,10 @@ function getDefaultFontSize()
|
||||
}
|
||||
catch(ex) { }
|
||||
|
||||
// DPI pref : browser.display.screen_resolution
|
||||
var dpi = 96;
|
||||
try
|
||||
{
|
||||
dpi = prefBranch.getIntPref("browser.display.screen_resolution");
|
||||
}
|
||||
catch(ex) { }
|
||||
// Get the DPI the fun way (make Mozilla do the work).
|
||||
var b = document.createElement("box");
|
||||
b.style.width = "1in";
|
||||
var dpi = window.getComputedStyle(b, null).width.match(/^\d+/);
|
||||
|
||||
return Math.round((pxSize / dpi) * 72);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user