mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Simplify our setup for font metric queries from style
While looking at moving the flag around I realized that the only reason we have FontMetricsProvider and co is because we didn't have access to the per-document font-prefs cache. That's trivial to fix tho, so do that and simplify the setup for font queries even more. Differential Revision: https://phabricator.services.mozilla.com/D157589
This commit is contained in:
parent
99d588a90e
commit
8a63d9e059
3 changed files with 6 additions and 9 deletions
|
@ -1128,13 +1128,12 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
||||||
SCALE_FACTOR_WHEN_INCREMENTING_MATH_DEPTH_BY_ONE {
|
SCALE_FACTOR_WHEN_INCREMENTING_MATH_DEPTH_BY_ONE {
|
||||||
(parent_font.mScriptSizeMultiplier as f32).powi(delta as i32)
|
(parent_font.mScriptSizeMultiplier as f32).powi(delta as i32)
|
||||||
} else {
|
} else {
|
||||||
builder.add_flags(ComputedValueFlags::DEPENDS_ON_SELF_FONT_METRICS);
|
|
||||||
// Script scale factors are independent of orientation.
|
// Script scale factors are independent of orientation.
|
||||||
let font_metrics = self.context
|
let font_metrics = self.context.query_font_metrics(
|
||||||
.font_metrics_provider
|
FontBaseSize::InheritedStyle,
|
||||||
.query(self.context, FontBaseSize::InheritedStyle,
|
FontMetricsOrientation::Horizontal,
|
||||||
FontMetricsOrientation::Horizontal,
|
/* retrieve_math_scales = */ true,
|
||||||
true /* retrieve_math_scales */);
|
);
|
||||||
scale_factor_for_math_depth_change(
|
scale_factor_for_math_depth_change(
|
||||||
parent_font.mMathDepth as i32,
|
parent_font.mMathDepth as i32,
|
||||||
font.mMathDepth as i32,
|
font.mMathDepth as i32,
|
||||||
|
|
|
@ -195,7 +195,6 @@ impl<'a> Context<'a> {
|
||||||
F: FnOnce(&Context) -> R,
|
F: FnOnce(&Context) -> R,
|
||||||
{
|
{
|
||||||
let mut conditions = RuleCacheConditions::default();
|
let mut conditions = RuleCacheConditions::default();
|
||||||
|
|
||||||
let context = Context {
|
let context = Context {
|
||||||
builder: StyleBuilder::for_inheritance(device, None, None),
|
builder: StyleBuilder::for_inheritance(device, None, None),
|
||||||
cached_system_font: None,
|
cached_system_font: None,
|
||||||
|
@ -206,7 +205,6 @@ impl<'a> Context<'a> {
|
||||||
for_non_inherited_property: None,
|
for_non_inherited_property: None,
|
||||||
rule_cache_conditions: RefCell::new(&mut conditions),
|
rule_cache_conditions: RefCell::new(&mut conditions),
|
||||||
};
|
};
|
||||||
|
|
||||||
f(&context)
|
f(&context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::parser::{Parse, ParserContext};
|
||||||
use crate::values::computed::font::{FamilyName, FontFamilyList, SingleFontFamily};
|
use crate::values::computed::font::{FamilyName, FontFamilyList, SingleFontFamily};
|
||||||
use crate::values::computed::FontSizeAdjust as ComputedFontSizeAdjust;
|
use crate::values::computed::FontSizeAdjust as ComputedFontSizeAdjust;
|
||||||
use crate::values::computed::{font as computed, Length, NonNegativeLength};
|
use crate::values::computed::{font as computed, Length, NonNegativeLength};
|
||||||
use crate::values::computed::{Percentage as ComputedPercentage};
|
use crate::values::computed::Percentage as ComputedPercentage;
|
||||||
use crate::values::computed::{CSSPixelLength, Context, ToComputedValue};
|
use crate::values::computed::{CSSPixelLength, Context, ToComputedValue};
|
||||||
use crate::values::generics::font::VariationValue;
|
use crate::values::generics::font::VariationValue;
|
||||||
use crate::values::generics::font::{
|
use crate::values::generics::font::{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue