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

LibWeb: Return Optional from StyleProperties::box_sizing()

This function was written as if it returned `Optional<CSS::BoxSizing>`
but actually returned a plain `CSS::BoxSizing`, meaning if the property
was not set or was invalid, it would return whichever enum value was
first. This wasn't visible because we don't yet pay any attention to
the `box-sizing` property.
This commit is contained in:
Sam Atkins 2022-04-13 19:33:56 +01:00 committed by Andreas Kling
parent 3f61f869c8
commit 4d42885327
3 changed files with 4 additions and 3 deletions

View file

@ -363,7 +363,8 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
}
computed_values.set_background_color(computed_style.color_or_fallback(CSS::PropertyID::BackgroundColor, *this, CSS::InitialValues::background_color()));
computed_values.set_box_sizing(computed_style.box_sizing());
if (auto box_sizing = computed_style.box_sizing(); box_sizing.has_value())
computed_values.set_box_sizing(box_sizing.release_value());
if (auto maybe_font_variant = computed_style.font_variant(); maybe_font_variant.has_value())
computed_values.set_font_variant(maybe_font_variant.release_value());