On Fri, May 23, 2014 at 10:12 PM, Jonas Sicking <[email protected]> wrote:
> 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? > Yes. Of course, the user can scroll in such a way that the content is never visible at the new scroll position, but we can ensure that the DOM changes and the scroll position change happen atomically. Note that "instant" is our current behavior for all scripted scroll position changes. 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); > On the viewport, we have scrollBy. CSSOM doesn't define that on elements but it should. I guess they should both take an optional ScrollOptions parameter. div.smoothScrollTo(pos, n); // does a smooth scroll over n ms. > Better to not take a duration parameter if there isn't a clear use-case. (Or is there?) div.setScrollPosition(pos); // ensures that the next time we paint, we > paint at scroll position pos > scrollLeft/scrollTop do this. Though I think elements should have the same scrollTo method that Window does, as well. 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. > Then let's not add it :-) Rob -- Jtehsauts tshaei dS,o n" Wohfy Mdaon yhoaus eanuttehrotraiitny eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o Whhei csha iids teoa stiheer :p atroa lsyazye,d 'mYaonu,r "sGients uapr,e tfaokreg iyvoeunr, 'm aotr atnod sgaoy ,h o'mGee.t" uTph eann dt hwea lmka'n? gBoutt uIp waanndt wyeonut thoo mken.o w _______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform

