Re: [CSSOM View] Units for window.screen

On Fri, 05 Jul 2013 04:20:42 +0200, Kang-Hao (Kenny) Lu  
<kanghaol@oupeng.com> wrote:

> (2012/09/26 14:37), Henri Sivonen wrote:>
>> According to http://mpulp.mobi/labs/ppk/widthtest_vpdevice.html and
>> http://www.quirksmode.org/m/tests/widthtest_vpdevice.html (be sure to
>> test both; see http://www.quirksmode.org/blog/archives/2012/09
>> /apples_mobi_ins.html) as tested on Galaxy Nexus/JB, Firefox (tested
>>  Nightly), Chrome, Opera Mobile and Android stock all make
>> window.screen.width and .height return in device pixels. The spec
>> says the unit should be CSS px.
>
> On the other hand, on my MacBook Pro with Retina Screen, none of
> Firefox, Presto-Opera, Safari, Chrome returns 2560 / 1600. They all
> return 1280 / 800.

I have left the spec as is, because screen.width and screen.availWidth etc  
are likely used together with window.resizeTo et al, which existing  
content most likely assumes to be measured in CSS pixels. If we change  
both to use device pixels, windows will get smaller than the author  
intended on high-DPI devices.

Bug about specifying resizeTo et al:  
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23127


> (By the way, what's the difference between these two tests?)
>
>> I don’t have iDevices here, but this is worth testing in Safari on
>> retina iPad&iPhone. If Safari agrees with the browsers available for
>> Android, perhaps the spec should accept this oddity instead of trying
>> to change it. (I don’t know what the screen stuff is good for
>> anyway—it’s the viewport that should matter to Web developers.)
>
> And it seems worse to have more Desktop UA/Small screen UA difference.
> Given that screen.width/height might have been used widely for tracking
> devices, it seems easier to change Desktop browsers.

It's not clear to my why that's easier, especially considering  
window.resizeTo et al.


> By the way, our folks complained that it's not easy to find the CSS unit
> requirment (3.1) from where Screen is defined (5.2). Perhaps it would be
> a good idea to have some more links here and there?

I gave the unit explicitly.

https://dvcs.w3.org/hg/csswg/rev/4e1eb18ee1a6

-- 
Simon Pieters
Opera Software

Received on Tuesday, 3 September 2013 12:20:08 UTC