Unable to test with page zoom in / zoom out or different device pixel ratio
I would like to test that a image's width / height scales with device pixel ratio but its natural width and natural height remains.
In Blink layout test, we could do things like eventSender.zoomPage{In,Out}(), I am wondering if we could do something similar here.
Thanks
It looks like there is no support in https://w3c.github.io/webdriver/ for controlling the viewport zoom level, https://w3c.github.io/webdriver/#set-window-rect just allows you to set a size.
https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerconnectoptions does support a deviceScaleFactor setting, so this is clearly something that's possible to do in principle.
There is kind of support for setting the device pixel ratio in reftests, but it's only implemented in Servo. So we could also extend that support to more implementations if you don't need to test dynamic changes (but being able to set the zoom using an API seems obviously like a thing WebDriver should expose and that we should add to testdriver).
What does that support look like in Servo? Dynamic changes to the device pixel ratio (as opposed to zoom level) isn't something that actually happens in real browsers, so being unable to test that seems fine.
Servo has a command line flg to set dpppx and servo is restarted for each test, so a test with the relevent <meta> element sets that flag on startup.
For other browsers which expose this via a pref or whatever we would presumably have to arrange for a restart before a test with a change in pixel ratio compared to the previous test; wptrunner already has support for such things. For the marionette backend it might be possible to adjust the value without a restart, depending on whether gecko supports that or not.
The inability to test this makes it harder to test optical sizing with fonts. As an example: we've experienced issues with device pixel ratio > 1 and optical sizing in https://bugs.chromium.org/p/chromium/issues/detail?id=1305237. So indeed this would be useful.
In addition to device pixel ratio, we also cannot test OS settings such as the OS font scale setting of the device.