Windows: display::Screen rotation different from window.screen.orientation.angle |
|||||||||||
Issue descriptionChrome Version: 66.0.3346.0 (Developer Build) OS: Win10 Surface Tablet What steps will reproduce the problem? (1) Add log lines to have the system log display::Screen::GetScreen()->GetPrimaryDisplay().rotation() (2) Rotate the device 90 degrees left (3) Open a page and run window.screen.orientation.angle. Compare with the logged rotation(). What is the expected result? The readings should be display::Display::ROTATE_90, and 90. (this will be the case if you try it on Android) What happens instead? window.screen.orientation.angle reads 90, rotation() reads display::Display::ROTATE_270 Came across this problem when I tried https://webvr.info/samples/03-vr-presentation.html with the "WebXR orientation sensor device" and "WebVR" flags enabled. On android devices works as expected, on Windows the view is turned upside down. Traced the cause to this.
,
Mar 8 2018
,
Mar 8 2018
,
Apr 3 2018
,
May 11 2018
robliao: Do you have any ideas on this Windows-specific issue?
,
May 14 2018
Windows measures rotation in the clockwise rotation, hence rotating to the left is indeed a 270 degree rotation. Mac also computes with respect to the clockwise direction. It sounds like Android devices are actually reporting the wrong value?
,
May 14 2018
vollick, lincolnfrog: Any thoughts based on your recent experience with the rotation code?
,
May 15 2018
Sadly, no. I've just been mechanically replacing numeric angles w/ corresponding enums.
,
May 15 2018
The relevent documentation for window.screen.orientation.angle https://www.w3.org/TR/screen-orientation/#dom-screenorientation-angle. This states: "angle indicates how far the user has turned the device counterclockwise from the natural orientation. When the device is rotated 90° counterclockwise, the screen compensates by rotating 90° clockwise, so angle returns 90." For display::Display::rotation() we have https://cs.chromium.org/chromium/src/ui/display/display.h?q=display::Display&sq=package:chromium&g=0&l=36 which links to https://cs.chromium.org/chromium/src/components/policy/proto/chrome_device_policy.proto?q=components/policy/proto/chrome_device_policy.proto&sq=package:chromium&dr&l=722 Which states: "all displays will be rotated clockwise to the specified orientation at reboot, when first connected, or when the setting is changed." This makes it sound like this rotation is also meant to counter a physical counter-clockwise rotation of the display. Is there any documentation stating that display::Display::rotation() represents the physical rotation of the display? Is it used as the physical rotation of the display?
,
May 17 2018
We've tended to favor what the platform provides in display::Display, and since both Windows and Mac provide clockwise references, we've stuck with that as native code tends to follow the native conventions. This does suggest the code that populates the DOM screen orientation angle needs to do a clockwise->counterclockwise transform to account for the difference in definition.
,
Jul 9
,
Jul 12
,
Jul 16
,
Aug 16
,
Aug 16
|
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by offenwanger@chromium.org
, Feb 12 2018