mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Reset animated CSS properties for pseudo elements
Previously we were resetting animated properties if animation effect's target is not a pseudo element.
This commit is contained in:
parent
c5071c9025
commit
6a029fb6d9
Notes:
github-actions[bot]
2025-05-28 16:37:19 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 6a029fb6d9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4903
Reviewed-by: https://github.com/tcl3 ✅
6 changed files with 8 additions and 13 deletions
|
@ -941,6 +941,12 @@ void KeyframeEffect::update_computed_properties()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto animated_properties_before_update = style->animated_property_values();
|
auto animated_properties_before_update = style->animated_property_values();
|
||||||
|
if (!pseudo_element_type().has_value()) {
|
||||||
|
if (auto computed_properties = target->computed_properties())
|
||||||
|
computed_properties->reset_animated_properties({});
|
||||||
|
} else if (auto computed_properties = target->pseudo_element_computed_properties(pseudo_element_type().value())) {
|
||||||
|
computed_properties->reset_animated_properties({});
|
||||||
|
}
|
||||||
|
|
||||||
auto& document = target->document();
|
auto& document = target->document();
|
||||||
document.style_computer().collect_animation_into(*target, pseudo_element_type(), *this, *style, CSS::StyleComputer::AnimationRefresh::Yes);
|
document.style_computer().collect_animation_into(*target, pseudo_element_type(), *this, *style, CSS::StyleComputer::AnimationRefresh::Yes);
|
||||||
|
|
|
@ -103,7 +103,7 @@ void ComputedProperties::set_animated_property(PropertyID id, NonnullRefPtr<CSSS
|
||||||
m_animated_property_values.set(id, move(value));
|
m_animated_property_values.set(id, move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputedProperties::reset_animated_properties()
|
void ComputedProperties::reset_animated_properties(Badge<Animations::KeyframeEffect>)
|
||||||
{
|
{
|
||||||
m_animated_property_values.clear();
|
m_animated_property_values.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
HashMap<PropertyID, NonnullRefPtr<CSSStyleValue const>> const& animated_property_values() const { return m_animated_property_values; }
|
HashMap<PropertyID, NonnullRefPtr<CSSStyleValue const>> const& animated_property_values() const { return m_animated_property_values; }
|
||||||
void reset_animated_properties();
|
void reset_animated_properties(Badge<Animations::KeyframeEffect>);
|
||||||
|
|
||||||
bool is_property_important(PropertyID property_id) const;
|
bool is_property_important(PropertyID property_id) const;
|
||||||
bool is_property_inherited(PropertyID property_id) const;
|
bool is_property_inherited(PropertyID property_id) const;
|
||||||
|
|
|
@ -1571,8 +1571,6 @@ void Document::update_animated_style_if_needed()
|
||||||
if (animation->is_idle() || animation->is_finished())
|
if (animation->is_idle() || animation->is_finished())
|
||||||
continue;
|
continue;
|
||||||
if (auto effect = animation->effect()) {
|
if (auto effect = animation->effect()) {
|
||||||
if (auto* target = effect->target())
|
|
||||||
target->reset_animated_css_properties();
|
|
||||||
effect->update_computed_properties();
|
effect->update_computed_properties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,13 +789,6 @@ GC::Ref<CSS::ComputedProperties> Element::resolved_css_values(Optional<CSS::Pseu
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::reset_animated_css_properties()
|
|
||||||
{
|
|
||||||
if (!m_computed_properties)
|
|
||||||
return;
|
|
||||||
m_computed_properties->reset_animated_properties();
|
|
||||||
}
|
|
||||||
|
|
||||||
DOMTokenList* Element::class_list()
|
DOMTokenList* Element::class_list()
|
||||||
{
|
{
|
||||||
if (!m_class_list)
|
if (!m_class_list)
|
||||||
|
|
|
@ -216,8 +216,6 @@ public:
|
||||||
void set_pseudo_element_computed_properties(CSS::PseudoElement, GC::Ptr<CSS::ComputedProperties>);
|
void set_pseudo_element_computed_properties(CSS::PseudoElement, GC::Ptr<CSS::ComputedProperties>);
|
||||||
GC::Ptr<CSS::ComputedProperties> pseudo_element_computed_properties(CSS::PseudoElement);
|
GC::Ptr<CSS::ComputedProperties> pseudo_element_computed_properties(CSS::PseudoElement);
|
||||||
|
|
||||||
void reset_animated_css_properties();
|
|
||||||
|
|
||||||
GC::Ptr<CSS::CSSStyleProperties> inline_style() { return m_inline_style; }
|
GC::Ptr<CSS::CSSStyleProperties> inline_style() { return m_inline_style; }
|
||||||
GC::Ptr<CSS::CSSStyleProperties const> inline_style() const { return m_inline_style; }
|
GC::Ptr<CSS::CSSStyleProperties const> inline_style() const { return m_inline_style; }
|
||||||
void set_inline_style(GC::Ptr<CSS::CSSStyleProperties>);
|
void set_inline_style(GC::Ptr<CSS::CSSStyleProperties>);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue