- From: Gérard Talbot <www-style@gtalbot.org>
- Date: Wed, 14 Dec 2016 12:14:36 -0500
- To: Jan Norden <jan.norden@gmail.com>
- Cc: W3C www-style mailing list <www-style@w3.org>
Le 2016-12-14 10:09, Gérard Talbot a écrit : > Le 2016-12-13 08:46, Jan Norden a écrit : >> There is currently no good way of translation a position in a browser >> to a >> position on the screen. > > Jan, > > Let me rephrase what I believe you were trying to say here, like this: > there is currently no possible way of getting (retrieving) window's > viewport (or client area) x and y coordinates of a browser in relation > to the (operating system) screen area. > >> Our particular need is translating a gaze-position >> (which we have in screen coordinates from our eyetracking hardware). >> >> It is possible in Firefox, using the proprietary >> mozInnerScreenX/mozInnerScreenY, >> but not in general. > > window.screenX > https://developer.mozilla.org/en/docs/Web/API/Window/screenX > > window.mozInnerScreenX > https://developer.mozilla.org/en-US/docs/Web/API/Window/mozInnerScreenX > > window.screenY > https://developer.mozilla.org/en/docs/Web/API/Window/screenY > > window.mozInnerScreenY > https://developer.mozilla.org/en-US/docs/Web/API/Window/mozInnerScreenY > > > I added the mozInnerScreenX and mozInnerScreenY properties into an old > webpage > > http://www.gtalbot.org/DHTMLSection/WindowEventsNS6.html > > and, as far as I can see, the mozInnerScreenX and mozInnerScreenY > properties return the equivalent of IE's screenLeft and screenTop. > > " > There is a major incompatibility between MSIE 5+ window.screenTop and > NS 6+ window.screenY. MSIE 5+ calculates the distance from the top of > the content area (client area) to the top side of the screen. NS 6+ > calculates the distance from the top of the browser's window to the > top side of the screen. There seems to be no way to figure out the > height of chrome elements (menu bar, tools bar, address bar, links > bar) present in the browser for MSIE 5+. > " > so, the addition of mozInnerScreenX and mozInnerScreenY properties > makes sense. > > http://www.gtalbot.org/DHTMLSection/ScreenXYComparedScreenLeftTop.html > > IE6, IE7, IE8 supported window.screenLeft and window.screenTop which > are, by definition, the equivalent of mozInnerScreenX and > mozInnerScreenY. I presumed here that window.screenLeft and > window.screenTop are still supported by IE9, IE10, IE11. > > window.screenLeft > "Retrieves the x-coordinate of the upper left-hand corner of the > window frame, relative to the upper left-hand corner of the screen." > https://msdn.microsoft.com/en-us/library/ms534389(v=vs.85).aspx > > window.screenTop > "Retrieves the y-coordinate of the upper left-hand corner of the > window frame, relative to the upper left-hand corner of the screen. " Duh! Correct quote for screenTop! "Retrieves the y-coordinate of the top corner of the client area, relative to the top corner of the screen." > https://msdn.microsoft.com/en-us/library/ms534390(v=vs.85).aspx Strangely, the screenLeft property definition is not related to client area but rather to window frame. I suspect MSDN documentation to be wrong here. Gérard > > Returning now to your initial statement, I believe there is a way of > getting window's viewport (or client area) position of a browser in > relation to the (operating system) screen area in Gecko-based browsers > and in IE browsers. I do not know (I can not verify) if > window.screenLeft and window.screenTop are supported in Edge12+ > browsers but typically Microsoft does not remove proprietary > attributes or properties of objects unless there is already a web > standard (and widespread-used) equivalent. So I would presume that > window.screenLeft and window.screenTop are supported in Edge12+ > browsers too. > > From a web standards point of view, best would be to have and to use > only 1 pair of property name (window.innerScreenX and > window.innerScreenY, no moz prefix), to have Microsoft to drop > window.screenLeft and window.screenTop and to include such pair of > property names in > CSSOM View Module > https://drafts.csswg.org/cssom-view/ > inside the §4. Extensions to the Window Interface, say, right after, > https://drafts.csswg.org/cssom-view/#dom-window-screeny > > Gérard
Received on Wednesday, 14 December 2016 17:15:11 UTC