| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 onload = function() { | 2 onload = function() { |
| 3 document.getElementById('scroller').scrollTo(0, 200); | 3 document.getElementById('scroller1').scrollTop = 200; |
| 4 document.getElementById('scroller2').scrollTop = 200; |
| 4 } | 5 } |
| 5 </script> | 6 </script> |
| 6 <style> | 7 <style> |
| 7 #scroller { | 8 .scroller { |
| 8 background: gray local content-box; | |
| 9 border: 10px solid rgba(0, 255, 0, 0.5); | 9 border: 10px solid rgba(0, 255, 0, 0.5); |
| 10 overflow: scroll; | 10 overflow: scroll; |
| 11 padding: 10px; | 11 padding: 10px; |
| 12 width: 200px; | 12 width: 200px; |
| 13 height: 200px; | 13 height: 200px; |
| 14 } | 14 } |
| 15 | 15 |
| 16 #scroller1 { |
| 17 background: gray local content-box; |
| 18 } |
| 19 |
| 20 #scroller2 { |
| 21 background: url('../resources/apple.jpg') local; |
| 22 } |
| 23 |
| 16 .spacer { | 24 .spacer { |
| 17 height: 300px; | 25 height: 300px; |
| 18 } | 26 } |
| 19 </style> | 27 </style> |
| 20 <!-- #scroller has a locally attached background with padding so when it is | 28 <!-- #scroller has a locally attached background with padding so when it is |
| 21 scrolled we can see the background slide up. Doing this on a composited | 29 scrolled we can see the background slide up. Doing this on a composited |
| 22 element without repainting requires the background to be painted into | 30 element without repainting requires the background to be painted into |
| 23 the scrolling contents layer and correctly account for that layer not | 31 the scrolling contents layer and correctly account for that layer not |
| 24 including the border in its bounds. --> | 32 including the border in its bounds. --> |
| 25 <div id="scroller"> | 33 <div id="scroller1" class="scroller"> |
| 26 <div class="spacer"></div> | 34 <div class="spacer"></div> |
| 27 </div> | 35 </div> |
| 36 <!-- This scroller has a locally attached background image which should |
| 37 scroll with the content. --> |
| 38 <div id="scroller2" class="scroller"> |
| 39 <div class="spacer"></div> |
| 40 </div> |
| OLD | NEW |