W3C home > Mailing lists > Public > public-houdini@w3.org > May 2019

Re: [css-layout-api] More accessible explanation for intrinsicSizes

From: Ian Kilpatrick <ikilpatrick@google.com>
Date: Tue, 7 May 2019 08:41:02 -0700
Message-ID: <CAJL3UpRgNJDrOszeTSucaRn7Z+A1JQXxHimaDRByrjB+ez+5_g@mail.gmail.com>
To: Bob Hamblok <post@bhamblok.be>
Cc: public-houdini@w3.org
Hi Bob,

On Tue, May 7, 2019 at 5:17 AM Bob Hamblok <post@bhamblok.be> wrote:

> Dear all,
> After reading the spec, and playing around with some code, I would like to
> get to know some more about "when and where" the "intrinsicSizes"-function
> would be used.
> I notice that Chrome Canary hasn't implemented this feature yet, and I
> also don't see an example implementation in "
> https://github.com/GoogleChromeLabs/houdini-samples".
> I'm particularly wondering:
> - what is the purpose of this function anyway :-) ? When I provide a
> return-value for the properties "minContentSize" and "maxContentSize", what
> behaviour should I expect?

This is used for a few different layout modes which require a little bit of
extra information before determining an elements inline-size (width). The
simplest case is:
<div style="width: max-content; display: layout(thing);"></div>

This will call the intrinsicSizes function, and use the result of
maxContentSize as the width (fixedInlineSize).

Other cases where this may be called is:
 - Absolute/fixed positioned elements, e.g. <div style="position:
absolute;"></div> (no width constraints).
 - Floating elements. <div style="float: left; width: auto;"><div>
 - Children of flex/grid layout algorithms.

For a lot of cases it is relatively uncommon however.

> - when is "intrinsicSizes" for each child being invoked? Just before it's
> own "layout"-function is being invoked? Or are all
> "intrinsicSizes"-functions being invoked for all children (multiple levels
> deep) before all "layout"-functions will be invoked?

In the above cases. Typically before the layout function, but not always.
If a parent layout needs to determine its intrinsicSizes it will
(potentially) call its children as well. E.g:
<div style="width: max-content; display: block;"> <!-- calls all of its
children -->
  <div style="width: auto; display: layout(thing);"></div>

> - will it be possible to return a "data"-object-property, aside from the
> "minContentSize" and "maxContentSize" properties?

What is your usecase for this? (we haven't considered it yet).

Currently in the Blink implementation we haven't hooked up the
intrinsicSizes function yet (which is why it never gets called!).

> Thank you so much for your help,
Thanks for testing things out!

> All the best,
> *Bob Hamblok | BOAPP GCV*
> Freelance Software Engineer | Architect | Consultant
> founder at neoScores NV
> *EMAIL* post@bhamblok.be
> *PHONE* +32 476 74 78 42
> *ADDRESS* Peter Benoitstraat 38, BE-2018 Antwerp, Belgium
> *VAT* BE0682.695.007

Received on Tuesday, 7 May 2019 15:41:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:53:28 UTC