[line-clamp] Change the computed value of display: -webkit-box
when used with line-clamp
The legacy -webkit-line-clamp
CSS property requires the properties
display: -webkit-box
(or -webkit-inline-box
) and
-webkit-box-orient: vertical
to work. These keywords of the
display
property are legacy versions of flex
(and inline-flex
),
but in modern implementations of -webkit-line-clamp
(including the
LayoutNG one) they instead create a BFC when all three properties are
present.
In Chromium's implementation this was done by creating a
LayoutBlockFlow
rather than a LayoutFlexibleBox
when creating a
layout object for the element. However, Gecko instead set the computed
value of display
to flow-root
(or inline-block
). In
w3c/csswg-drafts#10435 the CSSWG resolved to
go with Gecko's behavior on this. This patch implements this computed
style adjustment.
For web compatibility, it must still be the case that
-webkit-line-clamp
will not do anything if the specified value of
display
is not -webkit-box
(or -webkit-inline-box
). Therefore,
this patch needs to add a computed style extra field
IsSpecifiedDisplayWebkitBox
to track this state.
This behavior is implemented behind an enabled-by-default runtime flag
so it can be easily rolled back if web compatibility issues are found.
Bug: 40336192, 346759535, 362756798
Change-Id: Id5737af8d01f8cd450a379cbd088951a2a14058b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5836688
Reviewed-by: Ian Kilpatrick ikilpatrick@chromium.org
Commit-Queue: Andreu Botella abotella@igalia.com
Cr-Commit-Position: refs/heads/main@{#1351678}