LibWeb: Store font-width in ComputedProperties in computed form

This commit is contained in:
Callum Law 2025-09-02 20:43:10 +12:00 committed by Sam Atkins
parent 073d10c6d1
commit 335c8c7ffb
Notes: github-actions[bot] 2025-09-19 09:08:05 +00:00
10 changed files with 264 additions and 200 deletions

View file

@ -10,6 +10,7 @@
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
@ -126,13 +127,14 @@ public:
auto const& computed_font_size = CSS::StyleComputer::compute_font_size(font_size, computed_math_depth, inherited_font_size, inherited_math_depth, length_resolution_context);
auto const& computed_font_weight = CSS::StyleComputer::compute_font_weight(font_weight, inherited_font_weight, length_resolution_context);
auto const& computed_font_width = CSS::StyleComputer::compute_font_width(font_width, length_resolution_context);
return document->style_computer().compute_font_for_style_values(
font_family,
computed_font_size->as_length().length().absolute_length_to_px(),
font_style,
computed_font_weight->as_number().number(),
font_width);
computed_font_width->as_percentage().percentage());
},
[](HTML::WorkerGlobalScope*) -> RefPtr<Gfx::FontCascadeList const> {
// FIXME: implement computing the font for HTML::WorkerGlobalScope