Re: [CSSOM View] Units for window.screen

On Sat, 07 Sep 2013 02:33:30 +0200, Robert O'Callahan  
<robert@ocallahan.org> wrote:

>> You mean parameters to window.open? Hmm.

Yes (although that's not specced out at all in HTML), but also  
window.resizeTo().


>>> Things that are sized in CSS pixels have no use of the screen's width.
>>>
>>
>> Maybe the problem is that I don't know what the legitimate uses are for
>> getting the screen width. I know it's used as part of device sniffing,  
>> but
>> that's inherently bogus.

Yeah.


> To clarify, I don't see sizing popups to fill half your screen, or
> something like that, as being legitimately useful.

I don't disagree.

> (If you want to fill the
> screen, we have the fullscreen API for that.)

Yes.


> Popup windows are mostly
> blocked and when they are used they should be sizing based on their
> content. In most cases they should probably inherit the parent window's
> zoom as well.

That's a good point.

It seems that Firefox uses CSS pixel with the opener's zoom level for  
window.open(), but the popup window doesn't inherit the zoom (at least for  
a data: URL). open() sizes the viewport, but resizeTo() sizes the whole  
window. For sizing based on the content, you would want to size the  
viewport in CSS pixels using the popup's zoom level.

I think I'll change the spec for resizeTo() to size the viewport and use  
the popup's CSS pixel as unit. I might spec the third argument to  
window.open() as well since it is related.

As for screen.width, it seems Firefox uses CSS pixel at current zoom but  
Blink (and Safari on iOS) uses CSS pixel at 100% zoom.

If it's not useful for sizing popups, there isn't much left. Detecting  
devices based screen.width would be less reliable if it changed based on  
zoom. Fingerprinting would either be stronger or be more confused,  
depending on how often the user changes zoom level. Would it be a bad idea  
to return static values for these, or maybe the viewport dimensions?

-- 
Simon Pieters
Opera Software

Received on Saturday, 7 September 2013 19:08:30 UTC