Re: [csswg-drafts] [css-sizing-4] How does height: stretch interact with margin collapsing with parent (#11044)

Some practical constraints from an engine perspective.
Blink doesn't know anything about any proceeding margins, e.g. 

```
<div style="height: stretch; margin-bottom: 10px"></div>
<div style="margin-bottom: 20px;"></div>
content
```

(Blink at the time of giving the first div a height, doesn't know about the 20px margin).
This is a simple case, but the *end* margins can come from an arbitrary sibling, and we really don't want to break this invariant.

From a simplicity of implementation POV ignoring margins entirely might be an option.

A tradeoff which might be acceptable is to consider the elements (own) margins if the element is a *direct* child of a BFC. But from an implementation simplicity POV ignore collapsing e.g.

```
<div style="display: root; height: 100px;">
  <div style="margin: 10px; height: stretch;"></div>
</div>
```

Then for the case where the child has a non-BFC parent ignore the margins.

Also note that we are somewhat compat constrained if we want to keep `stretch` as a pure alias of `-webkit-fill-available`.

Ian

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 17 October 2024 21:23:29 UTC