New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 811453 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocking:
issue 820308



Sign in to add a comment

Windows: display::Screen rotation different from window.screen.orientation.angle

Project Member Reported by offenwanger@chromium.org, Feb 12 2018

Issue description

Chrome 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.

 
Blocking: 695937
Cc: alexande...@intel.com
Components: Blink>Sensor>DeviceOrientation
Labels: Proj-VR
Components: -Blink>Sensor>DeviceOrientation Blink>ScreenOrientation
Blocking: -695937 820308
Cc: offenwanger@chromium.org
Status: Available (was: Untriaged)
Cc: vollick@chromium.org robliao@chromium.org
Summary: Windows: display::Screen rotation different from window.screen.orientation.angle (was: display::Screen rotation different from window.screen.orientation.angle)
robliao: Do you have any ideas on this Windows-specific issue?
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?
Cc: lincolnfrog@chromium.org
vollick, lincolnfrog: Any thoughts based on your recent experience with the rotation code?
Sadly, no. I've just been mechanically replacing numeric angles w/ corresponding enums.
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?


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.
Labels: Proj-XR
Labels: VR-Desktop
Labels: -VR-Desktop
Blocking: 773829
Blocking: -773829

Sign in to add a comment