window.open scales incorrect

Fixed Issue #14489864

Details

Author
Steffen H.
Created
Nov 2, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Standard affected
CSSOM View Module

Found in build #
40.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; ServiceUI 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063

Steps to reproduce the problem:
1.Configure Windows to use 150% scaling.
2.Configure Edge to use 200% scaling.
3.window.open( 'test.html’, new Date().getTime(), ‘width=600, height=300’ );

What is the expected behavior?
The resulting window window should have
window.innerWidth == 600 && window.innerHeight == 300

https://drafts.csswg.org/cssom-view/#the-features-argument-to-the-open()-method

What went wrong?
window.open measures width and height in “windows pixels” instead of CSS pixels.

If the window contains a image with 600px x 300px it will not fit.

First test:
window.open( 'test.html’, new Date().getTime(), ‘width=600, height=300’ );

Windows Edge Result (innerWidth x innerHeight)
100% 100% 600 x 300 (correct)
100% 200% 400 x 200 (incorrect)
150% 100% 602 x 302 (almost correct)
150% 200% 301 x 151 (incorrect)

The problem can be shifted:

window.open( 'test.html’, new Date().getTime(), ‘width=’ + ( 600 * devicePixelRatio ) + ‘, height=’ + ( 300 * devicePixelRatio ) );

Windows Edge Result (innerWidth x innerHeight)
100% 100% 600 x 300 (correct)
100% 200% 600 x 300 (correct)
150% 100% 902 x 452 (incorrect)
150% 200% 901 x 451 (incorrect)

So the solution can either handle windows scaling or chrome scaling but not both.

If there was a way to detect the scale factor of edge or windows independently, the problem would be easy to solve.
However I only found devicePixelRatio which gives the product of windows and edge scaling (i.e. 3.0 if windows is at 150% and edge is at 200%).

Firefox and Internet Explorer work correctly on Windows 10.
Chrome and Edge behave equally incorrect.

Is there a workaround? devicePixelRatio only helps for browser scaling but makes windows scaling even worse… I did not find a way to detect windows pixel scaling from within the browser. It would also help to detect browser scaling alone (devicePixelRatio / browser scaling = windows scaling)…

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Status to “Fixed”

    • Thanks for filing this bug! We investigated and discovered that this is a known issue that requires work at the Windows level to work correctly. I’ve resolved this bug as a duplicate of the bug we have tracking this dependency. 

    • Can you post a link to the duplicated bug?

    You need to sign in to your Microsoft account to add a comment.

    Sign in