LibWeb: Separate font computation logic from StyleComputer

Font computation and loading is distinct enough from style computation
that it makes more sense to have this in it's own class.

This will be useful later when we move the font loading process to
`ComputedProperties` in order to respect animated values.
This commit is contained in:
Callum Law 2025-11-06 18:27:22 +13:00 committed by Sam Atkins
parent dfa47d9ed6
commit 6c236d04d8
Notes: github-actions[bot] 2025-12-05 10:04:34 +00:00
13 changed files with 722 additions and 646 deletions

View file

@ -7,6 +7,7 @@
#include "CanvasTextDrawingStyles.h"
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/FontComputer.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleValues/FontStyleStyleValue.h>
@ -142,7 +143,7 @@ void CanvasTextDrawingStyles<IncludingClass, CanvasType>::set_font(StringView fo
auto const& computed_font_width = CSS::StyleComputer::compute_font_width(font_width, computation_context);
auto const& computed_font_style = CSS::StyleComputer::compute_font_style(font_style, computation_context);
return document->style_computer().compute_font_for_style_values(
return document->font_computer().compute_font_for_style_values(
font_family,
computed_font_size->as_length().length().absolute_length_to_px(),
computed_font_style->as_font_style().to_font_slope(),