On Sun, Oct 13, 2013 at 4:43 PM, Patrick Walton <pwal...@mozilla.com> wrote:

> This did make me realize something, however: If there are a subset of CSS
> properties that can be changed from a worker thread, then those layout
> properties can be changed from the main thread as well, without a trip
> through layout. In other words: When changing something like transform, if
> the node in question is layerized, we could talk directly to the compositor
> from the script task. One could imagine at least some subset of events also
> working this way, for example scrolling: the compositor could send a scroll
> event directly to the script task if it knows about a scrollable frame and
> the DOM node it maps to. If layout is asynchronous and the script task is
> not blocked on it, then it can respond directly to those events on the main
> thread, as native apps do.
>

Gecko (and Webkit/Blink) already do stuff like that, insofar as scripted
transform changes and changes to certain other properties do not cause
reflow. When there are multiple changes, some of which require reflow and
some of which don't, you need to wait for the reflow to happen because
otherwise you could render an invalid frame.

This strikes me as a technically better solution, because it provides some
> mechanism for receiving events, as well as all the other main-thread-only
> APIs (such as reading from the DOM!) in the thread that's responsible for
> the animation. It's also hugely more usable to Web authors, because it
> doesn't require use of Web workers and the message passing that comes with
> it to get good performance. The downsides are that it requires Web authors
> to not use the blocking layout APIs to avoid shooting themselves in the
> foot, and that it requires Servo's off-main-thread-layout design, which
> Chromium seems to have unfortunately decided against.


The biggest downside is that if the main thread gets busy with script
activity, the animation janks.

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-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to