From 4dbecee99c9a88bbde87fe5b6462c2dd203e355d Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 24 Apr 2024 03:52:01 -0700 Subject: [PATCH] Don't reset animations/transitions on moveBefore See https://github.com/whatwg/dom/issues/1255 Animations & transitions should attempt to continue from where they left off, if possible. This is done in the following way: - Animations are not cancelled on removal when in a state-preserving atomic move. - We don't reset the computed style when removing the element in preparation for an atomic move. - We don't clear the layout/style flags, so that the layout is recomputed and reattached on the next style recalc. Bug: 40150299 Change-Id: I559e69e75df14df589485cb024da0f0f28b1e1ec --- .../continue-css-animation-left.html | 51 +++++++++++++++++++ .../continue-css-animation-transform.html | 48 +++++++++++++++++ .../continue-css-transition-left.html | 41 +++++++++++++++ .../continue-css-transition-transform.html | 36 +++++++++++++ .../css-animation-commit-styles.html | 45 ++++++++++++++++ .../tentative/css-transition-trigger.html | 43 ++++++++++++++++ 6 files changed, 264 insertions(+) create mode 100644 dom/nodes/moveBefore/tentative/continue-css-animation-left.html create mode 100644 dom/nodes/moveBefore/tentative/continue-css-animation-transform.html create mode 100644 dom/nodes/moveBefore/tentative/continue-css-transition-left.html create mode 100644 dom/nodes/moveBefore/tentative/continue-css-transition-transform.html create mode 100644 dom/nodes/moveBefore/tentative/css-animation-commit-styles.html create mode 100644 dom/nodes/moveBefore/tentative/css-transition-trigger.html diff --git a/dom/nodes/moveBefore/tentative/continue-css-animation-left.html b/dom/nodes/moveBefore/tentative/continue-css-animation-left.html new file mode 100644 index 00000000000000..8c7f73e3c933ce --- /dev/null +++ b/dom/nodes/moveBefore/tentative/continue-css-animation-left.html @@ -0,0 +1,51 @@ + +Node.moveBefore should preserve CSS animation state (left) + + + +
+
+
+
+
+ + + diff --git a/dom/nodes/moveBefore/tentative/continue-css-animation-transform.html b/dom/nodes/moveBefore/tentative/continue-css-animation-transform.html new file mode 100644 index 00000000000000..e7a285893aa0e4 --- /dev/null +++ b/dom/nodes/moveBefore/tentative/continue-css-animation-transform.html @@ -0,0 +1,48 @@ + +Node.moveBefore should preserve CSS animation state (transform) + + + + +
+
+
+
+
+ + + diff --git a/dom/nodes/moveBefore/tentative/continue-css-transition-left.html b/dom/nodes/moveBefore/tentative/continue-css-transition-left.html new file mode 100644 index 00000000000000..2b8e04b26e469b --- /dev/null +++ b/dom/nodes/moveBefore/tentative/continue-css-transition-left.html @@ -0,0 +1,41 @@ + +Node.moveBefore should preserve CSS transition state (left) + + + + +
+
+
+
+
+ + + diff --git a/dom/nodes/moveBefore/tentative/continue-css-transition-transform.html b/dom/nodes/moveBefore/tentative/continue-css-transition-transform.html new file mode 100644 index 00000000000000..f09edca1449789 --- /dev/null +++ b/dom/nodes/moveBefore/tentative/continue-css-transition-transform.html @@ -0,0 +1,36 @@ + +Node.moveBefore should preserve CSS transition state (transform) + + + + +
+
+
+
+
+ + + diff --git a/dom/nodes/moveBefore/tentative/css-animation-commit-styles.html b/dom/nodes/moveBefore/tentative/css-animation-commit-styles.html new file mode 100644 index 00000000000000..86bb7c33e4261e --- /dev/null +++ b/dom/nodes/moveBefore/tentative/css-animation-commit-styles.html @@ -0,0 +1,45 @@ + +Calling commitStyles after Node.moveBefore should commit mid-transition value + + + + +
+
+
+
+
+ + + diff --git a/dom/nodes/moveBefore/tentative/css-transition-trigger.html b/dom/nodes/moveBefore/tentative/css-transition-trigger.html new file mode 100644 index 00000000000000..0cb5608a695e00 --- /dev/null +++ b/dom/nodes/moveBefore/tentative/css-transition-trigger.html @@ -0,0 +1,43 @@ + +Node.moveBefore should trigger CSS transition state (left) if needed + + + + +
+
+
+
+
+ + +