LibWeb: Propagate animated values in recompute_inherited_style
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

As `recompute_inherited_style` works in-place rather than building
ComputedProperties from scratch we need to keep track of which animated
properties are inherited to know whether we should remove them when we
have no more inherited value.
This commit is contained in:
Callum Law 2025-08-20 23:30:31 +12:00 committed by Sam Atkins
commit 9330bf4b72
Notes: github-actions[bot] 2025-08-21 09:48:03 +00:00
6 changed files with 69 additions and 6 deletions

View file

@ -1701,7 +1701,7 @@ void StyleComputer::compute_defaulted_property_value(ComputedProperties& style,
if (!value_slot) {
if (is_inherited_property(property_id)) {
if (auto animated_inherit_value = get_animated_inherit_value(property_id, element, pseudo_element); animated_inherit_value.has_value())
style.set_animated_property(property_id, animated_inherit_value.value());
style.set_animated_property(property_id, animated_inherit_value.value(), ComputedProperties::Inherited::Yes);
style.set_property(
property_id,
get_inherit_value(property_id, element, pseudo_element),
@ -1720,7 +1720,7 @@ void StyleComputer::compute_defaulted_property_value(ComputedProperties& style,
if (value_slot->is_inherit()) {
if (auto animated_inherit_value = get_animated_inherit_value(property_id, element, pseudo_element); animated_inherit_value.has_value())
style.set_animated_property(property_id, animated_inherit_value.value());
style.set_animated_property(property_id, animated_inherit_value.value(), ComputedProperties::Inherited::Yes);
value_slot = get_inherit_value(property_id, element, pseudo_element);
style.set_property_inherited(property_id, ComputedProperties::Inherited::Yes);
return;
@ -1732,7 +1732,7 @@ void StyleComputer::compute_defaulted_property_value(ComputedProperties& style,
if (is_inherited_property(property_id)) {
// then if it is an inherited property, this is treated as inherit,
if (auto animated_inherit_value = get_animated_inherit_value(property_id, element, pseudo_element); animated_inherit_value.has_value())
style.set_animated_property(property_id, animated_inherit_value.value());
style.set_animated_property(property_id, animated_inherit_value.value(), ComputedProperties::Inherited::Yes);
value_slot = get_inherit_value(property_id, element, pseudo_element);
style.set_property_inherited(property_id, ComputedProperties::Inherited::Yes);
} else {
@ -2693,7 +2693,7 @@ GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::Element& elem
computed_style->set_property(property_id, value.release_nonnull(), inherited);
if (animated_value.has_value())
computed_style->set_animated_property(property_id, animated_value.value());
computed_style->set_animated_property(property_id, animated_value.value(), inherited);
if (property_id == PropertyID::AnimationName) {
computed_style->set_animation_name_source(cascaded_properties.property_source(property_id));