On Thu, May 22, 2014 at 1:50 PM, Kip Gilbert <[email protected]> wrote:
> Link to standard:
>
> http://dev.w3.org/csswg/cssom-view/#smooth-scrolling:-the-%27scroll-behavior%27-property

How will "scroll-behavior: instant" work on platforms that use APZ? I
worry about authors expect it to enable them to do a bunch of DOM
mutations and then set the scroll position and allow them to be sure
that rendering can't happen of the new DOM but at the old scroll
position (or the old DOM but at the new scroll position). Can we
promise that when using APZ?

One use case that has come up for us in FirefoxOS is the ability to
add a few elements to the top of a page, shifting down the contents of
the page, but then make that transparent to the user by adjusting the
scroll position accordingly.

That isn't possible with APZ since the user might be actively
scrolling and so if we just do something like

div.scrollTop += hightOfNewContent;

then the newly set scroll position will be based off of an old value
which has already changed on the compositing thread.

Basically we need an API like

div.addToScrollPosition(hightOfNewContent);

This would allow the browser to send this delta to the compositing
thread along with the newly updated painting of the DOM.

I wonder if we need something similar for smooth-scrolling. So rather
than a CSS property, have something like something like:

div.smoothScrollTo(pos, n); // does a smooth scroll over n ms.

div.setScrollPosition(pos); // ensures that the next time we paint, we
paint at scroll position pos

div.immediatelyScrollTo(pos); // sends a signal immediately to the
composition thread to jump to pos, possibly before any painting has
happened. I'm not sure if this one has use cases.

/ Jonas
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to