Auto merge of #18052 - Manishearth:fixup_generic, r=heycam

stylo: Don't call fixup_generic_font for system or CSS wide specified fonts

r=heycam https://bugzilla.mozilla.org/show_bug.cgi?id=1383869

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18052)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-11 17:51:36 -05:00 committed by GitHub
commit c3bbe9284c
2 changed files with 14 additions and 1 deletions

View file

@ -2165,11 +2165,17 @@ fn static_assert() {
}
pub fn fixup_none_generic(&mut self, device: &Device) {
self.gecko.mFont.systemFont = false;
unsafe {
bindings::Gecko_nsStyleFont_FixupNoneGeneric(&mut self.gecko, device.pres_context())
}
}
pub fn fixup_system(&mut self) {
self.gecko.mFont.systemFont = true;
self.gecko.mGenericID = structs::kGenericFont_NONE;
}
pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) {
use properties::longhands::font_family::computed_value::{FontFamily, FamilyNameSyntax};
@ -2206,6 +2212,7 @@ fn static_assert() {
pub fn copy_font_family_from(&mut self, other: &Self) {
unsafe { Gecko_CopyFontFamilyFrom(&mut self.gecko.mFont, &other.gecko.mFont); }
self.gecko.mGenericID = other.gecko.mGenericID;
self.gecko.mFont.systemFont = other.gecko.mFont.systemFont;
}
pub fn reset_font_family(&mut self, other: &Self) {

View file

@ -3297,7 +3297,13 @@ where
&mut cascade_info);
% if product == "gecko":
let device = context.builder.device;
context.builder.mutate_font().fixup_none_generic(device);
if let PropertyDeclaration::FontFamily(ref val) = **declaration {
if val.get_system().is_some() {
context.builder.mutate_font().fixup_system();
} else {
context.builder.mutate_font().fixup_none_generic(device);
}
}
% endif
}
}