layout: Ensure empty list items are at least as tall as outside markers (#32152)

While <https://drafts.csswg.org/css-lists/#list-style-position-property> says:

> The size or contents of the marker box may affect the height of the
> principal block box and/or the height of its first line box, and in some
> cases may cause the creation of a new line box; this interaction is also
> not defined.

All other browsers ensure that the first line of list item content is
the same block size as the marker. Doing this is complicated, but we can
ensure that the entire list item is at least as tall as the marker. This
should handle the majority of cases and we can make refinements later
for stranger situations, such as when the marker is very tall.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2024-04-29 18:58:14 +02:00 committed by GitHub
parent adcaf2e881
commit f68a2e7743
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 93 additions and 30 deletions

View file

@ -790,17 +790,17 @@ where
&PseudoElement::ServoLegacyText, // FIMXE: use `PseudoElement::Marker` when we add it
&info.style,
);
let info = info.new_replacing_style(marker_style.clone());
let contents = NonReplacedContents::OfPseudoElement(contents);
let block_container = BlockContainer::construct(
context,
&info,
&info.new_replacing_style(marker_style.clone()),
contents,
TextDecorationLine::empty(),
false, /* is_list_item */
);
ArcRefCell::new(BlockLevelBox::OutsideMarker(OutsideMarker {
style: marker_style,
marker_style,
list_item_style: info.style.clone(),
block_container,
}))
},