Re: [cssom-view] Which APIs should be 'double' vs. 'long'

On Thu, Feb 12, 2015 at 5:39 PM, Simon Pieters <simonp@opera.com> wrote:

> On Mon, 09 Feb 2015 13:27:25 +0400, Simon Pieters <simonp@opera.com>
> wrote:
>
>  5) Viewport positioning/sizing
>>> Window: moveTo moveBy resizeTo resizeBy innerWidth innerHeight screenX
>>> screenY outerWidth outerHeight
>>> We have not attempted to turn these into double.  I suspect there's
>>> non-trivial web compat risk (as for element sizing/measurement).  There's
>>> also non-trivial work required for us to implement this in blink.  At the
>>> same time I'm not sure there's much benefit.  Last I checked, many OSes
>>> didn't support positioning/sizing windows at sub-DIP precision.  Unless
>>> other vendors feel differently, I think we should just change these back
>>> to
>>> 'long' in the spec.
>>>
>>
>> That seems reasonable. If the situation changes in the future and OSes
>> support sub-pixel window positioning and there is demand for this, we can
>> change it again and check if it is compatible, but currently it seems it
>> would be meaningless for browsers to change from long to double for these.
>> Also, window.open()'s features argument only supports integers currently.
>>
>
> Actually it seems it is already possible to have sub-CSS-pixel window
> size/position by changing the browser's zoom level. Certainly I can get
> non-integer values for getComputedStyle(document.documentElement).width
> by changing the browser zoom in Chrome/Opera/Firefox/Safari on Mac OS X.
>

D'oh - of course, that's a good point.  If you want to leave these 'double'
to reflect that they really are fractional that's OK with me.  We can file
a bug to track attempting to change this in blink (but without developer
demand or better interop it might not pop to the top of anyone's priority
list for awhile).

A possible bad effect of rounding the viewport to integers is if the author
> sets e.g. the width of an element to the reported viewport width, it might
> overflow by half a CSS pixel, causing horizontal scrolling. Fortunately
> doing something that gives the right result is simpler (width:auto or
> width:100%).
>
> It is likely that the Web assumes integer sizes for viewports, at least
> for media queries. I have seen media queries written like this:
>
> @media (max-width: 600px) { ... }
> @media (min-width: 601px) { ... }
>
> So still, it seems there is a real risk and little benefit for supporting
> sub-CSS-pixel viewports.


Sounds reasonable.  We can always revisit if we hear demand or see evidence
that the rounding is causing pain.


>
>
> --
> Simon Pieters
> Opera Software
>

Received on Friday, 13 February 2015 09:15:38 UTC