Skip to content

Commit

Permalink
Bug 1810019 [wpt PR 37916] - Revert "[view-timeline]: Update naming f…
Browse files Browse the repository at this point in the history
…or delay as timeline offset", a=testonly

Automatic update from web-platform-tests
Revert "[view-timeline]: Update naming for delay as timeline offset"

This reverts commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43.

Reason for revert:
LUCI Bisection identified this CL as the culprit of a build failure. See the analysis: https://luci-bisection.appspot.com/analysis/b/8792142657514411521

Sample failed build: https://ci.chromium.org/b/8792142657514411521

If this is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?comment=Analysis%3A+https%3A%2F%2Fluci-bisection.appspot.com%2Fanalysis%2Fb%2F8792142657514411521&components=Tools%3ETest%3EFindit&labels=LUCI-Bisection-Wrong%2CPri-3%2CType-Bug&status=Available&summary=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F4081107

Original change's description:
> [view-timeline]: Update naming for delay as timeline offset
>
> Patch implements rename based on most recent recommendation in
> w3c/csswg-drafts#7589.
>
> Next steps:
> * CSS support for animation-range.
> * Support for % delays.
> * Support for range(Start|End) as string in animation effect timing options.
> * Removal of <name> <percent> from animation-delay.
> * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range).
>
> Bug: 1383162
> Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107
> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
> Commit-Queue: Kevin Ellis <kevers@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1092031}
>

Bug: 1383162
Change-Id: Id7c8f3ca84675b454d14a18a45aa1895c87d303f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4162958
Commit-Queue: Jonathan Njeunje <njeunje@chromium.org>
Reviewed-by: Jonathan Njeunje <njeunje@chromium.org>
Owners-Override: Jonathan Njeunje <njeunje@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1092052}

--

wpt-commits: 3103e5894fcb303d2ea34bc918fdd014cb3f78e5
wpt-pr: 37916
  • Loading branch information
luci-bisection@appspot.gserviceaccount.com authored and moz-wptsync-bot committed Jan 18, 2023
1 parent 5111803 commit 2cb9288
Show file tree
Hide file tree
Showing 10 changed files with 387 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,15 @@
test_computed_value("animation-delay-start", "-500ms", "-0.5s");
test_computed_value("animation-delay-start", "calc(2 * 3s)", "6s");
test_computed_value("animation-delay-start", "20s, 10s");

test_computed_value("animation-delay-start", "cover 0%");
test_computed_value("animation-delay-start", "COVER 0%", "cover 0%");
test_computed_value("animation-delay-start", "cover 100%");
test_computed_value("animation-delay-start", "cover 120%");
test_computed_value("animation-delay-start", "cover 42%");
test_computed_value("animation-delay-start", "cover -42%");
test_computed_value("animation-delay-start", "contain 42%");
test_computed_value("animation-delay-start", "exit 42%");
test_computed_value("animation-delay-start", "exit calc(41% + 1%)", "exit 42%");
test_computed_value("animation-delay-start", "exit 1%, cover 2%, contain 100%");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,25 @@
test_computed_value("animation-delay", "1s 2s, 3s");
test_computed_value("animation-delay", "1s, 2s 3s");
test_computed_value("animation-delay", "1s, 2s, 3s");

test_computed_value("animation-delay", "cover");
test_computed_value("animation-delay", "contain");
test_computed_value("animation-delay", "enter");
test_computed_value("animation-delay", "exit");
test_computed_value("animation-delay", "enter, exit");

test_computed_value("animation-delay", "enter 0% enter 100%", "enter");
test_computed_value("animation-delay", "exit 0% exit 100%", "exit");
test_computed_value("animation-delay", "cover 0% cover 100%", "cover");
test_computed_value("animation-delay", "contain 0% contain 100%", "contain");

test_computed_value("animation-delay", "cover 50%");
test_computed_value("animation-delay", "contain 50%");
test_computed_value("animation-delay", "enter 50%");
test_computed_value("animation-delay", "exit 50%");

test_computed_value("animation-delay", "enter 50% 0s", "enter 50%");
test_computed_value("animation-delay", "0s enter 50%");
test_computed_value("animation-delay", "enter 50% exit 50%");
test_computed_value("animation-delay", "cover 50% enter 50%, contain 50% exit 50%");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,15 @@
test_computed_value("animation-delay-start", "-500ms", "-0.5s");
test_computed_value("animation-delay-start", "calc(2 * 3s)", "6s");
test_computed_value("animation-delay-start", "20s, 10s");

test_computed_value("animation-delay-start", "cover 0%");
test_computed_value("animation-delay-start", "COVER 0%", "cover 0%");
test_computed_value("animation-delay-start", "cover 100%");
test_computed_value("animation-delay-start", "cover 120%");
test_computed_value("animation-delay-start", "cover 42%");
test_computed_value("animation-delay-start", "cover -42%");
test_computed_value("animation-delay-start", "contain 42%");
test_computed_value("animation-delay-start", "exit 42%");
test_computed_value("animation-delay-start", "exit calc(41% + 1%)", "exit 42%");
test_computed_value("animation-delay-start", "exit 1%, cover 2%, contain 100%");
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<title>Animations using named timeline ranges</title>
<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#named-timeline-range">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/web-animations/testcommon.js"></script>
<script src="support/testcommon.js"></script>
<style>
@keyframes anim {
from { z-index: 0; background-color: skyblue;}
to { z-index: 100; background-color: coral; }
}
#scroller {
border: 10px solid lightgray;
overflow-y: scroll;
width: 200px;
height: 200px;
}
#target {
margin: 800px 0px;
width: 100px;
height: 100px;
z-index: -1;
background-color: green;
}
</style>
<main id=main>
</main>
<template>
<div id=scroller>
<div id=target></div>
</div>
</template>
<script>
setup(assert_implements_animation_timeline);

function inflate(t, template) {
t.add_cleanup(() => main.replaceChildren());
main.append(template.content.cloneNode(true));
}
async function scrollTop(e, value) {
e.scrollTop = value;
await waitForNextFrame();
}
async function waitForAnimationReady(target) {
await waitForNextFrame();
await Promise.all(target.getAnimations().map(x => x.promise));
}
async function assertValueAt(scroller, target, args) {
await waitForAnimationReady(target);
await scrollTop(scroller, args.scrollTop);
assert_equals(getComputedStyle(target).zIndex, args.expected.toString());
}
function test_animation_delay(options) {
promise_test(async (t) => {
inflate(t, document.querySelector('template'));
let scroller = main.querySelector('#scroller');
let target = main.querySelector('#target');

target.style.viewTimeline = 't1 block';
// TODO(crbug.com/1375998): Create the timeline in a separate frame to
// work around a bug.
await waitForNextFrame();

target.style.animation = 'anim 10s linear';
target.style.animationTimeline = 't1';
target.style.animationDelayStart = options.startDelay;
target.style.animationDelayEnd = options.endDelay;

// Accommodates floating point precision errors at the endpoints.
target.style.animationFillMode = 'both';

// 0%
await assertValueAt(scroller, target,
{ scrollTop: options.rangeStart, expected: 0 });
// 50%
await assertValueAt(scroller, target,
{ scrollTop: (options.rangeStart + options.rangeEnd) / 2, expected: 50 });
// 100%
await assertValueAt(scroller, target,
{ scrollTop: options.rangeEnd, expected: 100 });

// Test before/after phases (need to clear the fill mode for that).
target.style.animationFillMode = 'initial';
await assertValueAt(scroller, target,
{ scrollTop: options.rangeStart - 10, expected: -1 });
await assertValueAt(scroller, target,
{ scrollTop: options.rangeEnd + 10, expected: -1 });
// Check 50% again without fill mode.
await assertValueAt(scroller, target,
{ scrollTop: (options.rangeStart + options.rangeEnd) / 2, expected: 50 });

}, `Animation with delays [${options.startDelay}, ${options.endDelay}]`);
}

test_animation_delay({
startDelay: 'initial',
endDelay: 'initial',
rangeStart: 600,
rangeEnd: 900
});

test_animation_delay({
startDelay: 'cover 0%',
endDelay: 'cover 100%',
rangeStart: 600,
rangeEnd: 900
});

test_animation_delay({
startDelay: 'contain 0%',
endDelay: 'contain 100%',
rangeStart: 700,
rangeEnd: 800
});

test_animation_delay({
startDelay: 'enter 0%',
endDelay: 'enter 100%',
rangeStart: 600,
rangeEnd: 700
});

test_animation_delay({
startDelay: 'exit 0%',
endDelay: 'exit 100%',
rangeStart: 800,
rangeEnd: 900
});

test_animation_delay({
startDelay: 'contain -50%',
endDelay: 'enter 200%',
rangeStart: 650,
rangeEnd: 800
});

test_animation_delay({
startDelay: 'enter 0%',
endDelay: 'exit 100%',
rangeStart: 600,
rangeEnd: 900
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ function CreateViewTimelineOpacityAnimation(test, target, options) {
// the animation.
//
// Sample call:
// await runTimelineBoundsTest(t, {
// await runTimelineRangeTest(t, {
// timeline: { inset: [ CSS.percent(0), CSS.percent(20)] },
// timing: { fill: 'both' }
// startOffset: 600,
// endOffset: 900
// rangeStart: 600,
// rangeEnd: 900
// });
async function runTimelineBoundsTest(t, options, message) {
async function runTimelineRangeTest(t, options, message) {
container.scrollLeft = 0;
await waitForNextFrame();

Expand All @@ -52,19 +52,19 @@ async function runTimelineBoundsTest(t, options, message) {
await anim.ready;

// Advance to the start offset, which triggers entry to the active phase.
container.scrollLeft = options.startOffset;
container.scrollLeft = options.rangeStart;
await waitForNextFrame();
assert_equals(getComputedStyle(target).opacity, '0.3',
`Effect at the start of the active phase: ${message}`);

// Advance to the midpoint of the animation.
container.scrollLeft = (options.startOffset + options.endOffset) / 2;
container.scrollLeft = (options.rangeStart + options.rangeEnd) / 2;
await waitForNextFrame();
assert_equals(getComputedStyle(target).opacity,'0.5',
`Effect at the midpoint of the active range: ${message}`);

// Advance to the end of the animation.
container.scrollLeft = options.endOffset;
container.scrollLeft = options.rangeEnd;
await waitForNextFrame();
assert_equals(getComputedStyle(target).opacity, '0.7',
`Effect is in the active phase at effect end time: ${message}`);
Expand All @@ -73,51 +73,51 @@ async function runTimelineBoundsTest(t, options, message) {
return anim;
}

// Sets the start and end range for a view timeline and ensures that the
// Sets the start and end delays for a view timeline and ensures that the
// range aligns with expected values.
//
// Sample call:
// await runTimelineRangeTest(t, {
// rangeStart: { rangeName: 'cover', offset: CSS.percent(0) } ,
// rangeEnd: { rangeName: 'cover', offset: CSS.percent(100) },
// startOffset: 600,
// endOffset: 900
// await runTimelineDelayTest(t, {
// delay: { phase: 'cover', percent: CSS.percent(0) } ,
// endDelay: { phase: 'cover', percent: CSS.percent(100) },
// rangeStart: 600,
// rangeEnd: 900
// });
async function runTimelineRangeTest(t, options) {
const rangeToString = range => {
async function runTimelineDelayTest(t, options) {
const delayToString = delay => {
const parts = [];
if (range.rangeName)
parts.push(range.rangeName);
if (range.offset)
parts.push(`${range.offset.value}%`);
if (delay.phase)
parts.push(delay.phase);
if (delay.percent)
parts.push(`${delay.percent.value}%`);
return parts.join(' ');
};
const range =
`${rangeToString(options.rangeStart)} to ` +
`${rangeToString(options.rangeEnd)}`;
`${delayToString(options.delay)} to ` +
`${delayToString(options.endDelay)}`;

options.timeline = {
axis: 'inline'
};
options.timing = {
rangeStart: options.rangeStart,
rangeEnd: options.rangeEnd,
delay: options.delay,
endDelay: options.endDelay,
// Set fill to accommodate floating point precision errors at the
// endpoints.
fill: 'both'
};

return runTimelineBoundsTest(t, options, range);
return runTimelineRangeTest(t, options, range);
}

// Sets the Inset for a view timeline and ensures that the range aligns with
// expected values.
//
// Sample call:
// await runTimelineInsetTest(t, {
// await runTimelineDelayTest(t, {
// inset: [ CSS.px(20), CSS.px(40) ]
// startOffset: 600,
// endOffset: 900
// rangeStart: 600,
// rangeEnd: 900
// });
async function runTimelineInsetTest(t, options) {
options.timeline = {
Expand All @@ -133,5 +133,5 @@ async function runTimelineInsetTest(t, options) {
const range =
(options.inset instanceof Array) ? options.inset.join(' ')
: options.inset;
return runTimelineBoundsTest(t, options, range);
return runTimelineRangeTest(t, options, range);
}
Loading

0 comments on commit 2cb9288

Please sign in to comment.