Open emilio opened 3 years ago
An interesting question, if we decide that clip
and visible
should behave differently, is what happens if only one of the axes is clipped.
I somewhat expected blink's behaviour (and have a mild preference for it) as I sort of view clip
as a better hidden
, but either way is fine.
what happens if only one of the axes is clipped
Seems a good argument for treating clip
like visible
.
Yeah, since only one axis can be clipped, this really should continue to be treated like visible
, not like hidden
. Diverging from that principle will only cause us confusion in the future, I think.
And yes, older text saying "overflow other than visible" just needs to be fixed up, it should always mean "scroll container" in modern parlance.
I agree, overflow-inline : clip
should not affect the baseline, so that disqualifies the "behave as hidden
" option as described above IMO. However, I don't see a reason why we can't synthesize a baseline for overflow-block : clip
(which would behave roughly as hidden
in that axis).
It's also worth considering what happens when the baseline is well within the size, e.g. emilio's test with height:100px
instead. I'd slightly prefer the visible
behavior over a synthesized baseline in this case, but I don't feel strongly about it.
There's also a third option: "clamp the baseline", which would calculate the baseline normally (as for visible
) but clamp it to the clip area. That would make emilio's test behave (roughly*) as hidden
but the height:100px
case would still behave as visible
. (I dunno how complicated that would be to implement though, so I'm not sure if it's worth it.)
(*) the clip area is typically the padding box, whereas the hidden
baseline is calculated from the border box
So I see three viable options:
visible
(what Firefox currently implements)overflow-block : clip
Thanks @MatsPalmgren for the list of options. I'll reference it for brevity.
In PDFreactor we have implemented a variation of 3: For clip
we clamp the visible
baseline to the synthesized baseline. So you always have either 1 or 2 (visible
or hidden
behavior) in the end.
We considered the clip area as clamp value, but concluded that the hidden
behavior would be more expected than adding a new area affecting alignment.
Maybe you can add this option for discussion as 4 or 3b.
The CSS Working Group just discussed css-overflow] [css2?] Baseline of an inline-block with overflow:clip.
, and agreed to the following:
RESOLVED: Specify option 1; match FF current behavior
We can change the behavior of PDFreactor accordingly. Clamping was not required, just what we came up with internally.
Could the spec be updated based on this resolution?
It's worth noting that the relevant level 3 spec here is css-align-3, which both (a) has this issue fixed already and (b) makes a separate incompatible change regarding clamping the baseline to the border edge rather than always using the margin edge:
For the purposes of finding the baselines of a box, it and all its in-flow descendants with a scrolling mechanism (see the overflow property) must be considered as if scrolled to their initial scroll position. Furthermore, if, in the case of a scroll container box, the resulting position of a first/last baseline is past a box’s end/start border edge, its position is clamped to that border edge.
Blink and Gecko differ on what baseline should an element with
display: inline-block
andoverflow: clip
.Example (live):
@bfgeek pointed out that CSS2.1 has:
However CSS2 was written before
overflow: clip
was a thing. I intuitively expectoverflow: clip
to behave likeoverflow: visible
here (because it's not an scrollable box), but I could see the argument the other way around. Thoughts?