mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 14:50:18 +00:00
LibWeb: Resolve unresolved style values when animating properties
This commit is contained in:
parent
b2fb9cc7d3
commit
3dd9f2715f
Notes:
sideshowbarker
2024-07-17 03:03:37 +09:00
Author: https://github.com/mattco98
Commit: 3dd9f2715f
Pull-request: https://github.com/SerenityOS/serenity/pull/23622
Issue: https://github.com/SerenityOS/serenity/issues/23609
3 changed files with 17 additions and 12 deletions
|
@ -1293,7 +1293,7 @@ static ValueComparingRefPtr<StyleValue const> interpolate_property(DOM::Element&
|
|||
}
|
||||
}
|
||||
|
||||
void StyleComputer::collect_animation_into(JS::NonnullGCPtr<Animations::KeyframeEffect> effect, StyleProperties& style_properties, AnimationRefresh refresh) const
|
||||
void StyleComputer::collect_animation_into(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, JS::NonnullGCPtr<Animations::KeyframeEffect> effect, StyleProperties& style_properties, AnimationRefresh refresh) const
|
||||
{
|
||||
auto animation = effect->associated_animation();
|
||||
if (!animation)
|
||||
|
@ -1350,7 +1350,11 @@ void StyleComputer::collect_animation_into(JS::NonnullGCPtr<Animations::Keyframe
|
|||
return {};
|
||||
return style_properties.maybe_null_property(it.key);
|
||||
},
|
||||
[&](RefPtr<StyleValue const> value) { return value; });
|
||||
[&](RefPtr<StyleValue const> value) -> RefPtr<StyleValue const> {
|
||||
if (value->is_unresolved())
|
||||
return Parser::Parser::resolve_unresolved_style_value(Parser::ParsingContext { element.document() }, element, pseudo_element, it.key, value->as_unresolved());
|
||||
return value;
|
||||
});
|
||||
};
|
||||
|
||||
auto resolved_start_property = resolve_property(it.value);
|
||||
|
@ -1565,7 +1569,7 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
|
|||
if (auto effect = animation->effect(); effect && effect->is_keyframe_effect()) {
|
||||
auto& keyframe_effect = *static_cast<Animations::KeyframeEffect*>(effect.ptr());
|
||||
if (keyframe_effect.pseudo_element_type() == pseudo_element)
|
||||
collect_animation_into(keyframe_effect, style);
|
||||
collect_animation_into(element, pseudo_element, keyframe_effect, style);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
No,
|
||||
Yes,
|
||||
};
|
||||
void collect_animation_into(JS::NonnullGCPtr<Animations::KeyframeEffect> animation, StyleProperties& style_properties, AnimationRefresh = AnimationRefresh::No) const;
|
||||
void collect_animation_into(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, JS::NonnullGCPtr<Animations::KeyframeEffect> animation, StyleProperties& style_properties, AnimationRefresh = AnimationRefresh::No) const;
|
||||
|
||||
private:
|
||||
enum class ComputeStyleMode {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue