Skip to content

Commit

Permalink
Reland "Skip static animations on compositor and main"
Browse files Browse the repository at this point in the history
This is a reland of commit 3690cd7872423e81e74dc66f9886e355a7c1b659

The two tests that regressed have been dealt with.  One already
had equivalent test functionality in WPT and could simply be deleted
with no loss of test coverage. The other was ported from a non-WPT
testRunner based pixel test to a WPT ref-test.

Original change's description:
> Skip static animations on compositor and main
>
> An animation with empty keyframes or with keyframes whose property
> values are identical between frames previously ran as a normal
> animation. As there is no visual change other than at a phase boundary,
> these animations do not need to run on the compositor, and only need
> to be scheduled on the main thread at phase boundaries.
>
> This is the first step in optimizing no-op animations. A follow up
> patch will short-circuit sampling when the property value is constant.
> Another patch will refine the rules for background color compositing
> to only consider dynamic properties.  Finally, metrics will be added
> to track shorthand expansion of CSS properties, which is likely the
> most common source of static properties in CSS animations.
>
> Bug: 40728212
> Change-Id: I1baff2d0d26400f91f12d4cac2141e9bb101b3d0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5328026
> Reviewed-by: Ian Clelland <[email protected]>
> Reviewed-by: Robert Flack <[email protected]>
> Commit-Queue: Kevin Ellis <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#1268998}

Bug: 40728212
Change-Id: Ibc3ab166567b93175c7a2d1da21092e87e9d30ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5359414
Commit-Queue: Kevin Ellis <[email protected]>
Reviewed-by: Robert Flack <[email protected]>
Reviewed-by: Ian Clelland <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1272150}
  • Loading branch information
kevers-google authored and chromium-wpt-export-bot committed Mar 13, 2024
1 parent 553237c commit 0d7498f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ const midpointOptions = {
delay: -duration/2
};

// Constant-valued animation using the ending keyframe's value.
const referenceOptions = {
easing: 'steps(1, jump-start)',
duration: duration,
delay: -duration/2
}

// Similar to midpointOptions, but to produce the interpolation result
// at -1 instead of the interpolation result at 0.5. This easing curve
// has zero slope at its midpoint of -100% (though does have curvature).
Expand Down Expand Up @@ -169,9 +176,8 @@ async function createTests(tests) {
takeScreenshot();
}

// Create references using an animation with identical keyframes for start
// and end so as to avoid rounding and anti-aliasing differences between
// animated and non-animated pathways.
// Create references using a constant-valued animation to avoid rounding and
// anti-aliasing differences between animated and non-animated pathways.
async function createRefs(tests) {
styleBody();
for (const obj of tests) {
Expand All @@ -181,8 +187,8 @@ async function createRefs(tests) {
initialStyle(div);
finalStyle(div);
var anim = div.animate(
{transform: [test[midIndex], test[midIndex]]},
midpointOptions);
{transform: ['none', test[midIndex]]},
referenceOptions);
await anim.ready;
}

Expand Down
2 changes: 1 addition & 1 deletion dom/events/scrolling/scroll_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function waitForCompositorCommit() {
// deferred running the tests until after paint holding.
async function waitForCompositorReady() {
const animation =
document.body.animate({ opacity: [ 1, 1 ] }, {duration: 1 });
document.body.animate({ opacity: [ 0, 1 ] }, {duration: 1 });
return animation.finished;
}

Expand Down
2 changes: 1 addition & 1 deletion web-animations/testcommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function assert_phase(animation, phase) {
// crbug.com/1378671
async function waitForCompositorReady() {
const animation =
document.body.animate({ opacity: [ 1, 1 ] }, {duration: 1 });
document.body.animate({ opacity: [ 0, 1 ] }, {duration: 1 });
return animation.finished;
}

Expand Down

0 comments on commit 0d7498f

Please sign in to comment.