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

Thanks @Loirooriol. I guess I'm not fully on the right track yet. May I ask a few more questions to better understand it?



1. Are additional boxes always nested in the principal box?

With "additional boxes" I mean the boxes an element may generate in addition to its principal box.

> for each element, CSS generates zero or more boxes as specified by that element’s display property. Typically, an element generates a single box, the principal box, which represents itself and contains its contents in the box tree. However, some display values (e.g. `display: list-item`) generate more than one box (e.g. a principal block box and a child marker box).

Are these additional boxes always nested in the principal box in the box tree? Or can they be a sibling to the principal box in the box tree?

Otherwise the principal box could be defined as the "outermost" box generated by the element in the box tree, since any additional boxes are nested within the principal box.



2. What does "continue" a formatting context mean?

> A box either establishes a new independent formatting context or continues the formatting context of its containing block.

> Certain properties can force a box to establish an independent formatting context in cases where it wouldn’t ordinarily. For example, making a box out-of-flow causes it to blockify as well as to establish an independent formatting context. [..] Turning a block into a scroll container will cause it to establish an independent formatting context

Assuming there are no out-of-flow boxes, i.e. no floating boxes and no positioned boxes, what is the difference between creating a new independent FC and "continuing" the parent FC? Is there an example where there is a difference?

If so, then it must be answered how a formatting context handles a nested set of boxes. The nested boxes must "stay inside" the parent boxes (assuming no overflow) instead of being laid out sequentially, like any formatting context is defined.

> In a block formatting context, boxes are laid out *one after the other*, vertically, beginning at the top of a containing block

> In an inline formatting context, boxes are laid out horizontally, *one after the other*, beginning at the top of a containing block.

This is what I tried to discuss in my previous answer.



3. How can two formatting contexts "co-exist"?

> Note: A block container box can both establish a block formatting context and an inline formatting context simultaneously.

> an inline formatting context exists within and interacts with the block formatting context of the element that establishes it, and a ruby container overlays a ruby formatting context over the inline formatting context in which its ruby base container participates.

I'm wondering how two sets of "rules that dictate how to lay out descendant boxes" can co-exist without interfering?

Can't these "co-existing" formatting contexts be interpreted as a single formatting context, which is the union of the rules that make up the individual FCs? Like supersets so to speak?

For example, a block formatting context could be viewed as a superset of an inline FC. It allows block-level boxes to flow in block direction but also inline-level boxes to flow in inline direction by distributing them in block-level wrapper line boxes.

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

Received on Friday, 29 May 2020 16:53:17 UTC