mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Don't mangle inherited properties when updating animated style
This commit is contained in:
parent
01f6f33236
commit
408bbead31
Notes:
github-actions[bot]
2025-11-21 08:25:55 +00:00
Author: https://github.com/Calme1709
Commit: 408bbead31
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6853
Reviewed-by: https://github.com/gmta ✅
5 changed files with 39 additions and 4 deletions
|
|
@ -922,7 +922,7 @@ void KeyframeEffect::update_computed_properties(AnimationUpdateContext& context)
|
|||
DOM::AbstractElement abstract_element { *target, pseudo_element_type() };
|
||||
context.elements.ensure(abstract_element, [computed_properties] {
|
||||
auto old_animated_properties = computed_properties->animated_property_values();
|
||||
computed_properties->reset_animated_properties({});
|
||||
computed_properties->reset_non_inherited_animated_properties({});
|
||||
return make<AnimationUpdateContext::ElementData>(move(old_animated_properties), computed_properties);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -161,9 +161,12 @@ void ComputedProperties::remove_animated_property(PropertyID id)
|
|||
m_animated_property_values.remove(id);
|
||||
}
|
||||
|
||||
void ComputedProperties::reset_animated_properties(Badge<Animations::KeyframeEffect>)
|
||||
void ComputedProperties::reset_non_inherited_animated_properties(Badge<Animations::KeyframeEffect>)
|
||||
{
|
||||
m_animated_property_values.clear();
|
||||
for (auto property_id : m_animated_property_values.keys()) {
|
||||
if (!is_animated_property_inherited(property_id))
|
||||
m_animated_property_values.remove(property_id);
|
||||
}
|
||||
}
|
||||
|
||||
StyleValue const& ComputedProperties::property(PropertyID property_id, WithAnimationsApplied return_animated_value) const
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
};
|
||||
|
||||
HashMap<PropertyID, NonnullRefPtr<StyleValue const>> const& animated_property_values() const { return m_animated_property_values; }
|
||||
void reset_animated_properties(Badge<Animations::KeyframeEffect>);
|
||||
void reset_non_inherited_animated_properties(Badge<Animations::KeyframeEffect>);
|
||||
|
||||
bool is_property_important(PropertyID property_id) const;
|
||||
bool is_property_inherited(PropertyID property_id) const;
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
rgb(255, 0, 0)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
@keyframes foo {
|
||||
from,
|
||||
to {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bar {
|
||||
from,
|
||||
to {
|
||||
width: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#foo {
|
||||
animation: foo 1s infinite;
|
||||
}
|
||||
|
||||
#bar {
|
||||
animation: bar 1s infinite;
|
||||
}
|
||||
</style>
|
||||
<div id="foo"><div id="bar"></div></div>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
println(getComputedStyle(bar).color);
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue