LibWeb: Don't fall apart on transition: none in CSS

Fixes a crash when loading https://soundcloud.com/
This commit is contained in:
Andreas Kling 2024-03-29 22:19:16 +01:00
commit 906c69c6d1
Notes: sideshowbarker 2024-07-17 00:16:31 +09:00
3 changed files with 23 additions and 0 deletions

View file

@ -684,6 +684,14 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i
}
if (property_id == CSS::PropertyID::Transition) {
if (!value.is_transition()) {
// Handle `none` as a shorthand for `all 0s ease 0s`.
set_longhand_property(CSS::PropertyID::TransitionProperty, IdentifierStyleValue::create(CSS::ValueID::All));
set_longhand_property(CSS::PropertyID::TransitionDuration, TimeStyleValue::create(CSS::Time::make_seconds(0)));
set_longhand_property(CSS::PropertyID::TransitionDelay, TimeStyleValue::create(CSS::Time::make_seconds(0)));
set_longhand_property(CSS::PropertyID::TransitionTimingFunction, IdentifierStyleValue::create(CSS::ValueID::Ease));
return;
}
auto const& transitions = value.as_transition().transitions();
Array<Vector<ValueComparingNonnullRefPtr<StyleValue const>>, 4> transition_values;
for (auto const& transition : transitions) {