[csswg-drafts] [css-break] Clarify definition of widow and orphans.

frivoal has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-break] Clarify definition of widow and orphans. ==
[The section on orphans, widows in css-break](https://drafts.csswg.org/css-break/#widows-orphans) says this:

> The `orphans` [resp. `widow`] property specifies the minimum number of line boxes in a block container that must be left in a fragment before [resp. after] a fragmentation break.
> [...]
> If a block contains fewer lines than the value of widows or orphans, the rule simply becomes that all lines in the block must be kept together. 

While it is clear to me what this is supposed to do if the block container only contains inline-level content, the meaning is less obvious when it has block level descendants.

Take this example:
```html
<style>div {  widows: 3; }</style>
<div>
  <p>
    line 1<br>
    line 2
  </p>
  <p>
    line 3<br>
    line 4
  </p>
</div>
```

https://www.w3.org/TR/css-display-3/#block-container is pretty clear that block containers can either contain online inline-level boxes or block level boxes, but the terminology isn't 100% clear (as far as I can tell) about whether a block container that contains block level elements can still be said to have "line boxes in it” (indirectly, via its block level children that themselves are block containers containing inlines), or if it should be considered not to have "line boxes in it”.

1. If the above spec prose is to be interpreted as applying only to line boxes that are direct children of  block containers that establish an inline formatting context, then `widows:3` forbids breaks inside both `<p>`, but does not prevent breaks between line 2 and 3: 

> If a block contains fewer lines than the value of widows or orphans, the rule simply becomes that all lines in the block must be kept together. 

The block has no (direct) lines, there's nothing to keep together, and the break is allowed.

2. If the above prose is meant to apply to line boxes that are descendants of the block container, at any depth (but presumably within the same BFC), the the break between line 3 and 4 would be forbidden.

---

I think the spec intends the first one. If that is the case, I suggest clarifying by changing the "Applies to" line to "Block container boxes that establish new inline formatting contexts" and/or by adding the following prose: “The `widows` and `orphan` properties have no effect on block container boxes that contains only block-level boxes”.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1823 using your GitHub account

Received on Monday, 18 September 2017 07:21:07 UTC