Zooming should not change the mediaqueries-4 resolution media feature

REOPENED
Unassigned

Status

()

Core
CSS Parsing and Computation
REOPENED
7 years ago
a year ago

People

(Reporter: Daniel Upstone, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

Layout.css.dpi is no longer supported and does not affect the layout, but it continues to change the reported resolution value for media queries, which results in a value out of sync with the layout.

Layout.css.devPixelsPerPx changes the value of device-pixel-ratio only (Not part of CSS 3 itself, and really not required to be.), but doesn't change the resolution value. The spec does not state as to what context the units for the resolution are in, but because both zooming and layout.css.dpi changes the value as would be expected and is of practical use, that the viewport dimensions changes accordingly, and in terms of CSS units the DPI has actually changed, so it would then be expected for it to change using this setting too; therefore, it is a bug.

Zooming without changing layout.css.dpi or layout.css.devPixelsPerPx keeps all values changing as expected.

Reproducible: Always

Steps to Reproduce:
A-1. Change layout.css.dpi to 72.
A-2. Check resolution and device-pixel-ratio values.

B-1. Change layout.css.devPixelsPerPx to 0.75.
B-2. Check resolution and device-pixel-ratio values.

C-1. Change layout.css.dpi to 72.
C-2. Zoom in 5 times.
C-3. Check resolution and device-pixel-ratio values.

Actual Results:  
A: 72 PPI, 1.0.
B: 72 PPI, 0.75.
C: 101 to 120 PPI, 1.5.

Expected Results:  
A: 96 PPI, 1.0.
B: 72 PPI, 0.75.
C: 141 to 160 PPI, 1.5.
(Reporter)

Updated

7 years ago
Summary: CSS 3 media querie resolution and device-pixel-ratio values are out of sync with layout changes. → CSS 3 media queries resolution and device-pixel-ratio values are out of sync with layout changes.
Why do you expect layout.css.dpi (or, more generally, resolution changes) to affect the layout?  Why do you claim that it's no longer supported?
(Reporter)

Comment 2

7 years ago
Because i already filed a bug for layout.css.dpi not working anymore, and was told support for it was removed despite it remaining in the config. It no longer has any affect on the layout as it used to as that is what the devs intended, but it is causing the value of resolution to be change still when it shouldn't. So this would be a bug left behind since support was dropped.

As to your first question, i can't really answer than any better than saying because that is what happens, that's the point of it. In this case it's more accurate to say that i expect changes in relationship between a pixel and the CSS units (Which change the rendering of the layout on screen.), to be reported back accurately in media queries.

There are 3 different ways this is done in Gecko: Zoom, layout.css.devPixelsPerPx, and layout.css.dpi. The last is no longer supported as i said, but changing it still is changing the resolution value as if it is working still. The second is working correctly, but is not changing the resolution value as it should. The first works correctly on it's own by changing both values, but when used with the other two it will be incorrect two because of the bugs they have. Correct their bugs, and they all work fine again.

Currently, the only way to produce accurate results is to set layout.css.dpi and layout.css.devPixelsPerPx to both match the intended DPI, and the zooming system will then have the correct base values to adjust from when zooming.
layout.css.dpi still changes the DPI. It's just that the DPI doesn't change the layout unless you're using mozmm.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

7 years ago
As rather ridiculous as you probably realise i think that is because it is completely outside the the CSS spec, there is still the issue of the DPI not changing in layout.css.devPixelsPerPx, while it does when zooming, producing incorrect results when using the two together, despite having the same impact on layout, which is out of accordance with spec and expected behaviour.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
http://www.w3.org/TR/CSS21/syndata.html#length-units says:

  # For a CSS device, these dimensions are either anchored (i) by relating the
  # physical units to their physical measurements, or (ii) by relating the pixel
  # unit to the reference pixel. For print media and similar high-resolution
  # devices, the anchor unit should be one of the standard physical units
  # (inches, centimeters, etc). For lower-resolution devices, and devices with
  # unusual viewing distances, it is recommended instead that the anchor unit be
  # the pixel unit. For such devices it is recommended that the pixel unit refer
  # to the whole number of device pixels that best approximates the reference
  # pixel. 

so I'm not sure why you say that a control for CSS pixels per device pixel violates the spec.

(I recommend reading that whole section.)
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago7 years ago
Resolution: --- → INVALID
(Reporter)

Comment 6

7 years ago
I never said the control itself does, red the spec many times.

When you zoom, the resolution and device-pixel-ratio (Not part of the spec.) change accordingly to reflect the scaled layout.
When you change layout.css.devPixelsPerPx, which has the same affect on the layout, and is also scaling based on changing that anchored pixel unit as the spec defines, it does not change the resolution value, but it does change the device-pixel-ratio.
This alone indicates a discrepancy in how you're handling the resolution value.

When using the two together, the device-pixel-ratio reports the correct value, while the resolution does not. If you only used the zoom, both would be correct.

Not changing the resolution value when using the layout.css.devPixelsPerPx is unhelpful just on it's own (A static non CSS based DPI/DPCM, is entirely useless to CSS if you perform any scaling as described in what you quoted, and Webkit doesn't even bother to change the device-pixel-ratio when zooming, so i don't understand what they were thinking of trying to fix.), but allowing it to cause values which become out of sync with the scale of the units is worse.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
The device-pixel-ratio media query reports the ratio of device pixels to CSS pixels.

The resolution media query reports the number of device pixels per physical inch.

Zooming changes the size of a CSS pixel relative to both of the others, so it should change device-pixel-ratio but not resolution.

layout.css.dpi changes what we believe a physical inch is (relative to both of the others), so it should change resolution but not device-pixel-ratio.

layout.css.devPixelsPerPx changes the initial ratio of device pixels to CSS pixels, so it should affect the initial device-pixel-ratio (modifiable by zooming) but not change resolution.


So as far as I can tell the only bug reported here is that zooming should not change the resolution media feature, but it does.
(Reporter)

Comment 8

7 years ago
Correct, if that's how you interpret resolution and its units.
I didn't know which you wanted to consider a bug, because i didn't know how you were interpreting it until now, so thanks for clearing that up.

Comment 9

7 years ago
(In reply to comment #7)
> So as far as I can tell the only bug reported here is that zooming should
> not change the resolution media feature, but it does.

Considering Comment 7, setting status to New and changing the summary accordingly.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: CSS 3 media queries resolution and device-pixel-ratio values are out of sync with layout changes. → Zooming should not change the resolution media feature
(In reply to David Baron [:dbaron] from comment #7)
> The resolution media query reports the number of device pixels per physical
> inch.

A recent spec change will change this; see bug 771390.
Depends on: 771390
(Reporter)

Comment 11

6 years ago
Yep, the spec now supports the more expected behaviour that I was hoping for.

The bug summary is now wrong (resolution should change), and my original bug summary should be restored, as the bug is actually an issue with the syncing of the two media query values depending on method of scaling in the browser.

Comment 12

5 years ago
Seamonkey users can set Preferences -> Appearance -> Content -> Zoom only text instead of full pages = Check. This changes the preference browser.zoom.full to False. Now zooming only affects text as wanted by bug reporter.

Firefox has the preference browser.zoom.full too. Toggling it to False gives the same result as wanted by bug reporter. 

I don't know if somewhere in Firefox preference dialog users have GUI access to this preference. This might be another bug. The technical basics are working, so this bug is invalid.

If the bug reporter wants this as default behaviour or a GUI access to this preference a fresh bug report is welcome.
Status: NEW → RESOLVED
Last Resolved: 7 years ago5 years ago
Resolution: --- → INVALID
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
This bug is about what relevant standards say we should do when zooming.  Please don't mark bugs invalid if you're not the module owner or not able to correctly judge their validity.

Comment 14

a year ago
For reference: https://drafts.csswg.org/mediaqueries-4/#resolution
Summary: Zooming should not change the resolution media feature → Zooming should not change the mediaqueries-4 resolution media feature
You need to log in before you can comment on or make changes to this bug.