mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 17:29:01 +00:00
LibWeb: Don't resolve UnresolvedStyleValue
s in set_keyframes
If the custom property related to this UnresolvedStyleValue changed we would not reflect the up to date value in the animation.
This commit is contained in:
parent
d4aa40a9fe
commit
3b8c2a97c0
Notes:
github-actions[bot]
2025-08-28 08:31:25 +00:00
Author: https://github.com/Calme1709
Commit: 3b8c2a97c0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6007
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 18 additions and 4 deletions
|
@ -869,7 +869,6 @@ WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<GC::Root<JS::Ob
|
|||
|
||||
auto keyframe_set = adopt_ref(*new KeyFrameSet);
|
||||
m_target_properties.clear();
|
||||
auto target = this->target();
|
||||
|
||||
for (auto& keyframe : m_keyframes) {
|
||||
Animations::KeyframeEffect::KeyFrameSet::ResolvedKeyFrame resolved_keyframe;
|
||||
|
@ -877,9 +876,6 @@ WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<GC::Root<JS::Ob
|
|||
auto key = static_cast<u64>(keyframe.computed_offset.value() * 100 * AnimationKeyFrameKeyScaleFactor);
|
||||
|
||||
for (auto [property_id, property_value] : keyframe.parsed_properties()) {
|
||||
if (property_value->is_unresolved() && target)
|
||||
property_value = CSS::Parser::Parser::resolve_unresolved_style_value(CSS::Parser::ParsingParams { target->document() }, *target, pseudo_element_type(), property_id, property_value->as_unresolved());
|
||||
|
||||
resolved_keyframe.properties.set(property_id, property_value);
|
||||
CSS::StyleComputer::for_each_property_expanding_shorthands(property_id, property_value, [&](CSS::PropertyID longhand_id, CSS::StyleValue const&) {
|
||||
m_target_properties.set(longhand_id);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
rgb(0, 64, 0)
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<div id="foo" style="--foo: red"></div>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const anim = foo.animate([{ color: "black" }, { color: "var(--foo)" }], 1000);
|
||||
|
||||
foo.style = "--foo: green";
|
||||
|
||||
anim.pause();
|
||||
anim.currentTime = 500;
|
||||
|
||||
println(getComputedStyle(foo).color);
|
||||
});
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue