Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-11-01 00:45:38 +01:00 committed by Martin Robinson
parent 18b9e1b615
commit 7ce706f891
7 changed files with 13 additions and 9 deletions

View file

@ -488,7 +488,7 @@ impl<'a> CanvasData<'a> {
.state
.font_style
.as_ref()
.map_or(10., |style| style.font_size.size().px());
.map_or(10., |style| style.font_size.computed_size().px());
let font_style = self.state.font_style.as_ref();
let font = font_style.map_or_else(
|| load_system_font_from_style(None),

View file

@ -137,7 +137,7 @@ impl<'a> From<&'a FontStyleStruct> for FontDescriptor {
FontDescriptor {
template_descriptor: FontTemplateDescriptor::from(style),
variant: style.font_variant_caps,
pt_size: Au::from_f32_px(style.font_size.size().px()),
pt_size: Au::from_f32_px(style.font_size.computed_size().px()),
}
}
}

View file

@ -95,7 +95,7 @@ impl<S: FontSource> FontContext<S> {
self.expire_font_caches_if_necessary();
let cache_key = FontGroupCacheKey {
size: Au::from_f32_px(style.font_size.size().px()),
size: Au::from_f32_px(style.font_size.computed_size().px()),
style,
};

View file

@ -111,9 +111,13 @@ impl Flow for MulticolFlow {
NonNegativeLengthPercentageOrNormal::LengthPercentage(ref len) => {
len.0.to_pixel_length(content_inline_size)
},
NonNegativeLengthPercentageOrNormal::Normal => {
self.block_flow.fragment.style.get_font().font_size.size()
},
NonNegativeLengthPercentageOrNormal::Normal => self
.block_flow
.fragment
.style
.get_font()
.font_size
.computed_size(),
});
let column_style = style.get_column();

View file

@ -551,7 +551,7 @@ pub fn font_metrics_for_style(
/// Returns the line block-size needed by the given computed style and font size.
pub fn line_height_from_style(style: &ComputedValues, metrics: &FontMetrics) -> Au {
let font_size = style.get_font().font_size.size();
let font_size = style.get_font().font_size.computed_size();
match style.get_inherited_text().line_height {
LineHeight::Normal => Au::from(metrics.line_gap),
LineHeight::Number(l) => Au::from(font_size * l.0),

View file

@ -1886,7 +1886,7 @@ struct TextRunLineItem {
}
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
let font_size = parent_style.get_font().font_size.size.0;
let font_size = parent_style.get_font().font_size.computed_size();
match parent_style.get_inherited_text().line_height {
LineHeight::Normal => font_metrics.line_gap,
LineHeight::Number(number) => font_size * number.0,

View file

@ -278,7 +278,7 @@ pub fn process_resolved_style_request<'dom>(
// For line height, the resolved value is the computed value if it
// is "normal" and the used value otherwise.
if longhand_id == LonghandId::LineHeight {
let font_size = style.get_font().font_size.size.0;
let font_size = style.get_font().font_size.computed_size();
return match style.get_inherited_text().line_height {
LineHeight::Normal => computed_style(),
LineHeight::Number(value) => (font_size * value.0).to_css_string(),