1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 15:07:45 +00:00

LibWeb: Add preliminary support for CSS animations

This partially implements CSS-Animations-1 (though there are references
to CSS-Animations-2).
Current limitations:
- Multi-selector keyframes are not supported.
- Most animation properties are ignored.
- Timing functions are not applied.
- Non-absolute values are not interpolated unless the target is also of
  the same non-absolute type (e.g. 10% -> 25%, but not 10% -> 20px).
- The JavaScript interface is left as an exercise for the next poor soul
  looking at this code.

With those said, this commit implements:
- Interpolation for most common types
- Proper keyframe resolution (including the synthetic from-keyframe
  containing the initial state)
- Properly driven animations, and proper style invalidation

Co-Authored-By: Andreas Kling <kling@serenityos.org>
This commit is contained in:
Ali Mohammad Pur 2023-05-26 23:30:54 +03:30 committed by Andreas Kling
parent f07c4ffbc8
commit e90752cc21
31 changed files with 1062 additions and 12 deletions

View file

@ -30,6 +30,103 @@
"align-self"
]
},
"animation": {
"affects-layout": true,
"inherited": false,
"initial": "none 0s ease 1 normal running 0s none",
"longhands": [
"animation-name",
"animation-duration",
"animation-timing-function",
"animation-iteration-count",
"animation-direction",
"animation-play-state",
"animation-delay",
"animation-fill-mode"
]
},
"animation-name": {
"affects-layout": true,
"inherited": false,
"initial": "none",
"valid-types": [
"string", "custom-ident"
],
"valid-identifiers": [
"none"
]
},
"animation-duration": {
"affects-layout": true,
"inherited": false,
"initial": "0s",
"valid-types": [
"time [0,∞]"
]
},
"animation-timing-function": {
"affects-layout": true,
"inherited": false,
"initial": "ease",
"__comment": "FIXME: This is like...wrong.",
"valid-identifiers": [
"ease",
"linear",
"ease-in-out",
"ease-in",
"ease-out"
]
},
"animation-iteration-count": {
"affects-layout": true,
"inherited": false,
"initial": "1",
"valid-types": [
"number [0,∞]"
],
"valid-identifiers": [
"infinite"
]
},
"animation-direction": {
"affects-layout": false,
"inherited": false,
"initial": "normal",
"valid-identifiers": [
"normal",
"reverse",
"alternate",
"alternate-reverse"
]
},
"animation-play-state": {
"affects-layout": false,
"inherited": false,
"initial": "running",
"valid-identifiers": [
"running",
"paused"
]
},
"animation-delay": {
"affects-layout": true,
"inherited": false,
"initial": "0s",
"valid-types": [
"time"
]
},
"animation-fill-mode": {
"affects-layout": true,
"inherited": false,
"initial": "none",
"valid-identifiers": [
"none",
"forwards",
"backwards",
"both"
]
},
"appearance": {
"inherited": false,
"initial": "auto",
@ -237,7 +334,7 @@
"affects-layout": false,
"initial": "currentcolor",
"inherited": false,
"valid-types": [
"valid-types": [
"color"
],
"quirks": [