LibWeb: Absolutize StyleValues before computing font properties

We also avoid prematurely constructing CSSPixels when computing
font-size which gains us a couple of test passes
This commit is contained in:
Callum Law 2025-10-03 23:16:30 +13:00 committed by Tim Ledbetter
parent ca9d107a1a
commit 28451b16c9
Notes: github-actions[bot] 2025-10-20 15:14:19 +00:00
5 changed files with 53 additions and 45 deletions

View file

@ -112,6 +112,8 @@ public:
// NOTE: The initial value here is non-standard as the default font is "10px sans-serif"
auto inherited_font_size = CSSPixels { 10 };
auto inherited_font_weight = CSS::InitialValues::font_weight();
// FIXME: Investigate whether this is the correct resolution context (i.e. whether we should instead use
// a font-size of 10px) for OffscreenCanvas
auto length_resolution_context = CSS::Length::ResolutionContext::for_window(*document->window());
if constexpr (SameAs<CanvasType, HTML::HTMLCanvasElement>) {