web-platform-tests / web-platform-tests/rfcs
Device pixel ratio for tests
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 110
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
https://web-platform-tests.org/writing-tests/assumptions.html doesn't document anything about what the device pixel ratio of the viewport is (for HiDPI/Hi-DPI/retina/etc. displays).
RFC #41: Print Testing says for print that we rasterise it at 96 dpi, but doesn't say what device pixel ratio we render at:
The WebDriver-based implementation first renders the document to a PDF, and then computes the reftest result by rasterising the test and ref PDFs at 96 dpi.
There is prior discussion in https://github.com/web-platform-tests/wpt/issues/7140, https://github.com/web-platform-tests/wpt/issues/20284, and https://github.com/web-platform-tests/wpt/issues/31457.
As far as I can tell, for Gecko it is set to 1.0 in:
And:
WebKit, for WKTR, sets it in:
This is, however, ignored on iOS. (For DRT, it's set in many places, per-platform, and I'm not gonna link to all of them here!)
Chromium I think does this in many places, depending on how it is being run, but I'm not totally sure. That said, some of the failures on wpt.fyi seem like they might be caused by running at a device pixel ratio which is not 1.0, though we don't have screenshots to see what's going on there.
Currently, on wpt.fyi, Edge and Safari are both run on HiDPI screens, I believe; see https://github.com/web-platform-tests/wpt/issues/5498 and https://github.com/web-platform-tests/wpt/issues/20058.
WebDriver doesn't expose any way to change the device pixel ratio, https://github.com/w3c/webdriver/issues/1547, though WebDriver BiDi does, thus currently our only way to do this is via settings.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the assumptions page and RFC #41's print-testing section, then compare the linked Firefox, Firefox Android, WebKit, and prior WPT issue discussions. Check how Chromium and the wpt.fyi Edge and Safari environments set device pixel ratio, including the WebDriver and WebDriver BiDi constraints. Done means the relevant viewport and print-rendering assumptions are documented with the known browser and platform differences.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation, testing
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100