File: offset-path-composition.html

package info (click to toggle)
thunderbird 1%3A91.12.0-1~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,008,300 kB
  • sloc: cpp: 6,084,052; javascript: 4,790,441; ansic: 3,341,486; python: 862,958; asm: 366,542; xml: 204,277; java: 152,477; sh: 111,376; makefile: 21,388; perl: 15,312; yacc: 4,583; objc: 3,026; lex: 1,720; exp: 762; pascal: 635; awk: 564; sql: 453; php: 436; lisp: 432; ruby: 99; sed: 69; csh: 45
file content (120 lines) | stat: -rw-r--r-- 4,200 bytes parent folder | download | duplicates (27)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<meta charset="utf-8">
<title>offset-distance composition</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-distance-property">
<meta name="assert" content="offset-distance supports animation.">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>

<body>
<script>
// TODO(ericwilligers) Support additive animation for path strings crbug.com/699308

// Ray paths compose.
test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg sides)',
  addFrom: 'ray(10deg sides)',
  addTo: 'ray(20deg sides)',
}, [
  {at: -0.3, expect: 'ray(27deg sides)'},
  {at: 0, expect: 'ray(30deg sides)'},
  {at: 0.3, expect: 'ray(33deg sides)'},
  {at: 0.6, expect: 'ray(36deg sides)'},
  {at: 1, expect: 'ray(40deg sides)'},
  {at: 1.5, expect: 'ray(45deg sides)'},
]);

// Ray paths without contain don't compose with underlying contain.
test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg closest-corner contain)',
  addFrom: 'ray(10deg closest-corner)',
  addTo: 'ray(20deg closest-corner)',
}, [
  {at: -0.3, expect: 'ray(7deg closest-corner)'},
  {at: 0, expect: 'ray(10deg closest-corner)'},
  {at: 0.3, expect: 'ray(13deg closest-corner)'},
  {at: 0.6, expect: 'ray(16deg closest-corner)'},
  {at: 1, expect: 'ray(20deg closest-corner)'},
  {at: 1.5, expect: 'ray(25deg closest-corner)'},
]);

// Ray paths don't compose when underlying has different size.
test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg closest-side)',
  addFrom: 'ray(10deg closest-corner)',
  addTo: 'ray(20deg closest-corner)',
}, [
  {at: -0.3, expect: 'ray(7deg closest-corner)'},
  {at: 0, expect: 'ray(10deg closest-corner)'},
  {at: 0.3, expect: 'ray(13deg closest-corner)'},
  {at: 0.6, expect: 'ray(16deg closest-corner)'},
  {at: 1, expect: 'ray(20deg closest-corner)'},
  {at: 1.5, expect: 'ray(25deg closest-corner)'},
]);

// Ray contain paths compose with underlying contain.
test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg farthest-side contain)',
  addFrom: 'ray(190deg farthest-side contain)',
  addTo: 'ray(20deg farthest-side contain)',
}, [
  {at: -0.3, expect: 'ray(261deg farthest-side contain)'},
  {at: 0, expect: 'ray(210deg farthest-side contain)'},
  {at: 0.3, expect: 'ray(159deg farthest-side contain)'},
  {at: 0.6, expect: 'ray(108deg farthest-side contain)'},
  {at: 1, expect: 'ray(40deg farthest-side contain)'},
  {at: 1.5, expect: 'ray(-45deg farthest-side contain)'},
]);

// When we can't interpolate, we can't compose.
test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg farthest-corner)',
  addFrom: 'ray(190deg farthest-corner contain)',
  addTo: 'ray(20deg farthest-corner)',
}, [
  {at: -0.3, expect: 'ray(190deg farthest-corner contain)'},
  {at: 0, expect: 'ray(190deg farthest-corner contain)'},
  {at: 0.3, expect: 'ray(190deg farthest-corner contain)'},
  {at: 0.6, expect: 'ray(40deg farthest-corner)'},
  {at: 1, expect: 'ray(40deg farthest-corner)'},
  {at: 1.5, expect: 'ray(40deg farthest-corner)'},
]);

test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg sides)',
  replaceFrom: 'ray(190deg sides contain)',
  addTo: 'ray(20deg sides)',
}, [
  {at: -0.3, expect: 'ray(190deg sides contain)'},
  {at: 0, expect: 'ray(190deg sides contain)'},
  {at: 0.3, expect: 'ray(190deg sides contain)'},
  {at: 0.6, expect: 'ray(40deg sides)'},
  {at: 1, expect: 'ray(40deg sides)'},
  {at: 1.5, expect: 'ray(40deg sides)'},
]);

// Ray paths compose with underlying.
test_composition({
  property: 'offset-path',
  underlying: 'ray(20deg closest-side)',
  addFrom: 'ray(10deg closest-side)',
  replaceTo: 'ray(10deg closest-side)',
}, [
  {at: -0.3, expect: 'ray(36deg closest-side)'},
  {at: 0, expect: 'ray(30deg closest-side)'},
  {at: 0.3, expect: 'ray(24deg closest-side)'},
  {at: 0.6, expect: 'ray(18deg closest-side)'},
  {at: 1, expect: 'ray(10deg closest-side)'},
  {at: 1.5, expect: 'ray(0deg closest-side)'},
]);
</script>
</body>