-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[scroll-animations] Commit start time and fix pause calculation.
We should always use the start time from main for scroll driven animations. This also fixes a bug in the pause calculation which was leading to the start time effectively being ignored. Bug: 1445543,1401368,1444324,1428836,1445137 Change-Id: I5c5dc4e12e9e9cd695a19bbc92cc64cc4c493736 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4549163 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Robert Flack <flackr@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/main@{#1146658}
- Loading branch information
Robert Flack
authored and
Chromium LUCI CQ
committed
May 19, 2023
1 parent
ee91878
commit 7d59fcb
Showing
9 changed files
with
223 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...y/blink/web_tests/external/wpt/scroll-animations/css/animation-range-visual-test-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#named-timeline-range"> | ||
<link rel="stylesheet" href="support/animation-range.css"> | ||
<style> | ||
.meter { | ||
animation: active-interval linear 100s paused; | ||
animation-timeline: auto; | ||
} | ||
|
||
.bar { | ||
animation: slide-in linear 100s paused; | ||
animation-timeline: auto; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h3>View timeline</h3> | ||
<template id="meters"> | ||
<div class="meters"> | ||
<div class="cover"><div class="meter"><div class="bar"></div></div><div>Cover</div></div> | ||
<div class="contain"><div class="meter"><div class="bar"></div></div><div>Contain</div></div> | ||
<div class="entry"><div class="meter"><div class="bar"></div></div><div>Entry</div></div> | ||
<div class="exit"><div class="meter"><div class="bar"></div></div><div>Exit</div></div> | ||
</div> | ||
</template> | ||
<div class="flex"> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: 90px;" data-progress=".08333,-1,.5,-1"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: 70px;" data-progress=".25,.125,2,-1"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: 10px;" data-progress=".75,.875,2,-1"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: -10px;" data-progress=".91667,2,2,.5"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
<script> | ||
let template = document.querySelector('#meters'); | ||
let subjects = document.querySelectorAll('.subject'); | ||
for (let i = 0; i < subjects.length; i++) { | ||
let clone = template.content.cloneNode(true); | ||
let meters = clone.querySelectorAll('.meter'); | ||
let progress = subjects[i].getAttribute('data-progress').split(',').map(s => parseFloat(s)); | ||
for (let meter of meters) { | ||
let bar = meter.querySelector('.bar'); | ||
let startTime = -progress.splice(0, 1)[0] * 100; | ||
meter.style.animationDelay = `${startTime}s`; | ||
bar.style.animationDelay = `${startTime}s`; | ||
} | ||
subjects[i].appendChild(clone); | ||
} | ||
</script> | ||
</html> |
57 changes: 57 additions & 0 deletions
57
...party/blink/web_tests/external/wpt/scroll-animations/css/animation-range-visual-test.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#named-timeline-range"> | ||
<link rel="match" href="animation-range-visual-test-ref.html"> | ||
<link rel="stylesheet" href="support/animation-range.css"> | ||
<script src="/common/reftest-wait.js"></script> | ||
<script src="/web-animations/testcommon.js"></script> | ||
</head> | ||
<body> | ||
<h3>View timeline</h3> | ||
<template id="meters"> | ||
<div class="meters"> | ||
<div class="cover"><div class="meter"><div class="bar"></div></div><div>Cover</div></div> | ||
<div class="contain"><div class="meter"><div class="bar"></div></div><div>Contain</div></div> | ||
<div class="entry"><div class="meter"><div class="bar"></div></div><div>Entry</div></div> | ||
<div class="exit"><div class="meter"><div class="bar"></div></div><div>Exit</div></div> | ||
</div> | ||
</template> | ||
<div class="flex"> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: 90px;"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: 70px;"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: 10px;"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="scroller"> | ||
<div class="subject" style="margin-top: -10px;"></div> | ||
<div class="spacer"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
<script> | ||
let template = document.querySelector('#meters'); | ||
let subjects = document.querySelectorAll('.subject'); | ||
for (let i = 0; i < subjects.length; i++) { | ||
subjects[i].appendChild(template.content.cloneNode(true)); | ||
} | ||
waitForCompositorReady().then(takeScreenshot); | ||
</script> | ||
</html> |
82 changes: 82 additions & 0 deletions
82
third_party/blink/web_tests/external/wpt/scroll-animations/css/support/animation-range.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.flex { | ||
display: flex; | ||
} | ||
|
||
.flex > div { | ||
position: relative; | ||
height: 160px; | ||
margin: 0 10px; | ||
} | ||
|
||
.scroller { | ||
width: 100px; | ||
height: 100px; | ||
overflow: auto; | ||
border: 1px solid black; | ||
} | ||
|
||
.subject { | ||
view-timeline-name: view; | ||
width: 20px; | ||
height: 20px; | ||
margin: 0 auto; | ||
background: green; | ||
} | ||
|
||
.meters { | ||
position: absolute; | ||
left: 0; | ||
top: 110px; | ||
height: 50px; | ||
} | ||
|
||
.meters > div { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
@keyframes active-interval { | ||
0% { opacity: 1; } | ||
100% { opacity: 1; } | ||
} | ||
|
||
.meter { | ||
width: 50px; | ||
position: relative; | ||
border: 2px solid black; | ||
height: 5px; | ||
overflow: clip; | ||
opacity: 0.4; | ||
animation: active-interval linear; | ||
animation-timeline: view; | ||
} | ||
|
||
@keyframes slide-in { | ||
0% { transform: translateX(-100%)} | ||
100% { transform: translateX(0%)} | ||
} | ||
|
||
.bar { | ||
width: 100%; | ||
height: 100%; | ||
background: blue; | ||
transform: translateX(-100%); | ||
animation: slide-in linear; | ||
animation-timeline: view; | ||
} | ||
|
||
.spacer { | ||
height: 400px; | ||
} | ||
|
||
.contain .bar, .contain .meter { | ||
animation-range: contain; | ||
} | ||
|
||
.entry .bar, .entry .meter { | ||
animation-range: entry; | ||
} | ||
|
||
.exit .bar, .exit .meter { | ||
animation-range: exit; | ||
} |