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

@ -76,6 +76,12 @@ bool ComputedProperties::is_property_inherited(PropertyID property_id) const
return m_property_inherited[n / 8] & (1 << (n % 8));
}
bool ComputedProperties::is_animated_property_inherited(PropertyID property_id) const
{
size_t n = to_underlying(property_id);
return m_animated_property_inherited[n / 8] & (1 << (n % 8));
}
void ComputedProperties::set_property_inherited(PropertyID property_id, Inherited inherited)
{
size_t n = to_underlying(property_id);
@ -85,6 +91,15 @@ void ComputedProperties::set_property_inherited(PropertyID property_id, Inherite
m_property_inherited[n / 8] &= ~(1 << (n % 8));
}
void ComputedProperties::set_animated_property_inherited(PropertyID property_id, Inherited inherited)
{
size_t n = to_underlying(property_id);
if (inherited == Inherited::Yes)
m_animated_property_inherited[n / 8] |= (1 << (n % 8));
else
m_animated_property_inherited[n / 8] &= ~(1 << (n % 8));
}
void ComputedProperties::set_property(PropertyID id, NonnullRefPtr<StyleValue const> value, Inherited inherited, Important important)
{
m_property_values[to_underlying(id)] = move(value);
@ -99,9 +114,15 @@ void ComputedProperties::revert_property(PropertyID id, ComputedProperties const
set_property_inherited(id, style_for_revert.is_property_inherited(id) ? Inherited::Yes : Inherited::No);
}
void ComputedProperties::set_animated_property(PropertyID id, NonnullRefPtr<StyleValue const> value)
void ComputedProperties::set_animated_property(PropertyID id, NonnullRefPtr<StyleValue const> value, Inherited inherited)
{
m_animated_property_values.set(id, move(value));
set_animated_property_inherited(id, inherited);
}
void ComputedProperties::remove_animated_property(PropertyID id)
{
m_animated_property_values.remove(id);
}
void ComputedProperties::reset_animated_properties(Badge<Animations::KeyframeEffect>)