[csswg-drafts] [css-shapes-1] Unclear on "margin-box" dimensions when box model is over-constrained

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

== [css-shapes-1] Unclear on "margin-box" dimensions when box model is over-constrained ==
The "margin-box" in question is the one defined in [css-shapes-1](https://drafts.csswg.org/css-shapes-1/#valdef-shape-box-margin-box) relating to basic shapes. In this example:
```
<body style="width: 1000px">
 <div style="width:100px; margin-left: 100px; margin-right: 100px; clip-path: ellipse()"></div>
</body>
```
There seems to be a presumption in the spec, in Firefox's implementation and the web-platform-test [clip-path-polygon-008.html](https://github.com/web-platform-tests/wpt/blob/master/css/css-masking/clip-path/clip-path-polygon-008.html) that the ellipse is calculated against a width of 300px.

_"All the lengths expressed in percentages are resolved from the used dimensions of the reference box."_, but CSS 2.1 [10.3.3](https://www.w3.org/TR/CSS21/visudet.html#blockwidth) indicates that the used value of margin-right in the above example is 800px: the values are overconstrained so the computed value for margin-right is ignored.

If the two margin values above are changed to `auto`, then the used values are `(1000px-100px) / 2 = 450px` each. This matches the behaviour of Firefox, which is the only browser I have here that supports this syntax.

So one of two things has to give:

1. Is the intention more like "... percentages are resolved from _not-quite-used_ dimensions of the reference box; these are identical to the _used_ dimensions in the way that percentages and "auto" values are resolved, but any additional constraints on used values described in CSS2.1 section 10 are not applied"? If so then the spec needs updating to reflect this, and I have a feeling this area might be more complex than it appears.

2. The specified behaviour is correct, in which case the testcase and implementation(s) need updating. If that's the decision I'm happy to update the testcase.


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

Received on Thursday, 1 November 2018 16:58:11 UTC