Re: [csswg-drafts] [css-display] Unclear definition of "formatting context" (#5105)

> How can one box nested inside another can continue in the identical layout the other is in?

<details><summary>For example, subgrids</summary>

```css
#foo { display: grid }
#bar { display: grid; grid-template-columns: subgrid }
```
```html
<div id="foo">
  <div id="bar">
    <div id="baz"></div>
  </div>
</div>
```

Then `#foo` is a grid container and establishes a grid formatting context (GFC). `#bar` is a grid item, it participates in that GFC. And `#bar` is also a grid container, but does not establish an independent GFC. Instead, `#baz`, a subgrid item of `#bar`, participates in the GFC established by `#foo`.
</details>

<details><summary>Another example: nested inlines.</summary>

```html
<div id="foo">
  <span id="bar">
    <span id="baz"></span>
  </span>
</div>
```

Then `#foo` is a block container and establishes an inline formatting context (IFC). `#bar` is an inline which participates in that IFC. `#bar` does not establish any FC of its own, so `#baz` participates in the IFC established by `#foo`.
</details>

<details><summary>Another example: nested blocks.</summary>

```css
#foo { display: flow-root }
```
```html
<div id="foo">
  <div id="bar">
    <div id="baz"></div>
  </span>
</div>
```

Then `#foo` is a block container and establishes a block formatting context (BFC). `#bar` is a block which participates in that BFC. `#bar` does not establish any FC of its own, so `#baz` participates in the BFC established by `#foo`.
</details>

I disagree with "fragmentation". Fragmentation is relevant to the fragment tree, here we are talking about the box tree.

> Also I'm not sure if "containing block" is correct here.

Seems correct. It can't be "parent box" because you can have a block inside an inline. The inline is participating in an inline formatting context (IFC), but the block is participating in a block formatting context (BFC). And the IFC may be established by a descendant of the BFC root.

Well, technically the containing block is just a rectangle, but there is handwaving: "If properties of a containing block are referenced, they reference the values on the box that generated the containing block."

> An inner display type is defined for an element, not for a box

Oh, see #1480. The outcome was good enough for me, but you seem more purist :)

> there are more definitions that are circular, like for example of "inline box"

Note that the proper place for defining "inline box" is the Flow Layout spec, which doesn't exist yet. CSS Display is just trying to provide a quick summary.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5105#issuecomment-632974556 using your GitHub account

Received on Saturday, 23 May 2020 02:50:47 UTC