Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSplit `running_animations` into two lists, one for keyframes and one for transitions #14419
Comments
|
Perhaps using struct variants would make more sense? I.e. #[derive(Clone, Debug)]
pub enum Animation {
Transition {
opaque: OpaqueNode,
node: UnsafeNode,
start_time: f64,
frame: AnimationFrame,
is_expired: bool
},
Keyframes {
opaque: OpaqueNode,
name: Atom,
state: KeyframesAnimationState
}
} |
|
Oh, I see what's happening here. The only thing that doesn't quite make sense to me is that you're essentially creating 2 different structs that have no relation with each other, except in the case where you have to send data over a channel and you have to wrap them with the |
We probably could have two separate channels, since the receiver just runs |
|
Is this still relevant? Given much stuff changed around animations since last year. |
|
Transitions and animations are currently not sent over a channel, but they are still represented by an enum. It may make sense to fully separate these into two different structs as the number of situations where animations and transitions need to be handled differently (such as applying them in the proper order or one having precedence over the other) is only going to increase. |
This change splits the list of animations and transitions, which are almost always handled differently. It also renames `ElementAnimationState` to `ElementAnimationSet` and establishes an `AnimationState` for every transition and animation. This allows us to stop continually reallocating lists every time a transition or animation needs to be canceled. Fixes servo#14419.
Split animations and transitions into separate lists This change splits the list of animations and transitions, which are almost always handled differently. It also renames `ElementAnimationState` to `ElementAnimationSet` and establishes an `AnimationState` for every transition and animation. This allows us to stop continually reallocating lists every time a transition or animation needs to be canceled. Fixes #14419. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #14419 <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they should not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Split animations and transitions into separate lists This change splits the list of animations and transitions, which are almost always handled differently. It also renames `ElementAnimationState` to `ElementAnimationSet` and establishes an `AnimationState` for every transition and animation. This allows us to stop continually reallocating lists every time a transition or animation needs to be canceled. Fixes #14419. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #14419 <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they should not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Instead of this:
The data should be defined like this:
Making this change (there are more spots that will need to be changed than the ones shown, of course) should reduce the rightward drift that comes from having to loop and then match (instead, it's just two loops). It should also save RAM, by only allocating the space we need instead of the space of the largest variant (in this case, Animation::Keyframes). The enum can still be used for sending over the animation channel.