mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Handle fallback to default variable font in case of nonexistant generic
This commit is contained in:
parent
7fc01437f4
commit
03e9264ea0
3 changed files with 19 additions and 0 deletions
|
@ -1173,6 +1173,11 @@ extern "C" {
|
||||||
pub fn Gecko_nsStyleFont_CopyLangFrom(aFont: *mut nsStyleFont,
|
pub fn Gecko_nsStyleFont_CopyLangFrom(aFont: *mut nsStyleFont,
|
||||||
aSource: *const nsStyleFont);
|
aSource: *const nsStyleFont);
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn Gecko_nsStyleFont_FixupNoneGeneric(font: *mut nsStyleFont,
|
||||||
|
pres_context:
|
||||||
|
RawGeckoPresContextBorrowed);
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_GetBaseSize(lang: *mut nsIAtom) -> FontSizePrefs;
|
pub fn Gecko_GetBaseSize(lang: *mut nsIAtom) -> FontSizePrefs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ use gecko::values::convert_rgba_to_nscolor;
|
||||||
use gecko::values::GeckoStyleCoordConvertible;
|
use gecko::values::GeckoStyleCoordConvertible;
|
||||||
use gecko::values::round_border_to_device_pixels;
|
use gecko::values::round_border_to_device_pixels;
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
|
use media_queries::Device;
|
||||||
use properties::animated_properties::TransitionProperty;
|
use properties::animated_properties::TransitionProperty;
|
||||||
use properties::longhands;
|
use properties::longhands;
|
||||||
use properties::{Importance, LonghandId};
|
use properties::{Importance, LonghandId};
|
||||||
|
@ -1374,6 +1375,12 @@ fn static_assert() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn fixup_none_generic(&mut self, device: &Device) {
|
||||||
|
unsafe {
|
||||||
|
bindings::Gecko_nsStyleFont_FixupNoneGeneric(&mut self.gecko, &*device.pres_context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) {
|
pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) {
|
||||||
use properties::longhands::font_family::computed_value::FontFamily;
|
use properties::longhands::font_family::computed_value::FontFamily;
|
||||||
use gecko_bindings::structs::FontFamilyType;
|
use gecko_bindings::structs::FontFamilyType;
|
||||||
|
@ -1381,6 +1388,8 @@ fn static_assert() {
|
||||||
let list = &mut self.gecko.mFont.fontlist;
|
let list = &mut self.gecko.mFont.fontlist;
|
||||||
unsafe { Gecko_FontFamilyList_Clear(list); }
|
unsafe { Gecko_FontFamilyList_Clear(list); }
|
||||||
|
|
||||||
|
self.gecko.mGenericID = structs::kGenericFont_NONE;
|
||||||
|
|
||||||
for family in &v.0 {
|
for family in &v.0 {
|
||||||
match *family {
|
match *family {
|
||||||
FontFamily::FamilyName(ref f) => {
|
FontFamily::FamilyName(ref f) => {
|
||||||
|
@ -1428,6 +1437,7 @@ fn static_assert() {
|
||||||
|
|
||||||
pub fn copy_font_family_from(&mut self, other: &Self) {
|
pub fn copy_font_family_from(&mut self, other: &Self) {
|
||||||
unsafe { Gecko_CopyFontFamilyFrom(&mut self.gecko.mFont, &other.gecko.mFont); }
|
unsafe { Gecko_CopyFontFamilyFrom(&mut self.gecko.mFont, &other.gecko.mFont); }
|
||||||
|
self.gecko.mGenericID = other.gecko.mGenericID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(bholley): Gecko has two different sizes, one of which (mSize) is the
|
// FIXME(bholley): Gecko has two different sizes, one of which (mSize) is the
|
||||||
|
|
|
@ -2609,7 +2609,11 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
||||||
&mut cacheable,
|
&mut cacheable,
|
||||||
&mut cascade_info,
|
&mut cascade_info,
|
||||||
error_reporter);
|
error_reporter);
|
||||||
|
% if product == "gecko":
|
||||||
|
context.style.mutate_font().fixup_none_generic(context.device);
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(declaration) = font_size {
|
if let Some(declaration) = font_size {
|
||||||
let discriminant = LonghandId::FontSize as usize;
|
let discriminant = LonghandId::FontSize as usize;
|
||||||
(CASCADE_PROPERTY[discriminant])(declaration,
|
(CASCADE_PROPERTY[discriminant])(declaration,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue