w3c/csswg-drafts

[cssom-view] window.innerScreenX windows.innerScreenY

Open

#809 opened on Dec 15, 2016

View on GitHub
 (12 comments) (20 reactions) (0 assignees)HTML (3,546 stars) (545 forks)batch import
Help Wantedcssom-view-1

Description

For the browser as such it is possible to obtain both the dimensions and the positon on the (operating system) screen area:

https://drafts.csswg.org/cssom-view/#dom-window-outerwidth https://drafts.csswg.org/cssom-view/#dom-window-outerheight https://drafts.csswg.org/cssom-view/#dom-window-screenx https://drafts.csswg.org/cssom-view/#dom-window-screenx

However, for the viewport it is only possible to obtain the dimensions, not the position:

https://drafts.csswg.org/cssom-view/#dom-window-innerwidth https://drafts.csswg.org/cssom-view/#dom-window-innerheight

The fact that the position is not available makes it impossible to translate coordinates on the screen to coordinates in the viewport.

I therefore propose the addition of corresponding innerScreenX and innerScreenY properties.

Since this translation is already performed by e.g. window.onMouseMove(), implementing the properties should not present any new technical or conceptual challenges.

The need arises when you get (OS) screen coordinates from some non-mouse source (in our particular case an gaze-tracking device), and want to relate them to the corresponding position in the displayed document.

There are non-standard implementations, e.g. mozInnerScreenX https://developer.mozilla.org/en-US/docs/Web/API/Window/mozInnerScreenX.

A previous request for another vendor-specific implementation was declined awaiting standardization https://bugs.chromium.org/p/chromium/issues/detail?id=151983 .

Contributor guide

[cssom-view] window.innerScreenX windows.innerScreenY · w3c/csswg-drafts#809 | Good First Issue