aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/css/css-logical
diff options
context:
space:
mode:
authorWPT Sync Bot <josh+wptsync@joshmatthews.net>2018-07-19 21:07:28 -0400
committerWPT Sync Bot <josh+wptsync@joshmatthews.net>2018-07-19 22:44:23 -0400
commit158f7eec0eb23882a3ee56144c2dba24f0a14f72 (patch)
tree88351345304208969bab3c3a80dadf5028623f1c /tests/wpt/web-platform-tests/css/css-logical
parent908a642063fc5b024b19e732636165c2cb82c00a (diff)
downloadservo-158f7eec0eb23882a3ee56144c2dba24f0a14f72.tar.gz
servo-158f7eec0eb23882a3ee56144c2dba24f0a14f72.zip
Update web-platform-tests to revision abd18b3e018d25ed668d179c905b7869dca5e239
Diffstat (limited to 'tests/wpt/web-platform-tests/css/css-logical')
-rw-r--r--tests/wpt/web-platform-tests/css/css-logical/animation-001.html323
-rw-r--r--tests/wpt/web-platform-tests/css/css-logical/animation-002.html213
-rw-r--r--tests/wpt/web-platform-tests/css/css-logical/animation-003.tenative.html37
3 files changed, 573 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/css/css-logical/animation-001.html b/tests/wpt/web-platform-tests/css/css-logical/animation-001.html
new file mode 100644
index 00000000000..8135f43275b
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-logical/animation-001.html
@@ -0,0 +1,323 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Animating CSS logical properties using Web Animations</title>
+<link rel="help" href="https://drafts.csswg.org/css-logical/#box">
+<meta name="assert" content="The specified values of these properties are separate from the specified values of the parallel physical properties, but the flow-relative and physical properties share computed values.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../css-animations/support/testcommon.js"></script>
+<style>
+:root {
+ --200px: 200px;
+ --300px: 300px;
+ --writingMode: horizontal-tb;
+}
+</style>
+
+<div id="log"></div>
+<script>
+'use strict';
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '50px');
+}, 'Logical properties can be animated using object notation');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ [{ blockSize: '0px' }, { blockSize: '100px' }],
+ 1000
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '50px');
+}, 'Logical properties can be animated using array notation');
+
+test(t => {
+ const anim = addDiv(t).animate({ blockSize: ['0px', '100px'] }, 1000);
+ assert_equals(anim.effect.getKeyframes().length, 2);
+
+ assert_own_property(anim.effect.getKeyframes()[0], 'blockSize');
+ assert_false(anim.effect.getKeyframes()[0].hasOwnProperty('height'));
+
+ assert_own_property(anim.effect.getKeyframes()[1], 'blockSize');
+ assert_false(anim.effect.getKeyframes()[1].hasOwnProperty('height'));
+}, 'Logical properties are NOT stored as physical properties');
+
+test(t => {
+ const div = addDiv(t, { style: 'writing-mode: vertical-rl' });
+ const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Logical properties in animations respect the writing-mode');
+
+test(t => {
+ const div = addDiv(t, { style: 'direction: rtl' });
+ const anim = div.animate({ marginInlineStart: ['0px', '100px'] }, 1000);
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).marginLeft, '0px');
+ assert_equals(getComputedStyle(div).marginRight, '50px');
+}, 'Logical properties in animations respect the direction');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ blockSize: ['0px', '100px'],
+ height: ['200px', '300px'],
+ },
+ 1000
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Physical properties win over logical properties in object notation');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ [
+ { height: '200px', blockSize: '0px' },
+ { height: '300px', blockSize: '100px' },
+ ],
+ 1000
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Physical properties win over logical properties in array notation');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ blockSize: ['0px', '100px'],
+ height: ['var(--200px)', 'var(--300px)'],
+ },
+ 1000
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Physical properties with variables win over logical properties');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ marginInlineStart: '100px',
+ marginInline: '200px',
+ margin: 'logical 300px',
+ },
+ { duration: 1, easing: 'step-start' }
+ );
+ assert_equals(getComputedStyle(div).marginLeft, '100px');
+ assert_equals(getComputedStyle(div).marginRight, '200px');
+ assert_equals(getComputedStyle(div).marginTop, '300px');
+ assert_equals(getComputedStyle(div).marginBottom, '300px');
+}, 'Logical shorthands follow the usual prioritization based on number of'
+ + ' component longhands');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ marginInline: '100px',
+ marginLeft: '200px',
+ },
+ { duration: 1, easing: 'step-start' }
+ );
+ assert_equals(getComputedStyle(div).marginLeft, '200px');
+ assert_equals(getComputedStyle(div).marginRight, '100px');
+}, 'Physical longhands win over logical shorthands');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ marginInlineStart: '100px',
+ margin: '200px',
+ },
+ { duration: 1, easing: 'step-start' }
+ );
+ assert_equals(getComputedStyle(div).marginLeft, '100px');
+ assert_equals(getComputedStyle(div).marginRight, '200px');
+}, 'Logical longhands win over physical shorthands');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ marginInline: '100px',
+ margin: '200px',
+ },
+ { duration: 1, easing: 'step-start' }
+ );
+ assert_equals(getComputedStyle(div).marginLeft, '200px');
+ assert_equals(getComputedStyle(div).marginRight, '200px');
+}, 'Physical shorthands win over logical shorthands');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ {
+ marginInline: '100px',
+ margin: 'var(--200px)',
+ },
+ { duration: 1, easing: 'step-start' }
+ );
+ assert_equals(getComputedStyle(div).marginLeft, '200px');
+ assert_equals(getComputedStyle(div).marginRight, '200px');
+}, 'Physical shorthands using variables win over logical shorthands');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate([{ blockSize: '200px' }, { height: '300px' }], 1000);
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Physical properties and logical properties can be mixed');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ [{ marginInline: '200px' }, { marginRight: '300px' }],
+ 1000
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).marginRight, '250px');
+}, 'Physical shorthands and logical shorthands can be mixed');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ [{ blockSize: '100px', height: '200px' }, { height: '300px' }],
+ 1000
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Physical properties win over logical properties even when some keyframes'
+ + ' only have logical properties');
+
+test(t => {
+ const div = addDiv(t, { style: 'width: 0px; height: 0px' });
+ const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
+ anim.currentTime = 500;
+
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '50px');
+
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Animations update when the writing-mode is changed');
+
+test(t => {
+ const div = addDiv(t, { style: 'width: 0px; height: 0px' });
+ const anim = div.animate(
+ { blockSize: ['0px', '100px'] },
+ {
+ duration: 1000,
+ fill: 'forwards',
+ }
+ );
+ anim.finish();
+
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '100px');
+
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '100px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Filling animations update when the writing-mode is changed');
+
+test(t => {
+ const div = addDiv(t, { style: 'width: 100px; height: 200px' });
+ const anim = div.animate({ blockSize: '300px' }, 1000);
+ anim.currentTime = 500;
+
+ // Initially we are animating height from 200px -> 300px
+ assert_equals(getComputedStyle(div).width, '100px');
+ assert_equals(getComputedStyle(div).height, '250px');
+
+ // After the change we are animating width from 100px -> 300px
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '200px');
+ assert_equals(getComputedStyle(div).height, '200px');
+}, 'Animations with implicit from values update when the writing-mode'
+ + ' is changed');
+
+test(t => {
+ const div = addDiv(t, { style: 'width: 0px; height: 0px' });
+ const anim = div.animate(
+ [
+ { height: '200px', blockSize: '0px' },
+ { height: '300px', blockSize: '100px' },
+ ],
+ 1000
+ );
+ anim.currentTime = 500;
+
+ // Initially writing-mode is horizontal-tb so the 'block-size' values are
+ // clobbered by the 'height' values.
+
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '250px');
+
+ // After updating the writing-mode to vertical-rl the 'block-size' values
+ // should no longer be overridden and should apply to the height.
+
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Animations with overlapping physical and logical properties update'
+ + ' when the writing-mode is changed');
+
+test(t => {
+ const div = addDiv(t, { style: 'width: 0px; height: 0px' });
+ div.style.writingMode = 'var(--writingMode)';
+ const anim = div.animate({ blockSize: ['0px', '100px'] }, 1000);
+ anim.currentTime = 500;
+
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '50px');
+
+ div.style.setProperty('--writingMode', 'vertical-rl');
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Animations update when the writing-mode is changed through a CSS variable');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate({ marginInlineStart: ['0px', '100px'] }, 1000);
+ anim.currentTime = 500;
+
+ assert_equals(getComputedStyle(div).marginLeft, '50px');
+ assert_equals(getComputedStyle(div).marginRight, '0px');
+
+ div.style.direction = 'rtl';
+ assert_equals(getComputedStyle(div).marginLeft, '0px');
+ assert_equals(getComputedStyle(div).marginRight, '50px');
+}, 'Animations update when the direction is changed');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ { writingMode: 'vertical-rl' },
+ { duration: 1, easing: 'step-start' }
+ );
+ assert_equals(getComputedStyle(div).writingMode, 'horizontal-tb');
+ assert_equals(anim.effect.getKeyframes().length, 0);
+}, 'writing-mode is not animatable');
+
+test(t => {
+ const div = addDiv(t);
+ const anim = div.animate(
+ { writingMode: 'rtl' },
+ { duration: 1, easing: 'step-start' }
+ );
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(div).direction, 'ltr');
+ assert_equals(anim.effect.getKeyframes().length, 0);
+}, 'direction is not animatable');
+
+</script>
diff --git a/tests/wpt/web-platform-tests/css/css-logical/animation-002.html b/tests/wpt/web-platform-tests/css/css-logical/animation-002.html
new file mode 100644
index 00000000000..d4f199d50e4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-logical/animation-002.html
@@ -0,0 +1,213 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Animating CSS logical properties using CSS Animations</title>
+<link rel="help" href="https://drafts.csswg.org/css-logical/#box">
+<meta name="assert" content="The specified values of these properties are separate from the specified values of the parallel physical properties, but the flow-relative and physical properties share computed values.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../css-animations/support/testcommon.js"></script>
+
+<div id="log"></div>
+<script>
+'use strict';
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
+ });
+ const div = addDiv(t, { style: 'animation: anim 10s -5s paused linear' });
+ assert_equals(getComputedStyle(div).height, '50px');
+}, 'Logical properties can be animated');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear; writing-mode: vertical-rl',
+ });
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Logical properties in animations respect the writing-mode');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim':
+ 'from { margin-inline-start: 0px } to { margin-inline-start: 100px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear; direction: rtl',
+ });
+ assert_equals(getComputedStyle(div).marginLeft, '0px');
+ assert_equals(getComputedStyle(div).marginRight, '50px');
+}, 'Logical properties in animations respect the direction');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim':
+ 'from { block-size: 0px; height: 200px }'
+ + ' to { block-size: 100px; height: 300px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear',
+ });
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Declaration order is respected within @keyframes declaration blocks');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim':
+ 'to { margin-top: 200px;'
+ + ' margin-block-start: 100px }'
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s paused step-start',
+ });
+ assert_equals(getComputedStyle(div).marginTop, '100px');
+}, 'Logical properties are able to override physical properties in'
+ + ' @keyframes declaration blocks');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim':
+ 'to {'
+ + ' margin-inline: 200px;'
+ + ' margin-inline-start: 0px;'
+ + ' margin-inline-start: 100px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s paused step-start',
+ });
+ assert_equals(getComputedStyle(div).marginLeft, '100px');
+}, 'Declaration order is respected amongst logical properties within'
+ + ' @keyframes declaration blocks');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 200px } to { height: 300px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear',
+ });
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Physical properties and logical properties can be mixed');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim':
+ 'from { height: 100px; block-size: 200px }'
+ + ' to { block-size: 100px; height: 300px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear',
+ });
+ assert_equals(getComputedStyle(div).height, '250px');
+}, 'Declaration order is respected on each keyframe individually');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear; width: 0px; height: 0px',
+ });
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '50px');
+
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Animations update when the writing-mode is changed');
+
+promise_test(async t => {
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -9.9s linear forwards;'
+ + ' width: 0px; height: 0px',
+ });
+ const watcher = new EventWatcher(t, div, [ 'animationend' ]);
+ await watcher.wait_for('animationend');
+
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '100px');
+
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '100px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Filling animations update when the writing-mode is changed');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'to { block-size: 100px; height: 200px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear; width: 0px; height: 0px',
+ });
+ // Initially we are interpolating the height from 0 to 200px
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '100px');
+
+ // But once we change the writing-mode, we will be interpolating *both*
+ // the height (from 0px to 200px) *and* the width (from 0px to 100px).
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '100px');
+}, 'The number of interpolating properties can be increased when the'
+ + ' writing-mode is changed');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'to { width: 300px; block-size: 200px }',
+ });
+ const div = addDiv(t, {
+ style: 'animation: anim 10s -5s paused linear; width: 100px; height: 100px',
+ });
+ // Initially we are interpolating the width (100px -> 300px) and the height
+ // (100px -> 200px).
+ assert_equals(getComputedStyle(div).width, '200px');
+ assert_equals(getComputedStyle(div).height, '150px');
+
+ // Once we change the writing-mode, we will be interpolating *only* the
+ // width (100px -> 200px).
+ div.style.writingMode = 'vertical-rl';
+ assert_equals(getComputedStyle(div).width, '150px');
+ assert_equals(getComputedStyle(div).height, '100px');
+}, 'The number of interpolating properties can be decreased when the'
+ + ' writing-mode is changed');
+
+test(t => {
+ addStyle(t, { ':root': '--writingMode: horizontal-tb' });
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
+ });
+ const div = addDiv(t, {
+ style:
+ 'animation: anim 10s -5s paused linear;'
+ + ' width: 0px; height: 0px;'
+ + ' writing-mode: var(--writingMode)'
+ });
+ assert_equals(getComputedStyle(div).width, '0px');
+ assert_equals(getComputedStyle(div).height, '50px');
+
+ div.style.setProperty('--writingMode', 'vertical-rl');
+ assert_equals(getComputedStyle(div).width, '50px');
+ assert_equals(getComputedStyle(div).height, '0px');
+}, 'Animations update when the writing-mode is changed through a CSS variable');
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim':
+ 'from { margin-inline-start: 0px } to { margin-inline-start: 100px }',
+ });
+ const div = addDiv(t, { style: 'animation: anim 10s -5s paused linear' });
+ assert_equals(getComputedStyle(div).marginLeft, '50px');
+ assert_equals(getComputedStyle(div).marginRight, '0px');
+
+ div.style.direction = 'rtl';
+ assert_equals(getComputedStyle(div).marginLeft, '0px');
+ assert_equals(getComputedStyle(div).marginRight, '50px');
+}, 'Animations update when the direction is changed');
+
+</script>
diff --git a/tests/wpt/web-platform-tests/css/css-logical/animation-003.tenative.html b/tests/wpt/web-platform-tests/css/css-logical/animation-003.tenative.html
new file mode 100644
index 00000000000..bcb4e15d80c
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-logical/animation-003.tenative.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Animating CSS logical properties using CSS Animations - Web Animations reflection</title>
+<link rel="help" href="https://drafts.csswg.org/css-logical/#box">
+<meta name="assert" content="The specified values of these properties are separate from the specified values of the parallel physical properties, but the flow-relative and physical properties share computed values.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../css-animations/support/testcommon.js"></script>
+
+<div id="log"></div>
+<script>
+'use strict';
+
+/*
+ * The mapping from CSS Animations to Web Animations has yet to be specified
+ * but, when it is, we expect it to require that logical properties in CSS
+ * keyframes be represented as physical properties in the result returned from
+ * getKeyframes() since this is consistent with the behavior of expanding out
+ * all shorthands in to their consituent longhands in order to resolve
+ * overlapping properties.
+ */
+
+test(t => {
+ addStyle(t, {
+ '@keyframes anim': 'from { block-size: 0px } to { block-size: 100px }',
+ });
+ const div = addDiv(t, { style: 'animation: anim 10s' });
+ const anim = div.getAnimations()[0];
+
+ assert_own_property(anim.effect.getKeyframes()[0], 'height');
+ assert_false(anim.effect.getKeyframes()[0].hasOwnProperty('blockSize'));
+
+ assert_own_property(anim.effect.getKeyframes()[1], 'height');
+ assert_false(anim.effect.getKeyframes()[1].hasOwnProperty('blockSize'));
+}, 'Logical properties are represented as physical properties in keyframes');
+
+</script>