W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [css-overflow] CSSOM scrollWidth/scrollHeight behaviour of "overflow: clip". (#5572)

From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
Date: Fri, 23 Oct 2020 16:35:21 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-715448943-1603470920-sysbot+gh@w3.org>
The CSS Working Group just discussed `CSSOM scrollWidth/scrollHeight behaviour of “overflow: clip”`, and agreed to the following:

* `RESOLVED: scrollWidth/scrollHeight ignore overflow:clip when computing the value`

<details><summary>The full IRC log of that discussion</summary>
&lt;Rossen_> Topic:  CSSOM scrollWidth/scrollHeight behaviour of “overflow: clip”<br>
&lt;Rossen_> github: https://github.com/w3c/csswg-drafts/issues/5572<br>
&lt;fremy> Rossen_: iank_ raised this and emilo last added to the agenda<br>
&lt;fremy> Rossen_: who want to bring us up to speed?<br>
&lt;fremy> emilio: me<br>
&lt;fremy> emilio: we considered what scrollWidth/Height should return when overflow-clip is set<br>
&lt;fremy> emilio: there is not scrollbar<br>
&lt;fremy> emilio: but there is content out there<br>
&lt;fremy> emilio: the question is should we return the size as if there was scrollbar<br>
&lt;TabAtkins> +1 to behaving the same as visible, at least from first thoughts<br>
&lt;fremy> emilio: I think acting as visible is easier<br>
&lt;fremy> emilio: but iank_ said there is an optimization<br>
&lt;fremy> iank_: if you have overflow:hidden can be scrolled<br>
&lt;fremy> iank_: for visible, it still makes sense to return the full value, because it will cause scrollbars on ancestors<br>
&lt;TabAtkins> Hm, okay, Ian's making sense<br>
&lt;fremy> iank_: when you clip though, it's not useful, because it really does not exist<br>
&lt;fremy> iank_: but if you don't do that, you can return early<br>
&lt;fremy> iank_: because you don't need to calculate the scrollable overflow for the element when the value is fetched<br>
&lt;fremy> iank_: but it's not super important and only works if clip is in both directions<br>
&lt;fremy> smfr: the other option was what?<br>
&lt;fremy> iank_: report as if you had no children<br>
&lt;fremy> iank_: if the size is definite and you clip overflow, you don't need to layout the children<br>
&lt;fremy> iank_: but it's a small case<br>
&lt;fremy> smfr: and offsetWidth/offsetHeight?<br>
&lt;fremy> iank_: yes, this is the same as what I had in mind<br>
&lt;fremy> smfr: oh, in that case, yes, I prefer that option slightly<br>
&lt;fremy> Rossen_: other opinion?<br>
&lt;fremy> iank_: if I had to choose I would probably try to keep things consistent, but I really don't mind<br>
&lt;fremy> iank_: we just need to do something<br>
&lt;fremy> Rossen_: ok, let's get a summary of the two options and resolve<br>
&lt;fremy> iank_: option 1 is to do what we do when overflow:visible is applied (you need to layout the children to report that width)<br>
&lt;fremy> iank_: option 2: (ignoring overflow-clip-margin) report the size of the element ignoring whether or not you have something that will be clipped<br>
&lt;fremy> iank_: but if you have a clip margin, you need to do the full computation to see where inside that margin you land<br>
&lt;fremy> Rossen_: (restates the two proposals)<br>
&lt;fremy> fantasai: scrollWidth scrollHeight are asked on an element which is not scrollable<br>
&lt;fremy> fantasai: does that mean they are defined on all elements<br>
&lt;fremy> emilio: yes<br>
&lt;fremy> fantasai: ok, then, if we have a clipping, what happens if you have a border?<br>
&lt;fremy> iank_: they return content-box sizes, so it's a bit complicated<br>
&lt;fremy> fantasai: padding box you mean?<br>
&lt;fremy> iank_: yes, padding box size<br>
&lt;fremy> iank_: if you have no children, this is clientWidth/clientHeight, which is the padding box<br>
&lt;fremy> iank_: if you have a child, it returns whichever is bigger (the padding box or that child)<br>
&lt;fremy> iank_: so if you set overflow-clip with no margin, you can return the padding box because the child will not overextend<br>
&lt;fremy> iank_: but this only works if you dont have a margin<br>
&lt;fremy> iank_: if you have a margin, there could be an overflow<br>
&lt;fremy> iank_: so you need to do the full computation<br>
&lt;fremy> fantasai: the advantage of the doing like visible is that you get the value that tells you "how big should it be not to overflow"<br>
&lt;fremy> fantasai: the advantage of taking the clip into account, is that you know how much you will ask the parent scroller<br>
&lt;fremy> iank_: with proposal 2 you can't get answer 1<br>
&lt;fremy> iank_: but with proposal 1 you can compute the difference yourself<br>
&lt;fremy> Rossen_: this seems more clear now<br>
&lt;fremy> Rossen_: for "what you see is what you get" option 2 is nicer<br>
&lt;fremy> Rossen_: I don't want to do a straw poll, let's try to resolve<br>
&lt;fremy> Rossen_: can we resolve on option 2 which takes into account the visual clipping?<br>
&lt;Rossen_> q<br>
&lt;fremy> emilio: I lean towards option 1<br>
&lt;fremy> emilio: because I don't see strong arguments<br>
&lt;fremy> emilio: and for testing purposes, we can copy all the tests<br>
&lt;fremy> emilio: and we have shipped like that<br>
&lt;fremy> emilio: but this is not a super strong argument<br>
&lt;fremy> emilio: but given option 2 removes your ability to get the value of option 1<br>
&lt;fremy> emilio: I would rather we did 1<br>
&lt;fremy> Rossen_: if you want to get the bounds for the clip, what do you do?<br>
&lt;fremy> iank_: in script, you get the style of the clipping, then you do Math.min<br>
&lt;fremy> iank_: between scrollWidth and offsetWidth + the clip margin<br>
&lt;fremy> Rossen_: authors might not think about it<br>
&lt;fremy> Rossen_: and very often it's more useful to consider what is visible<br>
&lt;fremy> emilio: I don't disagree it's useful<br>
&lt;fremy> emilio: but scrollWidth is not the right API for that<br>
&lt;fremy> emilio: it's weird and legacy, so I would rather not change it<br>
&lt;fremy> Rossen_: ok let's do a poll<br>
&lt;fantasai> Given the arguments in favor of emilio's position, and the fact that you can get answers to the second question fairly easily with the first option but not the other way around, I'd be in favor of emilio's position<br>
&lt;fremy> Rossen_: because it's pretty split<br>
&lt;fremy> smfr: if we have scrollWidth behave like overflow:visible<br>
&lt;fremy> smfr: then you can't get the data and know if you can flip to visible without overflow<br>
&lt;fremy> fantasai: yes, option 2 hides info from authors you can't get otherwise<br>
&lt;fremy> fantasai: it's not great<br>
&lt;fremy> Rossen_: ok, then le'ts resolve for option 1<br>
&lt;fremy> RESOLVED: scrollWidth/scrollHeight ignore overflow:clip when computing the value<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5572#issuecomment-715448943 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 23 October 2020 16:35:23 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:21 UTC