style: Add some style quirks for legacy ::markers created from list-style-type/list-style-image

Specifically:
For "bullets", i.e. 'list-style-type:disc|circle|square|
disclosure-closed|disclosure-open', we use a built-in font
(-moz-bullet-font, which has glyphs for those symbols + space) to
retain mostly backwards compatible rendering for those.  Authors may
override that with an explicit 'font-family' ::marker style though.
We also use this font for 'list-style-image' in case it would
fallback to one of the above when the image fails to load (so that
we get the same width space).

When the -moz-bullet-font is used we also set 'font-synthesis' to
avoid synthesizing italic/bold for this font. Authors may override
this with an explicit ::marker declaration.

We also set 'letter-spacing' and 'word-spacing' to the initial value
for bullets for web-compat reasons.  Again, authors may override
this with an explicit ::marker declaration. (This breaks backwards-
compat slightly but makes us compatible with Chrome.  We used to
ignore these for list-style-type:<string> too.)

Differential Revision: https://phabricator.services.mozilla.com/D111693
This commit is contained in:
Mats Palmgren 2023-05-21 23:39:34 +02:00 committed by Oriol Brufau
parent d2a7ebf789
commit d7e00ba03d
7 changed files with 128 additions and 1 deletions

View file

@ -786,6 +786,34 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_PADDING);
}
if self
.author_specified
.contains(LonghandId::FontFamily)
{
builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_FONT_FAMILY);
}
if self
.author_specified
.contains(LonghandId::LetterSpacing)
{
builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_LETTER_SPACING);
}
if self
.author_specified
.contains(LonghandId::WordSpacing)
{
builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_WORD_SPACING);
}
if self
.author_specified
.contains(LonghandId::FontSynthesis)
{
builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_FONT_SYNTHESIS);
}
#[cfg(feature = "servo")]
{
if let Some(font) = builder.get_font_if_mutated() {