OLD | NEW |
---|---|
1 <script> | 1 <script> |
2 if (window.testRunner) | 2 if (window.testRunner) |
3 testRunner.waitUntilDone(); | 3 testRunner.waitUntilDone(); |
4 onload = function() { | 4 onload = function() { |
5 // Double rAF to ensure content is painted before scroll. | 5 // Double rAF to ensure content is painted before scroll. |
chrishtr
2016/08/12 17:03:00
Add another test rather than modifying this one.
flackr
2016/08/16 17:52:51
Done.
| |
6 requestAnimationFrame(function() { | 6 requestAnimationFrame(function() { |
7 requestAnimationFrame(function() { | 7 requestAnimationFrame(function() { |
8 document.getElementById('scroller').scrollTo(0, 200); | 8 document.getElementById('scroller1').scrollTop = 200; |
9 document.getElementById('scroller2').scrollTop = 200; | |
9 if (window.testRunner) | 10 if (window.testRunner) |
10 window.testRunner.notifyDone(); | 11 window.testRunner.notifyDone(); |
11 }) | 12 }) |
12 }); | 13 }); |
13 } | 14 } |
14 </script> | 15 </script> |
15 <style> | 16 <style> |
16 #scroller { | 17 .scroller { |
17 background: gray local content-box; | |
18 border: 10px solid rgba(0, 255, 0, 0.5); | 18 border: 10px solid rgba(0, 255, 0, 0.5); |
19 overflow: scroll; | 19 overflow: scroll; |
20 padding: 10px; | 20 padding: 10px; |
21 width: 200px; | 21 width: 200px; |
22 height: 200px; | 22 height: 200px; |
23 will-change: transform; | 23 will-change: transform; |
24 } | 24 } |
25 | 25 |
26 #scroller1 { | |
27 background: gray local content-box; | |
28 } | |
29 | |
30 #scroller2 { | |
31 background: url('../resources/apple.jpg') local; | |
32 } | |
33 | |
26 .spacer { | 34 .spacer { |
27 height: 300px; | 35 height: 300px; |
28 } | 36 } |
29 </style> | 37 </style> |
30 <!-- #scroller has a locally attached background with padding so when it is | 38 <!-- #scroller has a locally attached background with padding so when it is |
31 scrolled we can see the background slide up. Doing this on a composited | 39 scrolled we can see the background slide up. Doing this on a composited |
32 element without repainting requires the background to be painted into | 40 element without repainting requires the background to be painted into |
33 the scrolling contents layer and correctly account for that layer not | 41 the scrolling contents layer and correctly account for that layer not |
34 including the border in its bounds. --> | 42 including the border in its bounds. --> |
35 <div id="scroller"> | 43 <div id="scroller1" class="scroller"> |
36 <div class="spacer"></div> | 44 <div class="spacer"></div> |
37 </div> | 45 </div> |
46 <!-- This scroller has a locally attached background image which should | |
47 scroll with the content. --> | |
48 <div id="scroller2" class="scroller"> | |
49 <div class="spacer"></div> | |
50 </div> | |
OLD | NEW |