Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,8 @@ test('the double-tap zoom keeps advancing every frame while the main thread is b
const tracked = await trackMarker(page, castFrames);
const control = await trackMarker(page, castFrames, {rgb: CONTROL_RGB});
const proof = busyWindowProof(tracked, block, {
axis: 'height',
settledWithinSteps: ZOOM_SETTLED_STEPS,
axis: ZOOM_AXIS,
settledWithin: ZOOM_SETTLED_PX,
control,
});
await writeEvidence(
Expand Down Expand Up @@ -1123,6 +1123,12 @@ test('the double-tap zoom keeps advancing every frame while the main thread is b
// animation presents fewer frames there, the control's too. The photo keeps
// pace with the control, and a main-thread animation would not.
expect(proof.verdict.failures).toEqual([]);
// The verdict, spelled out. The top edge takes a new position on every
// frame the control moves, with none excused as under a cast step. The
// control moves on at least the verdict's floor of four frames.
expect(proof.control?.movedWith).toBe(proof.control?.moved);
expect(proof.control?.belowStep).toBe(0);
expect(proof.control?.moved).toBeGreaterThanOrEqual(4);
expect(proof.monotonic).toBe(true);
});

Expand All @@ -1138,13 +1144,24 @@ const ZOOM_TEMPO = 5;
const ZOOM_BLOCK_MS = 2500;

/**
* Where the busy zoom proof stops judging, in cast steps from the zoom's
* end. Near the end, each 60 Hz frame moves the spring about 0.042 of what
* remains (2π / 2.5 s, critically damped). So within about 23.9 cast steps
* of its end a frame moves less than one step, and the cast shows plateaus
* there.
* The photo's coordinate the busy zoom proof judges: its top edge. The zoom
* grows the photo at both edges, and the cast reads each edge in whole
* steps. So near the end the height can show no change for a frame while it
* grows almost two steps a frame. The proof's step rules expect one edge's
* travel, so the proof judges the top edge.
*/
const ZOOM_SETTLED_STEPS = 24;
const ZOOM_AXIS = 'y';

/**
* Where the busy zoom proof stops judging, in px of the top edge from its
* end. There the edge's move between two cast frames falls under one cast
* step. Near the end, each 60 Hz frame moves the spring about 0.042 of what
* remains (2π / 2.5 s, critically damped). Chromium casts every frame in 1 px
* steps, so its moves fall under a step 23.9 px from the end. Blocked, WebKit
Comment on lines +1158 to +1160

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking. For a critically damped spring from rest, what remains is A(1 + ωt)e^(-ωt), so a frame moves ωΔt · ωt/(1 + ωt) of it. That is about 0.032 at 24 px, not 0.042, which is the rate only as t grows without bound. The recorded top edge fits that curve to within 5 px in total. The move drops under 1 px at about 30.5 px from rest. The last ~4 judged frames move 0.86–0.98 px. In every run here, rounding still shows a new position on each of them, and the first held frame (y = 25) comes one frame after the cut. With expect(proof.control?.belowStep).toBe(0) that one frame is the whole margin. Replaying the same runs with the cast ending at rest (y = 0) fails the new assertion while the verdict passes. A 32 px bound, or settledAt read at rest, keeps belowStep 0 and still judges about 1.3 s.

* casts a frame only every 116 ms or more, seven 60 Hz frames, in 2 px steps.
* Its moves stay over a step until about 8 px from the end, inside 24 px.
*/
const ZOOM_SETTLED_PX = 24;

/** Each animated property's curve length, and whether it still runs. */
function curvesByProperty(runs: ReadonlyArray<ActiveAnimation>) {
Expand Down Expand Up @@ -1220,8 +1237,8 @@ for (const pace of ['main-thread', 'frozen'] as const) {
let failures: ReadonlyArray<string>;
try {
failures = busyWindowProof(tracked, block, {
axis: 'height',
settledWithinSteps: ZOOM_SETTLED_STEPS,
axis: ZOOM_AXIS,
settledWithin: ZOOM_SETTLED_PX,
control,
}).verdict.failures;
} catch (error) {
Expand Down
Loading