OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/testharness.js"></script> | |
3 <script src="../../../resources/testharnessreport.js"></script> | |
4 <style> | |
5 #c { | |
6 pointer-events: all; | |
7 } | |
8 #e { | |
9 visibility: collapse; | |
10 } | |
11 </style> | |
12 | |
13 <!-- The property is set on this outermost element. --> | |
14 <div id="a"> | |
15 <!-- Tests that the property is propagated through an element that inherits
it --> | |
16 <div id="b"> | |
17 <!-- Tests that the property stops propagating through an element that d
oesn't inherit it --> | |
18 <div id="c"> | |
19 <!-- The property is also set on this inner element, which inherited
it from its parent, and should now propagate down to #e and #f --> | |
20 <div id="d"> | |
21 <!-- The property is also set on this inner element, which inher
ited it from its parent but now sets it itself, and should now propagate to #f -
-> | |
22 <div id="e"> | |
23 <!-- Tests that the above properties resolve correctly and t
his inherits the value from #f --> | |
24 <div id="f"> | |
25 </div> | |
26 </div> | |
27 </div> | |
28 </div> | |
29 </div> | |
30 </div> | |
31 <script> | |
32 test(function(t) | |
33 { | |
34 if (!window.internals) | |
35 assert_unreached('This test requires window.internals.'); | |
36 | |
37 a.offsetTop; // Force recalc. | |
38 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0); | |
39 | |
40 assert_equals(getComputedStyle(a).pointerEvents, "auto"); | |
41 assert_equals(getComputedStyle(b).pointerEvents, "auto"); | |
42 assert_equals(getComputedStyle(c).pointerEvents, "all"); | |
43 assert_equals(getComputedStyle(d).pointerEvents, "all"); | |
44 assert_equals(getComputedStyle(e).pointerEvents, "all"); | |
45 assert_equals(getComputedStyle(f).pointerEvents, "all"); | |
46 assert_equals(getComputedStyle(a).visibility, "visible"); | |
47 assert_equals(getComputedStyle(b).visibility, "visible"); | |
48 assert_equals(getComputedStyle(c).visibility, "visible"); | |
49 assert_equals(getComputedStyle(d).visibility, "visible"); | |
50 assert_equals(getComputedStyle(e).visibility, "collapse"); | |
51 assert_equals(getComputedStyle(f).visibility, "collapse"); | |
52 | |
53 a.offsetTop; // Force recalc. | |
54 a.style.pointerEvents = "none"; | |
55 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
56 | |
57 a.offsetTop; // Force recalc. | |
58 a.style.visibility = "hidden"; | |
59 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
60 | |
61 assert_equals(getComputedStyle(a).pointerEvents, "none"); | |
62 assert_equals(getComputedStyle(b).pointerEvents, "none"); | |
63 assert_equals(getComputedStyle(c).pointerEvents, "all"); | |
64 assert_equals(getComputedStyle(d).pointerEvents, "all"); | |
65 assert_equals(getComputedStyle(e).pointerEvents, "all"); | |
66 assert_equals(getComputedStyle(f).pointerEvents, "all"); | |
67 assert_equals(getComputedStyle(a).visibility, "hidden"); | |
68 assert_equals(getComputedStyle(b).visibility, "hidden"); | |
69 assert_equals(getComputedStyle(c).visibility, "hidden"); | |
70 assert_equals(getComputedStyle(d).visibility, "hidden"); | |
71 assert_equals(getComputedStyle(e).visibility, "collapse"); | |
72 assert_equals(getComputedStyle(f).visibility, "collapse"); | |
73 | |
74 a.offsetTop; // Force recalc. | |
75 d.style.pointerEvents = "painted"; | |
76 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
77 | |
78 a.offsetTop; // Force recalc. | |
79 e.style.visibility = "visible"; | |
80 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
81 | |
82 assert_equals(getComputedStyle(a).pointerEvents, "none"); | |
83 assert_equals(getComputedStyle(b).pointerEvents, "none"); | |
84 assert_equals(getComputedStyle(c).pointerEvents, "all"); | |
85 assert_equals(getComputedStyle(d).pointerEvents, "painted"); | |
86 assert_equals(getComputedStyle(e).pointerEvents, "painted"); | |
87 assert_equals(getComputedStyle(f).pointerEvents, "painted"); | |
88 assert_equals(getComputedStyle(a).visibility, "hidden"); | |
89 assert_equals(getComputedStyle(b).visibility, "hidden"); | |
90 assert_equals(getComputedStyle(c).visibility, "hidden"); | |
91 assert_equals(getComputedStyle(d).visibility, "hidden"); | |
92 assert_equals(getComputedStyle(e).visibility, "visible"); | |
93 assert_equals(getComputedStyle(f).visibility, "visible"); | |
94 }, "Changing both pointer-events and visibility on an element, both independent
inherited properties, doesn't cause a style recalc for its children."); | |
95 </script> | |
OLD | NEW |