OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 #container { | 5 #container { |
6 will-change: top; | 6 will-change: top; |
7 position: absolute; | 7 position: absolute; |
8 left: 200px; | 8 left: 200px; |
9 top: 100px; | 9 top: 100px; |
10 width: 100px; | 10 width: 100px; |
11 height: 100px; | 11 height: 100px; |
12 background-color: blue; | 12 background-color: blue; |
13 } | 13 } |
14 | 14 |
15 .fixed { | 15 .fixed { |
16 position: fixed; | 16 position: fixed; |
17 left: 50px; | 17 left: 50px; |
18 top: 50px; | 18 top: 50px; |
19 width: 75px; | 19 width: 75px; |
20 height: 75px; | 20 height: 75px; |
21 background-color: green | 21 background-color: green |
22 } | 22 } |
23 </style> | 23 </style> |
24 <script type="text/javascript"> | 24 <script src="../../fast/repaint/resources/text-based-repaint.js"></script> |
25 if (window.testRunner) { | 25 <script> |
26 testRunner.waitUntilDone(); | 26 function repaintTest() |
27 } | |
28 | |
29 function doTest() | |
30 { | 27 { |
31 if (window.internals) { | |
32 window.internals.forceCompositingUpdate(document); | |
33 } | |
34 // Adding "will-change: -webkit-transform" to the container div should | 28 // Adding "will-change: -webkit-transform" to the container div should |
35 // make this div become the containing block for its fixed position | 29 // make this div become the containing block for its fixed position |
36 // descendant. | 30 // descendant. |
37 document.getElementById("container").style.willChange = "-webkit-transform "; | 31 document.getElementById("container").style.transform = 'translateZ(0)'; // willChange = "transform"; |
chrishtr
2015/10/30 18:28:18
It's not possible to set willChange directly?
Xianzhu
2015/10/30 19:15:28
Oops, I forgot to revert a temporary local change
| |
38 if (window.testRunner) { | |
39 testRunner.notifyDone(); | |
40 } | |
41 } | 32 } |
42 | 33 onload = runRepaintAndPixelTest; |
43 window.addEventListener('load', doTest, false); | |
44 </script> | 34 </script> |
45 </head> | 35 </head> |
46 | 36 |
47 <body> | 37 <body> |
48 <div id="container"> | 38 <div id="container"> |
49 <div class="fixed"></div> | 39 <div class="fixed"></div> |
50 </div> | 40 </div> |
51 </body> | 41 </body> |
52 | 42 |
53 </html> | 43 </html> |
OLD | NEW |