зеркало из https://github.com/mozilla/gecko-dev.git
Change our interpretation of resolution units in CSS to match updates to the spec: i.e., device pixels per CSS inch (instead of device pixels per physical inch). (Bug 771390) r=bzbarsky
Given that this makes GetResolution work like GetDevicePixelRatio, I believe this should also fix bug 662061 (on resolution's behavior when zooming)?
This commit is contained in:
Родитель
4bf35ecd35
Коммит
c51fdbf971
|
@ -248,9 +248,10 @@ static nsresult
|
|||
GetResolution(nsPresContext* aPresContext, const nsMediaFeature*,
|
||||
nsCSSValue& aResult)
|
||||
{
|
||||
// Resolution values are in device pixels, not CSS pixels.
|
||||
nsDeviceContext *dx = GetDeviceContextFor(aPresContext);
|
||||
float dpi = float(dx->AppUnitsPerPhysicalInch()) / float(dx->AppUnitsPerDevPixel());
|
||||
// Resolution measures device pixels per CSS (inch/cm/pixel). We
|
||||
// return it in device pixels per CSS inches.
|
||||
float dpi = float(nsPresContext::AppUnitsPerCSSInch()) /
|
||||
float(aPresContext->AppUnitsPerDevPixel());
|
||||
aResult.SetFloatValue(dpi, eCSSUnit_Inch);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -483,6 +483,7 @@ function run() {
|
|||
var dpi_low = resolution - 1;
|
||||
if (query_applies("(min-resolution: " + resolution + "dpi)")) {
|
||||
// It's exact!
|
||||
is(resolution % 96, 0, "resolution should be a multiple of 96dpi");
|
||||
should_apply("(resolution: " + resolution + "dpi)");
|
||||
should_not_apply("(resolution: " + (resolution + 1) + "dpi)");
|
||||
should_not_apply("(resolution: " + (resolution - 1) + "dpi)");
|
||||
|
@ -490,6 +491,7 @@ function run() {
|
|||
} else {
|
||||
// We have no way to test resolution applying since it need not be
|
||||
// an integer.
|
||||
ok(false, "resolution should be a multiple of 96dpi");
|
||||
should_not_apply("(resolution: " + resolution + "dpi)");
|
||||
should_not_apply("(resolution: " + (resolution - 1) + "dpi)");
|
||||
dpi_high = resolution;
|
||||
|
|
Загрузка…
Ссылка в новой задаче