1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Properly handle auto when parsing background-size

This code assumed that `auto` was always stored as a LengthStyleValue,
which will not be true in the next commit. (And was not a safe
assumption to make anyway.)
This commit is contained in:
Sam Atkins 2023-04-17 19:53:08 +01:00 committed by Andreas Kling
parent 8c03d21e95
commit 22cb74d9ff

View file

@ -4579,6 +4579,8 @@ RefPtr<StyleValue> Parser::parse_single_background_size_value(TokenStream<Compon
auto transaction = tokens.begin_transaction();
auto get_length_percentage = [](StyleValue& style_value) -> Optional<LengthPercentage> {
if (style_value.has_auto())
return LengthPercentage { Length::make_auto() };
if (style_value.is_percentage())
return LengthPercentage { style_value.as_percentage().percentage() };
if (style_value.has_length())