Skip to content

Commit d658a05

Browse files
committed
test(interaction-harness): a hold the page arms itself takes a short animation on its first frame
`holdAnimations` reaches the page after a round trip, and on a loaded runner a short animation can end before it arrives: main's own holding and storyboard self-tests fail that way (a second hold, a held transition the page retargets), on a two-core pin with CPU-bound processes on the same cores too, and component proofs that hold a 200 ms press release miss it the same way. `await armHold(page, scope)` arms the page before the action; it holds every running animation under the scope as soon as one of them runs (or `count` of them, for parts that start apart; with `newOnly`, only animations that start after the arm, so a turn that starts mid-motion is held while the motion goes on), and `held()` after the action returns what it held. It holds through the same in-page body as `holdAnimations`, installed in the evaluate that installs the curve end so a hold costs no extra round trip, and into the same held set, so `seekAnimations`, `sampleCurve` and `releaseAnimations` read it unchanged, and a later hold adds to it. It looks on every frame callback and every 4 ms between them: on a cold page WebKit can deliver no frame callback for 260 to 300 ms while it first composites a newly animated layer, while its timers run and its animations advance. The busy-window control never counts (an unscoped hold still pauses it, as it takes every running animation), and `held()` rejects when nothing under the scope ran before the timeout. `animationStoryboard` films what an armed hold took (`held`) instead of holding after the action. The holding, curve-sampling and storyboard self-tests that hold a short animation an action starts arm their holds. Three that hold after a wait or a watch, or hold two runners started 100 ms apart (which an armed hold would take one at a time), run their animations for 6 to 10 s instead of 0.6 to 1 s at the same speed. The two-runner test also makes its second runner once the first has started, so a loaded engine cannot give both one first frame, and seeks 150 ms past the second start, however late that came. The staggered-starts filmstrip sets its second start 83 ms after the first on the document timeline rather than with a timer, and the page holds all three runs once the second move runs (`count: 3`). Three new self-tests cover the armed hold: a 120 ms run held on its first frames, a turn held mid-motion with `newOnly` (both read only after the run would have ended), and a rejection when nothing starts. Red first: on main the holding and storyboard describes fail under the CI WebKit lane's command (a container capped at 4 CPUs, one worker), the two holds above among them, and the holding describe fails in Chromium under the load above; with the armed holds they pass there.
1 parent 6224efd commit d658a05

4 files changed

Lines changed: 495 additions & 137 deletions

File tree

‎internal/interaction-harness/README.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ committed: a pull request links or attaches it.
5050
| `busy.ts` | `blockMainThread(page, ms)` and `busyWindowProof(tracked, window)`: frames presented, frames that moved, longest stall, a verdict; `presented` adds the compositor's own frames. |
5151
| `webInput.ts` | `webInputDriver(page)`: `wheel({x, y, dx, dy, ctrl})` and `pen(points)` as real engine input, for proofs across pointers (`spec:AST-100` FR4); `wheel` resolves once the page has the step; read back through the input log. |
5252
| `trace.ts` | `traceRendering(page, body)`: main-thread counts of UpdateLayoutTree / Layout / PrePaint / Paint / Layerize / UpdateLayer / ScrollLayer / HitTest, `countBetween`, long tasks; `installLongTaskLog` / `readLongTasks`; `startCompositorTrace`: when the compositor presents. |
53-
| `curves.ts` | `holdAnimations`, `seekAnimations`, `sampleCurve` (presented transform / opacity at any t), `waitForAnimation`, `watchAnimations`, `waitForRest`, `releaseAnimations`, `releaseAnimationLog` (frees what the recorder kept, before a heap or listener count). |
53+
| `curves.ts` | `holdAnimations`, `armHold`, `seekAnimations`, `sampleCurve` (presented transform / opacity at any t), `waitForAnimation`, `watchAnimations`, `waitForRest`, `releaseAnimations`, `releaseAnimationLog` (frees what the recorder kept, before a heap or listener count). |
5454
| `math.ts` | Oracles independent of the code under test: `cubicBezier`, `timingFunction`, `springStep` (SwiftUI response / dampingFraction, initial velocity), `projectDecay`, `rubberBand`, `parseTransform`, `compareCurve`, `timeline`. |
5555
| `storyboard.ts` | `animationStoryboard` (seek to t = 0, 16.7, 33.3 … ms), `touchStoryboard` (a frame per scripted event): PNG contact sheet + JSON trace. |
5656
| `output.ts` | `evidenceDir`, `writeEvidence`: where evidence goes and how it is attached to the report. |
@@ -73,7 +73,15 @@ animations are Web Animations too), seek to a time, read `getComputedStyle`:
7373
the presented value at that exact time, independent of frame timing. Finished
7474
animations, ones the page paused and ones on a scroll or view timeline are left
7575
alone; held animations keep their offsets from the first hold's earliest start, and release
76-
resumes only them. Compare it with an
76+
resumes only them. A hold sent from the test reaches the page after a round
77+
trip, and on a loaded runner a short animation can end first: for one that an
78+
action starts, `await armHold(page, scope)` before the action arms the page
79+
itself: it looks on every frame and every 4 ms between frames (WebKit can go
80+
hundreds of milliseconds without a frame while it first composites a layer),
81+
holds everything running under the scope as soon as one of them runs (or
82+
`count` of them, for parts that start apart; with `newOnly`, only what starts
83+
after the arm, for a turn that starts mid-motion), and `held()` after the
84+
action returns that held set. Compare it with an
7785
oracle from `math.ts` through `compareCurve`; a tolerance states the error
7886
budget (for a spring baked into `linear()` stops of `h` ms, chords err by up to
7987
`h² / 8 · |x''|`). A seek past an animation's end lands half a millisecond

0 commit comments

Comments
 (0)