| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="resources/text-based-repaint.js"></script> | |
| 3 <script> | |
| 4 function changePositionKeepingGeometry(id, newPosition) { | |
| 5 var target = document.getElementById(id); | |
| 6 var originalTop = target.offsetTop; | |
| 7 var originalLeft = target.offsetLeft; | |
| 8 target.style.position = newPosition; | |
| 9 target.style.top = originalTop + 'px'; | |
| 10 target.style.left = originalLeft + 'px'; | |
| 11 } | |
| 12 | |
| 13 function repaintTest() | |
| 14 { | |
| 15 changePositionKeepingGeometry('target1', 'absolute'); | |
| 16 changePositionKeepingGeometry('target2', 'absolute'); | |
| 17 changePositionKeepingGeometry('target3', 'fixed'); | |
| 18 } | |
| 19 onload = runRepaintTest; | |
| 20 </script> | |
| 21 <style> | 2 <style> |
| 22 body { | 3 body { |
| 23 margin: 0; | 4 margin: 0; |
| 24 } | 5 } |
| 25 div { | 6 div { |
| 26 width: 100px; | 7 width: 100px; |
| 27 height: 100px; | 8 height: 100px; |
| 28 top: 20px; | 9 top: 20px; |
| 29 background-color: blue; | 10 background-color: blue; |
| 30 } | 11 } |
| 31 #target0 { | 12 #target0 { |
| 32 left: 20px; | 13 left: 20px; |
| 33 position: relative; | 14 position: relative; |
| 34 } | 15 } |
| 35 #target1 { | 16 #target1 { |
| 36 left: 20px; | 17 left: 20px; |
| 37 position: relative; | 18 position: absolute; |
| 38 } | 19 } |
| 39 #target2 { | 20 #target2 { |
| 40 left: 220px; | 21 left: 220px; |
| 41 position: fixed; | 22 position: absolute; |
| 42 z-index: 0; | 23 z-index: 0; |
| 43 } | 24 } |
| 44 #target3 { | 25 #target3 { |
| 45 left: 420px; | 26 left: 420px; |
| 46 position: absolute; | 27 position: fixed; |
| 47 z-index: 0; | 28 z-index: 0; |
| 48 } | 29 } |
| 49 </style> | 30 </style> |
| 50 There should be no invalildations on change of position without actual change of
position and size. | 31 There should be no invalildations on change of position without actual change of
position and size. |
| 51 <!-- target0 ensures we don't strip anonymous wrappers (and trigger a layout) wh
en the other elements change position. --> | 32 <!-- target0 ensures we don't strip anonymous wrappers (and trigger a layout) wh
en the other elements change position. --> |
| 52 <div id="target0"></div> | 33 <div id="target0"></div> |
| 53 <div id="target1"></div> | 34 <div id="target1"></div> |
| 54 <div id="target2"></div> | 35 <div id="target2"></div> |
| 55 <div id="target3"></div> | 36 <div id="target3"></div> |
| 37 <script> |
| 38 target1.style.top = target0.offsetTop + target0.offsetHeight + 'px'; |
| 39 </script> |
| OLD | NEW |