stylo: Bypass cache when fetching font size prefs from Stylo

This commit is contained in:
Manish Goregaokar 2017-04-04 11:11:27 -07:00 committed by Manish Goregaokar
parent 6020c2feeb
commit 2ea8d61fbf
6 changed files with 142 additions and 8 deletions

View file

@ -536,7 +536,8 @@ ${helpers.single_keyword("font-variant-caps",
type ComputedValue = Au;
#[inline]
fn to_computed_value(&self, cx: &Context) -> computed_value::T {
use gecko_bindings::bindings::Gecko_nsStyleFont_GetBaseSize;
use gecko_bindings::bindings::Gecko_GetBaseSize;
use gecko_bindings::structs;
use values::specified::length::au_to_int_px;
// Data from nsRuleNode.cpp in Gecko
// Mapping from base size and HTML size to pixels
@ -561,10 +562,18 @@ ${helpers.single_keyword("font-variant-caps",
// XXXManishearth handle quirks mode
let base_size = unsafe {
Gecko_nsStyleFont_GetBaseSize(cx.style().get_font().gecko(),
&*cx.device.pres_context)
let base_sizes = unsafe {
Gecko_GetBaseSize(cx.style().get_font().gecko().mLanguage.raw())
};
let base_size = match cx.style().get_font().gecko().mGenericID {
structs::kGenericFont_serif => base_sizes.mDefaultSerifSize,
structs::kGenericFont_sans_serif => base_sizes.mDefaultSansSerifSize,
structs::kGenericFont_monospace => base_sizes.mDefaultMonospaceSize,
structs::kGenericFont_cursive => base_sizes.mDefaultCursiveSize,
structs::kGenericFont_fantasy => base_sizes.mDefaultFantasySize,
x => unreachable!("Unknown generic ID {}", x),
};
let base_size_px = au_to_int_px(base_size as f32);
let html_size = *self as usize;
if base_size_px >= 9 && base_size_px <= 16 {

View file

@ -2109,6 +2109,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
| LonghandId::TextOrientation
| LonghandId::AnimationName
| LonghandId::TransitionProperty
| LonghandId::XLang
% endif
);
if