Closed Bug 1607027 Opened 6 years ago Closed 3 years ago

css @media device-pixel-ratio and RFP

Categories

(Core :: CSS Parsing and Computation, enhancement)

71 Branch
enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: thorin, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

Note: For my test, my device/monitor has a device pixel ratio of 1. I am not sure what happens on HiDPI devices like a Mac with Retina.

control test

  • disable RFP
  • load test page: see [1]
  • devicePixelRatio = 1 + green RFP notation
  • [matchMedia -webkit- | -moz-] device-pixel-ratio = 1 | 1 + green RFP
  • zoom, e.g to 120%
  • devicePixelRatio = 1.2 + red RFP
  • [matchMedia -webkit- | -moz-] device-pixel-ratio = 1.2 | 1.2 (rounded) + red RFP

the test

  • enable RFP
  • reload the test page at 100% zoom
  • devicePixelRatio = 1 + green RFP
  • [matchMedia -webkit- | -moz-] device-pixel-ratio = 1 | 1 + green RFP
  • zoom, e.g to 120%
  • devicePixelRatio = 1 + green RFP = spoofed
  • [matchMedia -webkit- | -moz-] device-pixel-ratio = 1.2 | 1.2 + red RFP = not spoofed

** the problem**

  • window.devicePixelRatio is protected, but -webkit-{min/max}-device-pixel-ratio and {min/max-}-moz-device-pixel-ratio are not

references


android

  • this is the only device I have that has a dpr != 1
  • The resize event on the test page (which auto recalculates the values) is only triggered on non-android devices
  • I can pinch-to-zoom and use the three dot menu and refresh (or I can just hit the re-reun button) and all three values are always the same. With RFP on they are always 1. With RFP off they report the correct device pixel ratio (for me that's 2.608695...)
  • I'm sure I'm misinterpreting how android + pinch-to-zoom + dpr work
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Severity: normal → S3
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID

You reopened the other two, is this supposed to be reopened as well?

Flags: needinfo?(simon.mainey)

no, this is invalid, we do protect the value - https://searchfox.org/mozilla-central/source/layout/style/nsMediaFeatures.cpp#197 (it still has issues, but not at 100% zoom which we set on new tabs/eTLDs) - I inadvertently closed the wrong one Bug 1672093 because the titles were similar

Flags: needinfo?(simon.mainey)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: