Skip to content

[css-overflow-3][css-sizing-3] Define contribution of scrollbars to min-content/max-content sizes #3348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fantasai opened this issue Nov 27, 2018 · 7 comments

Comments

@fantasai
Copy link
Collaborator

@cbiesinger noticed that we don't seem to spec whether/how scrollbars contribute to the intrinsic size contributions. Firefox, for example, includes the scrollbar width when 'scroll' but not 'auto'; Blink includes the scrollbar whenever present. See testcase.

@fantasai fantasai added the css-overflow-3 Current Work label Nov 27, 2018
@frivoal
Copy link
Collaborator

frivoal commented Dec 4, 2018

I feel like this should depend on https://drafts.csswg.org/css-overflow-4/#scollbar-gutter-property : when there is a scrollbar gutter as defined there, then it should affect intrinsic sizing, and if not, not (and for level 3, since we don't have that property yet, it would boil down to what the initial value of that property does in various cases).

@frivoal
Copy link
Collaborator

frivoal commented Jun 7, 2021

Is this the right way to ask the question though? Spec quote from the part that defines Intrinsic contributions:

A box’s min-content contribution/max-content contribution in each axis is the size of the content box of a hypothetical auto-sized float that contains only that box

That's about the content box, so to me, it's pretty clear that they should not include the scrollbar size, as that's not in the content area. However, when you calculate the outer size, starting from the content size, you should add the padding, scrollbar gutter, border and margin, and if you skip adding the scrollbar gutter, you get weird results.

@frivoal
Copy link
Collaborator

frivoal commented Jun 7, 2021

So I think that what we need is a clarification in css-sizing-3 and/or css-box-4 (probably the later) that the border edge goes around not just the content+padding+border area, but also includes the gutter area, that the margin/outer edge builds from there, and that when you're computing the sizes of these things, you have to take account for the size of the gutter.

@frivoal
Copy link
Collaborator

frivoal commented Jun 7, 2021

css-overflow has this:

Any space taken up by the scrollbars should be taken out of (subtracted from the dimensions of) the containing block formed by the element with the scrollbars.

which is probably a bit too casual in its phrasing. If we're doing available width sizing, then yes, we start with the dimension of the containing block, and substract the m/b/p and the size of the gutter, but otherwise, when we're sizing from the content box outwards, then the size of the scrollbar gutter needs to be added to the the inner size, along with m/b/p, to get to the outer size.

@fantasai
Copy link
Collaborator Author

@frivoal The sentence you quote in #3348 you're not reading carefully enough, it's the size of the content box of the float which contains the box, not the content box of the box itself...

@frivoal
Copy link
Collaborator

frivoal commented Jul 20, 2021

When the box is sized to fit its contents,
this reserved space is added to the size of its contents.
It is otherwise subtracted from space alotted to the [=content area=].

"When the box is sized to fit its contents" is that equivalent to all forms of intrinsic sizing, or only fit-content()? It reads as if it is the latter, but I think it should be the former.

@fantasai
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants