mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Resolve percentages in calc() for font-size
Fixes crashing on https://react.dev/
This commit is contained in:
parent
b64ed060d8
commit
28c9015bd8
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 28c9015bd8
Pull-request: https://github.com/SerenityOS/serenity/pull/21325
Reviewed-by: https://github.com/AtkinsSJ
5 changed files with 39 additions and 18 deletions
|
@ -1764,7 +1764,11 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
|
|||
} else if (font_size.is_length()) {
|
||||
maybe_length = font_size.as_length().length();
|
||||
} else if (font_size.is_calculated()) {
|
||||
maybe_length = font_size.as_calculated().resolve_length(length_resolution_context);
|
||||
if (font_size.as_calculated().contains_percentage()) {
|
||||
maybe_length = font_size.as_calculated().resolve_length_percentage(length_resolution_context, Length::make_px(parent_font_size()));
|
||||
} else {
|
||||
maybe_length = font_size.as_calculated().resolve_length(length_resolution_context);
|
||||
}
|
||||
}
|
||||
if (maybe_length.has_value()) {
|
||||
font_size_in_px = maybe_length.value().to_px(length_resolution_context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue