| <!DOCTYPE html> |
| <title>scroll-timeline and container queries</title> |
| <link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-shorthand"> |
| <link rel="help" src="https://drafts.csswg.org/css-contain-3/#container-queries"> |
| <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> |
| #scroller { |
| overflow: auto; |
| width: auto; |
| height: 100px; |
| } |
| #scroller > div { |
| height: 200px; |
| } |
| |
| @keyframes anim { |
| from { background-color: rgb(100, 100, 100); } |
| to { background-color: rgb(200, 200, 200); } |
| } |
| #element { |
| height: 10px; |
| width: 10px; |
| animation: anim 10s linear; |
| animation-timeline: timeline; |
| background-color: rgb(0, 0, 0); |
| } |
| </style> |
| <div> |
| <div id=scroller> |
| <div></div> |
| </div> |
| <div> |
| <div id=element></div> |
| </div> |
| </div> |
| <script> |
| setup(assert_implements_animation_timeline); |
| |
| promise_test(async (t) => { |
| element.offsetTop; |
| scroller.scrollTop = 50; |
| await waitForNextFrame(); |
| // Unknown timeline, time held at zero. |
| assert_equals(getComputedStyle(element).backgroundColor, 'rgb(100, 100, 100)'); |
| scroller.style.scrollTimeline = 'timeline'; |
| await waitForCSSScrollTimelineStyle(); |
| assert_equals(getComputedStyle(element).backgroundColor, 'rgb(150, 150, 150)'); |
| }, 'Timelines appearing on preceding siblings are visible to getComputedStyle'); |
| </script> |