mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
Bug 1442195: Don't crash when finding an unexpected default font type. r=xidorn
For now just return sans-serif, though as the FIXME comment indicates we should probably just carry around the font-name instead. MozReview-Commit-ID: CIPbV3R5Ul --HG-- extra : rebase_source : ce8666e747341d203d655e937501806c1646331b
This commit is contained in:
parent
40eb570f1d
commit
add7370903
@ -2326,14 +2326,25 @@ fn static_assert() {
|
||||
let shared_fontlist = unsafe { fontlist.mFontlist.mBasePtr.to_safe() };
|
||||
|
||||
if shared_fontlist.mNames.is_empty() {
|
||||
let default = match fontlist.mDefaultFontType {
|
||||
let default = fontlist.mDefaultFontType;
|
||||
let default = match default {
|
||||
FontFamilyType::eFamily_serif => {
|
||||
SingleFontFamily::Generic(atom!("serif"))
|
||||
}
|
||||
FontFamilyType::eFamily_sans_serif => {
|
||||
_ => {
|
||||
// This can break with some combinations of user prefs, see
|
||||
// bug 1442195 for example. It doesn't really matter in this
|
||||
// case...
|
||||
//
|
||||
// FIXME(emilio): Probably should be storing the whole
|
||||
// default font name instead though.
|
||||
debug_assert_eq!(
|
||||
default,
|
||||
FontFamilyType::eFamily_sans_serif,
|
||||
"Default generic should be serif or sans-serif"
|
||||
);
|
||||
SingleFontFamily::Generic(atom!("sans-serif"))
|
||||
}
|
||||
_ => panic!("Default generic must be serif or sans-serif"),
|
||||
};
|
||||
FontFamily(FontFamilyList::new(Box::new([default])))
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user