1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:28:11 +00:00

LibWeb: Make resolved styles handle calculated length-percentages

This could lead to a crash when inspecting for example the <body>
on holidaycss.js.org, because it has `width: calc(100% - 1em)`
This commit is contained in:
Simon Wanner 2022-04-03 22:05:03 +02:00 committed by Andreas Kling
parent fe0f0b0acf
commit 450c0df938
2 changed files with 9 additions and 1 deletions

View file

@ -497,7 +497,9 @@ static NonnullRefPtr<StyleValue> style_value_for_length_percentage(LengthPercent
{
if (length_percentage.is_percentage())
return PercentageStyleValue::create(length_percentage.percentage());
return LengthStyleValue::create(length_percentage.length());
if (length_percentage.is_length())
return LengthStyleValue::create(length_percentage.length());
return length_percentage.calculated();
}
RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout::NodeWithStyle const& layout_node, PropertyID property_id) const