mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/CSS: Absolutize values while computing font variation settings
Makes the `compute_font_variation_settings` function match other `compute_font_*` by absolutizing values passed into them. It resolves a crash related to using `siblings-count` inside `font-variation-settings` Co-authored-by: Sam Atkins <sam@ladybird.org>
This commit is contained in:
parent
3829a85fde
commit
d8e80718d7
Notes:
github-actions[bot]
2025-11-04 20:46:23 +00:00
Author: https://github.com/Norbiros
Commit: d8e80718d7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6439
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/kalenikaliaksandr
Reviewed-by: https://github.com/konradekk
2 changed files with 11 additions and 3 deletions
|
|
@ -2008,6 +2008,12 @@ void StyleComputer::compute_font(ComputedProperties& style, Optional<DOM::Abstra
|
|||
PropertyID::FontStyle,
|
||||
compute_font_style(font_style_specified_value, font_computation_context));
|
||||
|
||||
auto const& font_variation_settings_value = style.property(PropertyID::FontVariationSettings, ComputedProperties::WithAnimationsApplied::No);
|
||||
|
||||
style.set_property_without_modifying_flags(
|
||||
PropertyID::FontVariationSettings,
|
||||
compute_font_variation_settings(font_variation_settings_value, font_computation_context));
|
||||
|
||||
auto const& font_family = style.property(CSS::PropertyID::FontFamily);
|
||||
|
||||
auto font_list = compute_font_for_style_values(font_family, style.font_size(), style.font_slope(), style.font_weight(), style.font_width(), style.font_variation_settings().value_or({}), font_computation_context.length_resolution_context);
|
||||
|
|
@ -3147,7 +3153,7 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_value_of_property(
|
|||
case PropertyID::CornerTopRightShape:
|
||||
return compute_corner_shape(absolutized_value);
|
||||
case PropertyID::FontVariationSettings:
|
||||
return compute_font_variation_settings(absolutized_value);
|
||||
return compute_font_variation_settings(absolutized_value, computation_context);
|
||||
case PropertyID::LetterSpacing:
|
||||
case PropertyID::WordSpacing:
|
||||
if (absolutized_value->to_keyword() == Keyword::Normal)
|
||||
|
|
@ -3194,8 +3200,10 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_animation_name(NonnullRef
|
|||
});
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleValue const> StyleComputer::compute_font_variation_settings(NonnullRefPtr<StyleValue const> const& absolutized_value)
|
||||
NonnullRefPtr<StyleValue const> StyleComputer::compute_font_variation_settings(NonnullRefPtr<StyleValue const> const& specified_value, ComputationContext const& computation_context)
|
||||
{
|
||||
auto const& absolutized_value = specified_value->absolutized(computation_context);
|
||||
|
||||
if (absolutized_value->is_keyword())
|
||||
return absolutized_value;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue