| 12
 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
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 
 | <!DOCTYPE html>
<meta charset="UTF-8">
<title>z-index interpolation</title>
<link rel="help" href="https://www.w3.org/TR/CSS2/visuren.html#z-index">
<meta name="assert" content="z-index supports animation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
body {
  margin-top: 20px;
}
.layer-reference {
  position: fixed;
  top: 0px;
  height: 100vh;
  width: 50px;
  background-color: rgba(255, 255, 255, 0.75);
  font-family: sans-serif;
  text-align: center;
  padding-top: 5px;
  border: 1px solid;
}
.parent {
  z-index: 15;
}
.target {
  position: relative;
  width: 350px;
  height: 10px;
  z-index: -2;
}
.actual {
  background-color: black;
}
.expected {
  background-color: green;
}
</style>
<body></body>
<script>
test_interpolation({
  property: 'z-index',
  from: neutralKeyframe,
  to: '5',
}, [
  {at: -0.3, expect: '-4'},
  {at: 0, expect: '-2'},
  {at: 0.3, expect: '0'},
  {at: 0.6, expect: '2'},
  {at: 1, expect: '5'},
  {at: 1.5, expect: '9'},
]);
test_no_interpolation({
  property: 'z-index',
  from: 'initial',
  to: '5',
});
// We fail to inherit correctly due to style overadjustment: crbug.com/375982
test_interpolation({
  property: 'z-index',
  from: 'inherit',
  to: '5',
}, [
  {at: -0.3, expect: '18'},
  {at: 0, expect: '15'},
  {at: 0.3, expect: '12'},
  {at: 0.6, expect: '9'},
  {at: 1, expect: '5'},
  {at: 1.5, expect: '0'},
]);
test_no_interpolation({
  property: 'z-index',
  from: 'unset',
  to: '5',
});
test_interpolation({
  property: 'z-index',
  from: '-5',
  to: '5'
}, [
  {at: -0.3, expect: '-8'},
  {at: 0, expect: '-5'},
  {at: 0.3, expect: '-2'},
  {at: 0.6, expect: '1'},
  {at: 1, expect: '5'},
  {at: 1.5, expect: '10'},
]);
test_interpolation({
  property: 'z-index',
  from: '2',
  to: '4'
}, [
  {at: -0.3, expect: '1'},
  {at: 0, expect: '2'},
  {at: 0.3, expect: '3'},
  {at: 0.6, expect: '3'},
  {at: 1, expect: '4'},
  {at: 1.5, expect: '5'},
]);
test_interpolation({
  property: 'z-index',
  from: '-2',
  to: '-4'
}, [
  {at: -0.3, expect: '-1'},
  {at: 0, expect: '-2'},
  {at: 0.1, expect: '-2'},
  {at: 0.3, expect: '-3'},
  {at: 0.6, expect: '-3'},
  {at: 1, expect: '-4'},
  {at: 1.5, expect: '-5'},
]);
test_no_interpolation({
  property: 'z-index',
  from: 'auto',
  to: '10',
});
</script>
 |