Re: [csswg-drafts] [css-sizing-4] Clarify spec about when elements are allowed to not have a last remembered size (#6220)

In #7527 we resolved

> If, when an element goes from not generating a principal box to generating one, it does not have cis:auto, forget any last remembered size

Given that, I'm now more convinced that the last remembered size should be forgotten during the first layout after removing `auto`, even if there hasn't been any ResizeObserver opportunity, as I said in https://github.com/w3c/csswg-drafts/issues/6220#issuecomment-830711439.

Otherwise it doesn't look consistent:

```js
// element has last remembered size
element.style.containIntrinsicSize = "none";
element.offsetLeft;
// element still has last remembered size
```

```js
// element has last remembered size
element.style.display = "none";
element.offsetLeft;
element.style.display = "";
element.style.containIntrinsicSize = "none";
element.offsetLeft;
// element doesn't have a last remembered size
```

Also, it's simpler from an implementation point of view to just clear the last remembered size when laying out.

I don't buy this argument:

> The problem with this definition is that it's not clear how to define it. e.g. what if some other element's offsetLeft was queried - does that require layout on element or not?

<details>
<summary>Since unless I'm missing something, whether offsetLeft causes layout is already webexposed e.g. with transitions</summary>

```js
element.style.transition = "width 1s";
element.style.width = "100px";
element.style.width = "200px";
element.clientWidth; // 200 (if we started with width:auto)
```
```js
element.style.transition = "width 1s";
element.style.width = "100px";
element.offsetLeft;
element.style.width = "200px";
element.clientWidth; // 100
```

</details>

Agenda+ to discuss removing the last remembered size without waiting for ResizeObserver when laying out without c-i-s:auto.

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


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

Received on Friday, 12 August 2022 01:01:41 UTC