-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement scroll-timeline-attachment and view-timeline-attachment
As resolved in w3c/csswg-drafts#7759 the new properties allow to defer the attachment of the timeline to the scroller. It allows for animations to be run by the scroller on elements that are not children of the scroller. Change-Id: I05768523d2ccf7278abd62dcfedc5f41fea19322 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4410751 Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1128678}
- Loading branch information
1 parent
d53ed57
commit fb28d77
Showing
6 changed files
with
157 additions
and
11 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
scroll-animations/css/scroll-timeline-attachment-computed-tentative.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,35 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/computed-testcommon.js"></script> | ||
<style> | ||
#outer { scroll-timeline-attachment: defer; } | ||
#target { scroll-timeline-attachment: ancestor; } | ||
</style> | ||
<div id="outer"> | ||
<div id="target"></div> | ||
</div> | ||
<script> | ||
test_computed_value('scroll-timeline-attachment', 'initial', 'local'); | ||
test_computed_value('scroll-timeline-attachment', 'inherit', 'defer'); | ||
test_computed_value('scroll-timeline-attachment', 'unset', 'local'); | ||
test_computed_value('scroll-timeline-attachment', 'revert', 'local'); | ||
test_computed_value('scroll-timeline-attachment', 'local'); | ||
test_computed_value('scroll-timeline-attachment', 'defer'); | ||
test_computed_value('scroll-timeline-attachment', 'ancestor'); | ||
test_computed_value('scroll-timeline-attachment', 'local, defer'); | ||
test_computed_value('scroll-timeline-attachment', 'defer, ancestor'); | ||
test_computed_value('scroll-timeline-attachment', 'local, defer, ancestor'); | ||
test_computed_value('scroll-timeline-attachment', 'local, local, local, local'); | ||
|
||
test(() => { | ||
let style = getComputedStyle(document.getElementById('target')); | ||
assert_not_equals(Array.from(style).indexOf('scroll-timeline-attachment'), -1); | ||
}, 'The scroll-timeline-attachment property shows up in CSSStyleDeclaration enumeration'); | ||
|
||
test(() => { | ||
let style = document.getElementById('target').style; | ||
assert_not_equals(style.cssText.indexOf('scroll-timeline-attachment'), -1); | ||
}, 'The scroll-timeline-attachment property shows up in CSSStyleDeclaration.cssText'); | ||
|
||
</script> |
29 changes: 29 additions & 0 deletions
29
scroll-animations/css/scroll-timeline-attachment-parsing-tentative.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,29 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
<div id="target"></div> | ||
|
||
<script> | ||
|
||
test_valid_value('scroll-timeline-attachment', 'initial'); | ||
test_valid_value('scroll-timeline-attachment', 'inherit'); | ||
test_valid_value('scroll-timeline-attachment', 'unset'); | ||
test_valid_value('scroll-timeline-attachment', 'revert'); | ||
|
||
test_valid_value('scroll-timeline-attachment', 'local'); | ||
test_valid_value('scroll-timeline-attachment', 'defer'); | ||
test_valid_value('scroll-timeline-attachment', 'ancestor'); | ||
test_valid_value('scroll-timeline-attachment', 'local, defer'); | ||
test_valid_value('scroll-timeline-attachment', 'defer, ancestor'); | ||
test_valid_value('scroll-timeline-attachment', 'local, defer, ancestor, local'); | ||
test_valid_value('scroll-timeline-attachment', 'local, local, local, local'); | ||
|
||
test_invalid_value('scroll-timeline-attachment', 'abc'); | ||
test_invalid_value('scroll-timeline-attachment', '10px'); | ||
test_invalid_value('scroll-timeline-attachment', 'auto'); | ||
test_invalid_value('scroll-timeline-attachment', 'none'); | ||
test_invalid_value('scroll-timeline-attachment', 'local defer'); | ||
test_invalid_value('scroll-timeline-attachment', 'local / defer'); | ||
|
||
</script> |
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
35 changes: 35 additions & 0 deletions
35
scroll-animations/css/view-timeline-attachment-computed-tentative.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,35 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/computed-testcommon.js"></script> | ||
<style> | ||
#outer { view-timeline-attachment: defer; } | ||
#target { view-timeline-attachment: ancestor; } | ||
</style> | ||
<div id="outer"> | ||
<div id="target"></div> | ||
</div> | ||
<script> | ||
test_computed_value('view-timeline-attachment', 'initial', 'local'); | ||
test_computed_value('view-timeline-attachment', 'inherit', 'defer'); | ||
test_computed_value('view-timeline-attachment', 'unset', 'local'); | ||
test_computed_value('view-timeline-attachment', 'revert', 'local'); | ||
test_computed_value('view-timeline-attachment', 'local'); | ||
test_computed_value('view-timeline-attachment', 'defer'); | ||
test_computed_value('view-timeline-attachment', 'ancestor'); | ||
test_computed_value('view-timeline-attachment', 'local, defer'); | ||
test_computed_value('view-timeline-attachment', 'defer, ancestor'); | ||
test_computed_value('view-timeline-attachment', 'local, defer, ancestor'); | ||
test_computed_value('view-timeline-attachment', 'local, local, local, local'); | ||
|
||
test(() => { | ||
let style = getComputedStyle(document.getElementById('target')); | ||
assert_not_equals(Array.from(style).indexOf('view-timeline-attachment'), -1); | ||
}, 'The view-timeline-attachment property shows up in CSSStyleDeclaration enumeration'); | ||
|
||
test(() => { | ||
let style = document.getElementById('target').style; | ||
assert_not_equals(style.cssText.indexOf('view-timeline-attachment'), -1); | ||
}, 'The view-timeline-attachment property shows up in CSSStyleDeclaration.cssText'); | ||
|
||
</script> |
29 changes: 29 additions & 0 deletions
29
scroll-animations/css/view-timeline-attachment-parsing-tentative.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,29 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
<div id="target"></div> | ||
|
||
<script> | ||
|
||
test_valid_value('view-timeline-attachment', 'initial'); | ||
test_valid_value('view-timeline-attachment', 'inherit'); | ||
test_valid_value('view-timeline-attachment', 'unset'); | ||
test_valid_value('view-timeline-attachment', 'revert'); | ||
|
||
test_valid_value('view-timeline-attachment', 'local'); | ||
test_valid_value('view-timeline-attachment', 'defer'); | ||
test_valid_value('view-timeline-attachment', 'ancestor'); | ||
test_valid_value('view-timeline-attachment', 'local, defer'); | ||
test_valid_value('view-timeline-attachment', 'defer, ancestor'); | ||
test_valid_value('view-timeline-attachment', 'local, defer, ancestor, local'); | ||
test_valid_value('view-timeline-attachment', 'local, local, local, local'); | ||
|
||
test_invalid_value('view-timeline-attachment', 'abc'); | ||
test_invalid_value('view-timeline-attachment', '10px'); | ||
test_invalid_value('view-timeline-attachment', 'auto'); | ||
test_invalid_value('view-timeline-attachment', 'none'); | ||
test_invalid_value('view-timeline-attachment', 'local defer'); | ||
test_invalid_value('view-timeline-attachment', 'local / defer'); | ||
|
||
</script> |
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