Skip to content

Commit 6f8302d

Browse files
authored
Revert "Revert "Reland #2 "Implement CSSTransitionDiscrete which enables transitions on discrete properties.""" (web-platform-tests#38936)
This reverts commit 78f70fd.
1 parent 4af24bc commit 6f8302d

File tree

4 files changed

+86
-7
lines changed

4 files changed

+86
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<link rel=author href="mailto:jarhar@chromium.org">
3+
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/4441">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
7+
<div id=target1 class=target>hello</div>
8+
<div id=target2 class=target>hello</div>
9+
10+
<style>
11+
.target {
12+
float: left;
13+
width: 100px;
14+
height: 100px;
15+
}
16+
.target.animated {
17+
float: right;
18+
}
19+
20+
#target1 {
21+
transition: all 1s, float 1s;
22+
}
23+
24+
#target2 {
25+
transition: all 1s;
26+
}
27+
</style>
28+
29+
<script>
30+
promise_test(async () => {
31+
let transitionstartFired = false;
32+
target1.addEventListener('transitionstart', () => {
33+
transitionstartFired = true;
34+
});
35+
await new Promise(resolve => requestAnimationFrame(resolve));
36+
target1.classList.add('animated');
37+
await new Promise(resolve => requestAnimationFrame(resolve));
38+
assert_true(transitionstartFired);
39+
}, 'all with an explicit discrete property should animate.');
40+
41+
promise_test(async () => {
42+
let transitionstartFired = false;
43+
target2.addEventListener('transitionstart', () => {
44+
transitionstartFired = true;
45+
});
46+
await new Promise(resolve => requestAnimationFrame(resolve));
47+
target2.classList.add('animated');
48+
await new Promise(resolve => requestAnimationFrame(resolve));
49+
assert_false(transitionstartFired);
50+
}, 'all without an explicit discrete property should not animate.');
51+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<link rel=help href="mailto:jarhar@chromium.org">
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
6+
<div id=target>target</div>
7+
<style>
8+
#target {
9+
display: none;
10+
transition: 1s;
11+
color: red;
12+
}
13+
#target.animated {
14+
transition: 1s;
15+
color: green;
16+
}
17+
</style>
18+
19+
<script>
20+
test(() => {
21+
target.addEventListener('transitionstart', () => {
22+
assert_unreached('transitionstart should not be fired.');
23+
});
24+
target.classList.add('animated');
25+
assert_equals(target.getAnimations().length, 0,
26+
'There should not be any animations running.');
27+
}, 'Transitions and animations should not occur on display:none elements.');
28+
</script>

css/motion/animation/offset-interpolation.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
to: 'path("M0 300H 700 Z") 600px 900deg',
1616
method: 'CSS Transitions',
1717
}, [
18-
{at: -0.3, expect: 'path("M0 300H 700 Z") 470px 770deg'},
19-
{at: 0, expect: 'path("M0 300H 700 Z") 500px 800deg'},
20-
{at: 0.3, expect: 'path("M0 300H 700 Z") 530px 830deg'},
18+
{at: -0.3, expect: 'path("M0 200H 700") 470px 770deg'},
19+
{at: 0, expect: 'path("M0 200H 700") 500px 800deg'},
20+
{at: 0.3, expect: 'path("M0 200H 700") 530px 830deg'},
2121
{at: 0.6, expect: 'path("M0 300H 700 Z") 560px 860deg'},
2222
{at: 1, expect: 'path("M0 300H 700 Z") 600px 900deg'},
2323
{at: 1.5, expect: 'path("M0 300H 700 Z") 650px 950deg'},
@@ -29,9 +29,9 @@
2929
to: 'path("M0 0H 300") 600px 0deg',
3030
method: 'CSS Transitions',
3131
}, [
32-
{at: -0.3, expect: 'path("M0 0H 170") 470px 0deg'},
33-
{at: 0, expect: 'path("M0 0H 200") 500px 0deg'},
34-
{at: 0.3, expect: 'path("M0 0H 230") 530px 0deg'},
32+
{at: -0.3, expect: 'path("M0 0H 170") 470px auto 0deg'},
33+
{at: 0, expect: 'path("M0 0H 200") 500px auto 0deg'},
34+
{at: 0.3, expect: 'path("M0 0H 230") 530px auto 0deg'},
3535
{at: 0.6, expect: 'path("M0 0H 260") 560px 0deg'},
3636
{at: 1, expect: 'path("M0 0H 300") 600px 0deg'},
3737
{at: 1.5, expect: 'path("M0 0H 350") 650px 0deg'},

css/support/interpolation-testcommon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
target.style.setProperty(property, isNeutralKeyframe(from) ? '' : from);
5757
},
5858
nonInterpolationExpectations: function(from, to) {
59-
return expectFlip(from, to, -Infinity);
59+
return expectFlip(from, to, 0.5);
6060
},
6161
notAnimatableExpectations: function(from, to, underlying) {
6262
return expectFlip(from, to, -Infinity);

0 commit comments

Comments
 (0)