RE: [css-regions] performance of regions fragmentation

± On 1/22/14, 10:41 PM, "L. David Baron" <dbaron@dbaron.org> wrote:
± > I think CSS regions make a very poor primitive because they have very
± > poor performance in interesting cases.  Rather than always having a
± > simple and fast behavior, they have behavior that requires
± > multiple-pass layout in some cases (especially when combined with
± > other features like CSS Exclusions).
± 
± I disagree with your characterization of ‘very poor performance’ - what we
± have in the specification is there specifically to limit the performance
± implications of fragmentation in edge cases. The point of section 7 is to
± optimize for performance, and limit the requirements to two-pass layout
± (not multiple-pass layout).
± 
± I’m not sure what you mean about combining with CSS Exclusions. Yes, when
± you combine features complexity goes up. I don’t see anything special about
± the combination of regions and exclusions.

I'm not into David's head but my take is that there's a strong assumption in the region layout code that is not possible to express in CSS right now: layout independence. To clarify, layout code makes the assumption that the following regions will not affect the layout of the previous regions. That's however not accurate in at least a few situations.

Let's take an example that use CSS Exclusions:

 <section id="content">
  <article style="flow-to: content">...</article>
 </section>
 
 <section id="article-presenter" style="position: relative; ">
  <div style="flow-from: article; max-height: 100vh; "></div>
  <div style="flow-from: article; position: absolute; width: 33vw; top: 0px; right: 0px; wrap-flow: start;"></div>
 </section>

Which looks like

 #####
 #####
 #####
 #####

Or

 ###@@
 ###@@
 #####
 #####

Or

 ###@@
 ###@@
 ###@@
 ###@@
    @@
    @@

Depending on the content being flowned into the two DIVs.

This is a problem, because the non-excluded area of the first region element depends on the height of the second region... which depends on the content that overflows the first region, which depends on the non-excluded area of the first region. Ooops.

Please note that this is not a CSS Regions issue, though, because you could in fact replace the two DIVs by overflow fragments which David claims provide saner semantics. Solving this issue is non-trivial and may be worth some discussion.

Regards,
François

Received on Thursday, 23 January 2014 18:26:32 UTC