New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 860820 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Blink is inconsistent on whether "overflow:scroll; display: inline-*" can determine baseline from its contents

Project Member Reported by dholb...@gmail.com, Jul 6

Issue description

Chrome Version: 69.0.3472.3 (Official Build) dev (64-bit)
OS: Ubuntu 18.04

What steps will reproduce the problem?
(1) Visit https://jsfiddle.net/06wxgroy/

What is the expected result?
Consistent baseline-alignment between the 3 cases there.

What happens instead?
For the first case (inline-block), Chrome aligns "abc" with the bottom of the scrollable box's border.

For the second and third case (inline-flex & inline-grid), Chrome aligns "abc" with the first line of text inside the scrollable box.

I'm not aware of any spec support for treating inline-flex and inline-grid differently from inline-block here.

For reference: Edge agrees with Chrome, while Firefox treats all three boxes the same (using the bottom of the scrollable box's border).  We (Mozilla) received a bug report about this ( https://bugzilla.mozilla.org/show_bug.cgi?id=1471942 ) but I think the Firefox behavior seems most coherent, hence filing this bug.
 
(WebKit kind of agrees with Chrome/Edge, though they have a weird extra quirk - they're not even internally consistent for "inline-block", and they do different stuff depending on whether or not a scrollbar is needed. I filed https://bugs.webkit.org/show_bug.cgi?id=187413 on that.)
(Anyway, setting that WebKit quirk aside, I filed https://bugs.webkit.org/show_bug.cgi?id=187416 on this same issue in WebKit.)
Cc: kojii@chromium.org
Owner: cbiesin...@chromium.org
Status: Assigned (was: Untriaged)
Cc: jfernandez@chromium.org r...@chromium.org svillar@chromium.org
Why the scrollbar should imply the grid/flex container should synthesize its baseline ? As far as I know, at least for the grid case, the Grid Layout spec about how to compute the baseline of a grid container should be applied: 

https://drafts.csswg.org/css-grid/#grid-baselines
> Why the scrollbar should imply the grid/flex container should synthesize its baseline?

For the same reason it implies it for a block, I guess?  (I'm not sure what that reason is, but that seems to be the interoperable consensus and longstanding behavior. I'm guessing there's spec text to back it up but I don't happen to know what it is at the moment.)

Intuitively, it makes sense to me that the baseline behavior should change when something becomes scrollable, because the (scrolled) position of the first-line-text can change (or may start out at something nonzero) -- so there's less of a compelling reason to use that text for baseline alignment.
Looks like the spec text for display:inline-block;overflow:scroll is:
====
The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes or if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge.
====
https://www.w3.org/TR/CSS22/visudet.html#normal-block

I guess that is pretty specific to inline-block, and I just found this in the flexbox spec (and grid has a similar chunk):
====
When calculating the baseline according to the above rules, if the box contributing a baseline has an overflow value that allows scrolling, the box must be treated as being in its initial scroll position for the purpose of determining its baseline.
====
https://drafts.csswg.org/css-flexbox-1/#flex-baselines

So, I guess this is "invalid" and the specs *require* this inconsistency between inline-block vs. inline-flex/grid here (weird).
...oh, though actually, the flex/grid text here seems to be about *child boxes* ("the box contributing a baseline") -- it's not about the flex/grid container itself (and doesn't say anything about what happens when the container has overflow set to something non-"visible", RE baselines).

So I'm back to thinking this isn't really defined in the specs, beyond the requirements from CSS2 about inline-block, which I'd think would implicitly apply to other inline-* containers in the absence of specific contradictory text.
I filed https://github.com/w3c/csswg-drafts/issues/2902 to clarify this in the spec.

Sign in to add a comment