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:
Emilio Cobos Álvarez 2022-09-20 19:30:45 +00:00 committed by Martin Robinson
parent 99d588a90e
commit 8a63d9e059
3 changed files with 6 additions and 9 deletions

View file

@ -1128,13 +1128,12 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
SCALE_FACTOR_WHEN_INCREMENTING_MATH_DEPTH_BY_ONE {
(parent_font.mScriptSizeMultiplier as f32).powi(delta as i32)
} else {
builder.add_flags(ComputedValueFlags::DEPENDS_ON_SELF_FONT_METRICS);
// Script scale factors are independent of orientation.
let font_metrics = self.context
.font_metrics_provider
.query(self.context, FontBaseSize::InheritedStyle,
FontMetricsOrientation::Horizontal,
true /* retrieve_math_scales */);
let font_metrics = self.context.query_font_metrics(
FontBaseSize::InheritedStyle,
FontMetricsOrientation::Horizontal,
/* retrieve_math_scales = */ true,
);
scale_factor_for_math_depth_change(
parent_font.mMathDepth as i32,
font.mMathDepth as i32,