On Tue, Mar 19, 2019 at 2:13 AM Xidorn Quan <
m...@upsuper.org> wrote:
> On Tue, Mar 19, 2019, at 6:01 AM, Daniel Holbert wrote:
> > As of today (March 18th 2019), I intend to turn CSS Containment
> > <
https://drafts.csswg.org/css-contain/> on by default on all platforms,
> in
> > Firefox Nightly 68. It has been developed behind the
> > 'layout.css.contain.enabled' preference.
>
> IIRC this feature is designed to allow authors to provide hints to UAs for
> some optimization opportunities in the rendering pipeline.
>
Right, yeah - that's the primary intent.
Does our implementation also include any such optimizations for faster
> rendering, or is it currently just a basic implementation for conformance?
>
It does! The main one is
https://bugzilla.mozilla.org/show_bug.cgi?id=1497414 (making
`contain:layout size` elements reflow roots.
If we already include optimizations based on the hints, do we know how much
> they help the performance?
>
It entirely depends on the use-case, and of course it depends on web
authors opting in to use it.
The best results will come from adding containment around rapidly-changing
(i.e. frequently-reflowing) content, in a page with other
expensive-to-reflow content (which we can then ignore during the frequent
reflows, if we make the rapidly-changing area into a reflow root). As one
example, we tried adding "contain:layout style" to the Web Console
text-entry area in
https://bugzilla.mozilla.org/show_bug.cgi?id=1502524 ,
and this gave a ~50% reduction in time spent in reflow for a particular
stress test. However, we had to back it out in that case, because the Web
Console's functionality depends on some layout information *not* being
contained. But that's an example of the sort of speedup that this can
give, in cases where it *is* appropriate to use.
- Xidorn