Re: [w3ctag/design-reviews] Rendering Independent Scroll Offsets (#409)

Thanks for the review! I'll follow up in www-style.

> There is one loss of information in that prior to this change, what it sounds like Chrome and Firefox were doing reported the way the implementation did pixel-snapping -- something that I suppose could potentially be useful.

Yes and no; it's rather inconsistent. For example, Firefox will report the pixel snapping for user scrolls (e.g. trackpad scrolling on a 2X high-DPI monitor will show 0.5 increments in `window.scrollY`) but not for programmatic scrolls (on the same high-DPI monitor, `window.scrollTo(0, 10.5)` will report 10 for `window.scrollY`). Another case: Chrome doesn't report snapping information when pinch-zoom is involved.

> But assuming that implementations are consistent about doing pixel-snapping of scroll positions the same way they do pixel-snapping of edges

One interesting detail I learned recently is that Chrome does subpixel blending for layout but not for scroll (when fractional offsets are turned on). Here's an [example](https://output.jsbin.com/yepocox/11). That is, if layout falls inbetween a physical pixel, the painted result will actually blend the boundary pixels. In the example, we paint purple rather than red or blue for the "boundary" pixel.

I'm not sure it'd be good to specify exactly how snapping should work. e.g. for scrolling, we probably don't want to continually apply the subpixel blending since it causes us to do a lot of extra work and defeats the "off-main-thread" compositing/async scroll optimizations.

I agree though we want to make it possible to align layout positioning with scroll offsets for per-pixel accuracy so, for example, one shouldn't snap using `floor()` and the other `round()`. I'll have to do a bit more research here and I'll follow up with the CSS group to figure out how much of this should be specified vs. UA defined.

Thanks again!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/409#issuecomment-528918578

Received on Friday, 6 September 2019 16:16:54 UTC