style: Don't call PrefillDefaultForGeneric when inheriting font-family.

This is the low-risk fix for this issue, that we should get into 67.

What's going on here is that font-family is tracked via the font list, from the
POV of the style system the font list is generally just the
RefPtr<SharedFontList>, but in Gecko there's also mDefaultGenericId.

The way we end up with the right mDefaultGenericId is fishy at best, bogus at
worst. I left various fixmes over time related to a bunch of this code.

After my patch, we end up with a mDefaultGenericId of serif, rather than the
right one (none).

The parent font always has none because nsLayoutUtils::ComputeSystemFont always
sets it to none if the font is known.

Before my patch, PrefillDefaultForGeneric with aGenericId of none (from the
parent), which makes it the default generic id for the current language, serif
in this case.

Before my optimization, apply_declaration_ignoring_phase called
copy_font_family_from, which resets both the font list _and_ the default
generic.

This patch achieves the same effect by not having the first mutation in the
first place.

This code is still terribly fishy in any case, all the _skip_font_family stuff
is just ridiculous. I'll try to clean up a bit after this, but for 68.

Differential Revision: https://phabricator.services.mozilla.com/D23026
This commit is contained in:
Emilio Cobos Álvarez 2019-03-12 00:48:27 +00:00
parent 9f4643ac24
commit 77a75596bb

View file

@ -744,7 +744,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
// separately, so this boils down to just copying over the
// font-family lists (no other aspect of the default font can be
// configured).
if self.seen.contains(LonghandId::XLang) || self.seen.contains(LonghandId::FontFamily) {
if self.seen.contains(LonghandId::XLang) || font_family.is_some() {
// If just the language changed, the inherited generic is all we
// need.
let mut generic = self.context.builder.get_parent_font().gecko().mGenericID;