Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <style> | |
| 3 .scroller { | |
| 4 overflow: scroll; | |
| 5 width: 200px; | |
| 6 height: 600px; | |
| 7 } | |
| 8 | |
| 9 .composited { | |
| 10 will-change: transform; | |
| 11 } | |
| 12 | |
| 13 .box { | |
| 14 background: rgba(0, 255, 0, 0.9); | |
| 15 position: sticky; | |
| 16 width: 100%; | |
| 17 height: 50px; | |
| 18 top: 0px; | |
| 19 } | |
| 20 | |
| 21 .container { | |
| 22 width: 100%; | |
| 23 height: 1000px; | |
| 24 background: grey; | |
| 25 } | |
| 26 | |
| 27 .spacer { | |
| 28 background: white; | |
| 29 height: 300px; | |
| 30 } | |
| 31 </style> | |
| 32 | |
| 33 <div id="scroller" class="scroller"> | |
| 34 <div class="composited container"> | |
| 35 <div id="box-need-invalidation" class="box"></div> | |
| 36 <div class="spacer"></div> | |
|
yigu
2017/04/27 15:20:10
If this spacer is not composited, e.g. we move it
| |
| 37 <div id="box-not-need-invalidation" class="box"></div> | |
| 38 </div> | |
| 39 </div> | |
| 40 | |
| 41 <script src="../resources/text-based-repaint.js"></script> | |
| 42 <script> | |
| 43 // The first box needs to be invalidated but the second sticky box | |
| 44 // does not as it hasn't passed the starting constraint yet. | |
| 45 function repaintTest() { | |
| 46 let scroller = document.getElementById('scroller'); | |
| 47 scroller.scrollTop = 200; | |
| 48 } | |
| 49 onload = runRepaintAndPixelTest; | |
| 50 </script> | |
| OLD | NEW |