Skip to content

Commit

Permalink
CSSTransitionDiscrete: add transition-animation-type to transition sh…
Browse files Browse the repository at this point in the history
…orthand

This patch implements the proposed transition shorthand for
transition-animation-type:
w3c/csswg-drafts#8857 (comment)

Bug: 1453112
Change-Id: I2f15592de8d9b74be864bd0e0c0eec9d2de77b73
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Jul 25, 2023
1 parent b8294eb commit 105759f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,146 +35,167 @@
from: 'rgb(100, 100, 100) rgb(150, 150, 150)',
to: 'rgb(200, 200, 200)',
expected: 'rgb(200, 200, 200)',
animationType: 'discrete',
}, 'A custom property of type <color>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<custom-ident>#",
from: 'foo, bar',
to: 'baz',
expected: 'baz',
animationType: 'discrete',
}, 'A custom property of type <custom-ident># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<custom-ident>+",
from: 'foo bar',
to: 'baz',
expected: 'baz',
animationType: 'discrete',
}, 'A custom property of type <custom-ident>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<image>#",
from: 'url("https://example.com/foo"), url("https://example.com/bar")',
to: 'url("https://example.com/to")',
expected: 'url("https://example.com/to")',
animationType: 'discrete',
}, 'A custom property of type <image># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<image>+",
from: 'url("https://example.com/foo") url("https://example.com/bar")',
to: 'url("https://example.com/to")',
expected: 'url("https://example.com/to")',
animationType: 'discrete',
}, 'A custom property of type <image>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<integer>#",
from: '100, 200',
to: '300',
expected: '300',
animationType: 'discrete',
}, 'A custom property of type <integer># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<integer>+",
from: '100 200',
to: '300',
expected: '300',
animationType: 'discrete',
}, 'A custom property of type <integer>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<length-percentage>#",
from: '100px, 200px',
to: '300%',
expected: '300%',
animationType: 'discrete',
}, 'A custom property of type <length-percentage># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<length-percentage>+",
from: '100px 200px',
to: '300%',
expected: '300%',
animationType: 'discrete',
}, 'A custom property of type <length-percentage>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<length>#",
from: '100px, 200px',
to: '300px',
expected: '300px',
animationType: 'discrete',
}, 'A custom property of type <length># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<length>+",
from: '100px 200px',
to: '300px',
expected: '300px',
animationType: 'discrete',
}, 'A custom property of type <length>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<number>#",
from: '100, 200',
to: '300',
expected: '300',
animationType: 'discrete',
}, 'A custom property of type <number># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<number>+",
from: '100 200',
to: '300',
expected: '300',
animationType: 'discrete',
}, 'A custom property of type <number>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<percentage>#",
from: '100%, 200%',
to: '300%',
expected: '300%',
animationType: 'discrete',
}, 'A custom property of type <percentage># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<percentage>+",
from: '100% 200%',
to: '300%',
expected: '300%',
animationType: 'discrete',
}, 'A custom property of type <percentage>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<resolution>#",
from: '100dppx, 200dppx',
to: '300dppx',
expected: '300dppx',
animationType: 'discrete',
}, 'A custom property of type <resolution># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<resolution>+",
from: '100dppx 200dppx',
to: '300dppx',
expected: '300dppx',
animationType: 'discrete',
}, 'A custom property of type <resolution>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<time>#",
from: '100s, 200s',
to: '300s',
expected: '300s',
animationType: 'discrete',
}, 'A custom property of type <time># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<time>+",
from: '100s 200s',
to: '300s',
expected: '300s',
animationType: 'discrete',
}, 'A custom property of type <time>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<url>#",
from: 'url("https://example.com/foo"), url("https://example.com/bar")',
to: 'url("https://example.com/to")',
expected: 'url("https://example.com/to")',
animationType: 'discrete',
}, 'A custom property of type <url># yields a discrete CSS Transition if the lists do not contain the same number of values');

transition_test({
syntax: "<url>+",
from: 'url("https://example.com/foo") url("https://example.com/bar")',
to: 'url("https://example.com/to")',
expected: 'url("https://example.com/to")',
animationType: 'discrete',
}, 'A custom property of type <url>+ yields a discrete CSS Transition if the lists do not contain the same number of values');

</script>
2 changes: 1 addition & 1 deletion css/css-transitions/all-with-discrete.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
float: left;
width: 100px;
height: 100px;
transition-animation-type: discrete;
transition: all 1s;
transition-animation-type: discrete;
}
#target.animated {
float: right;
Expand Down
42 changes: 42 additions & 0 deletions css/css-transitions/parsing/transition-behavior.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/8857">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<div id="target"></div>
<script>
test_valid_value('transition-animation-type', 'normal');
test_computed_value('transition-animation-type', 'normal');

test_valid_value('transition-animation-type', 'discrete');
test_computed_value('transition-animation-type', 'discrete');

test_valid_value('transition', 'discrete display', 'display 0s ease 0s discrete');
test_computed_value('transition', 'discrete display', 'display 0s ease 0s discrete');

test_valid_value('transition', 'discrete display 3s', 'display 3s ease 0s discrete');
test_computed_value('transition', 'discrete display 3s', 'display 3s ease 0s discrete');

test_valid_value('transition', 'discrete display 3s 1s', 'display 3s ease 1s discrete');
test_computed_value('transition', 'discrete display 3s 1s', 'display 3s ease 1s discrete');

test_valid_value('transition', 'discrete display 3s ease-in-out', 'display 3s ease-in-out 0s discrete');
test_computed_value('transition', 'discrete display 3s ease-in-out', 'display 3s ease-in-out 0s discrete');

test_valid_value('transition', 'discrete display 3s ease-in-out 1s', 'display 3s ease-in-out 1s discrete');
test_computed_value('transition', 'discrete display 3s ease-in-out 1s', 'display 3s ease-in-out 1s discrete');

test_invalid_value('transition', 'asdf display');
test_invalid_value('transition', 'display asdf');

test_valid_value('transition', 'display discrete 3s ease-in-out 1s', 'display 3s ease-in-out 1s discrete');
test_valid_value('transition', 'display 3s discrete ease-in-out 1s', 'display 3s ease-in-out 1s discrete');
test_valid_value('transition', 'display 3s ease-in-out discrete 1s', 'display 3s ease-in-out 1s discrete');
test_valid_value('transition', 'display 3s ease-in-out 1s discrete', 'display 3s ease-in-out 1s discrete');
test_computed_value('transition', 'display discrete 3s ease-in-out 1s', 'display 3s ease-in-out 1s discrete');
test_computed_value('transition', 'display 3s discrete ease-in-out 1s', 'display 3s ease-in-out 1s discrete');
test_computed_value('transition', 'display 3s ease-in-out discrete 1s', 'display 3s ease-in-out 1s discrete');
test_computed_value('transition', 'display 3s ease-in-out 1s discrete', 'display 3s ease-in-out 1s discrete');
</script>
9 changes: 6 additions & 3 deletions css/css-transitions/parsing/transition-shorthand.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@
'transition-property': 'top',
'transition-duration': '1s',
'transition-timing-function': 'cubic-bezier(0, -2, 1, 3)',
'transition-delay': '-3s'
'transition-delay': '-3s',
'transition-animation-type': 'normal'
});

test_shorthand_value('transition', '1s -3s, cubic-bezier(0, -2, 1, 3) top', {
'transition-property': 'all, top',
'transition-duration': '1s, 0s',
'transition-timing-function': 'ease, cubic-bezier(0, -2, 1, 3)',
'transition-delay': '-3s, 0s'
'transition-delay': '-3s, 0s',
'transition-animation-type': 'normal, normal'
});

test_shorthand_value('transition', 'cubic-bezier(0, -2, 1, 3) top, 1s -3s', {
'transition-property': 'top, all',
'transition-duration': '0s, 1s',
'transition-timing-function': 'cubic-bezier(0, -2, 1, 3), ease',
'transition-delay': '0s, -3s'
'transition-delay': '0s, -3s',
'transition-animation-type': 'normal, normal'
});
</script>
</body>
Expand Down

0 comments on commit 105759f

Please sign in to comment.