LibWeb: Prevent infinitely growing font size due to rem units in root

A font-size with rem units need to resolve against the default font
metrics for the root element, otherwise every time we compute style,
the reference value for rem units grows.

This fixes an issue where text on some web pages would grow every time
there was a relayout. This was very noticeable on https://proton.me/

Fixes #339
This commit is contained in:
Andreas Kling 2025-03-05 18:22:05 +01:00 committed by Andreas Kling
parent dd78d5d50e
commit 02a642b87b
Notes: github-actions[bot] 2025-03-05 21:47:05 +00:00
5 changed files with 45 additions and 8 deletions

View file

@ -631,7 +631,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_inherited_style()
return invalidation;
document().style_computer().compute_font(*computed_properties, this, {});
document().style_computer().absolutize_values(*computed_properties);
document().style_computer().absolutize_values(*computed_properties, this);
for (auto [property_id, old_value] : old_values_with_relative_units) {
auto new_value = computed_properties->maybe_null_property(static_cast<CSS::PropertyID>(property_id));