Skip to content

When animating a property, ignore any keyframes without that property#338

Open
simonwuelker wants to merge 1 commit intoservo:mainfrom
simonwuelker:keyframes-missing-properties-2
Open

When animating a property, ignore any keyframes without that property#338
simonwuelker wants to merge 1 commit intoservo:mainfrom
simonwuelker:keyframes-missing-properties-2

Conversation

@simonwuelker
Copy link
Copy Markdown
Contributor

@simonwuelker simonwuelker commented Mar 19, 2026

For the purposes of animating a single keyframe, we should ignore any keyframes that don't declare that property.

The basic idea here is to store a list on each keyframe, with one entry for each animating property. The entry is either the value of the declared property (if any), or the indices of the adjacent keyframes which do declare the property.

That way we don't have to walk the list of keyframes within get_property_declaration_at_time at all.

cc @mrobinson

Companion PR for servo/servo#43461

Comment on lines +267 to +274

#[derive(Clone, Debug, MallocSizeOf)]
enum AnimationValueOrReference {
/// This keyframe declares the property with the given value.
AnimationValue(AnimationValue),
/// This keyframe does not declare the property.
NotDefinedHere(PropertyDeclarationOffsets),
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the size of AnimationValueOrReference is the same as that of AnimationValue.
In other words, this change doesn't cost us anything in terms of memory.

@simonwuelker simonwuelker force-pushed the keyframes-missing-properties-2 branch from bf64796 to 5cfe0f0 Compare March 19, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant