diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp index c6d8125753..117f630286 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -711,6 +711,14 @@ void StyleComputer::collect_animation_into(DOM::AbstractElement abstract_element if (style_value->is_unresolved()) style_value = Parser::Parser::resolve_unresolved_style_value(Parser::ParsingParams { abstract_element.document() }, abstract_element, PropertyNameAndID::from_id(property_id), style_value->as_unresolved()); + // https://drafts.csswg.org/css-values-5/#invalid-at-computed-value-time + // When substitution results in a guaranteed-invalid value, treat it as unset + // (i.e. inherit for inherited properties, initial for non-inherited properties). + if (style_value->is_guaranteed_invalid()) { + specified_values.set(property_id, nullptr); + continue; + } + for_each_property_expanding_shorthands(property_id, *style_value, [&](PropertyID longhand_id, StyleValue const& longhand_value) { auto physical_longhand_id = map_logical_alias_to_physical_property(longhand_id, LogicalAliasMappingContext { computed_properties.writing_mode(), computed_properties.direction() }); auto physical_longhand_id_bitmap_index = to_underlying(physical_longhand_id) - to_underlying(first_longhand_property_id); diff --git a/Tests/LibWeb/Text/expected/css/animation-opacity-invalid-var.txt b/Tests/LibWeb/Text/expected/css/animation-opacity-invalid-var.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/animation-opacity-invalid-var.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/LibWeb/Text/input/css/animation-opacity-invalid-var.html b/Tests/LibWeb/Text/input/css/animation-opacity-invalid-var.html new file mode 100644 index 0000000000..de262cf46b --- /dev/null +++ b/Tests/LibWeb/Text/input/css/animation-opacity-invalid-var.html @@ -0,0 +1,13 @@ + + +
+ + +