File: style-inheritance.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (84 lines) | stat: -rw-r--r-- 5,360 bytes parent folder | download | duplicates (4)
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
<!DOCTYPE html>
<html class=paused>
<title>View transitions: ensure correct style inheritance for pseudo tree</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:khushalsagar@chromium.org">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
.paused::view-transition-group(*) {
  animation-play-state: paused;
}

::view-transition {
  background-color: red;
}

::view-transition-group(*) {
  background-color: inherit;
  color: blue;
  animation-duration: 0.321s;
  animation-delay: 0.05s;
  animation-iteration-count: 2;
  animation-direction: reverse;
  animation-timing-function: linear;
}

::view-transition-image-pair(*) {
  color: inherit;
  overflow-x: clip;
}

::view-transition-old(*), ::view-transition-new(*) {
  overflow-x: inherit;
}
</style>

<script>
promise_test(async () => {
  assert_implements(document.startViewTransition, "Missing document.startViewTransition");
  let transition = document.startViewTransition();
  await transition.ready;

  assert_equals(getComputedStyle(document.documentElement, "::view-transition").backgroundColor, "rgb(255, 0, 0)", "::view-transition");

  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").backgroundColor, "rgb(255, 0, 0)", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").color, "rgb(0, 0, 255)", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").animationDuration, "0.321s", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").animationDelay, "0.05s", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").animationTimingFunction, "linear", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").animationIterationCount, "2", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").animationDirection, "reverse", "group");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-group(root)").animationPlayState, "paused", "group");

  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").color, "rgb(0, 0, 255)", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").overflowX, "clip", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").animationDuration, "0.321s", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").animationDelay, "0.05s", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").animationTimingFunction, "linear", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").animationIterationCount, "2", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").animationDirection, "reverse", "wrapper");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-image-pair(root)").animationPlayState, "paused", "wrapper");

  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").overflowX, "clip", "outgoing");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").animationDuration, "0.321s", "outgoing");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").animationDelay, "0.05s", "outgoing");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").animationTimingFunction, "linear", "outgoing");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").animationIterationCount, "2", "outgoing");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").animationDirection, "reverse", "outgoing");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-old(root)").animationPlayState, "paused", "outgoing");

  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").overflowX, "clip", "incoming");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").animationDuration, "0.321s", "incoming");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").animationDelay, "0.05s", "incoming");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").animationTimingFunction, "linear", "incoming");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").animationIterationCount, "2", "incoming");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").animationDirection, "reverse", "incoming");
  assert_equals(getComputedStyle(document.documentElement, "::view-transition-new(root)").animationPlayState, "paused", "incoming");

  document.documentElement.classList.remove("paused");
  await transition.finished;
}, "style inheritance of pseudo elements");
</script>