OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="resources/text-based-repaint.js"></script> |
| 3 <script> |
| 4 function highlightRange(id, start, end) { |
| 5 var frameWindow = document.getElementById('iframe').contentWindow; |
| 6 var range = frameWindow.document.createRange(); |
| 7 var elem = frameWindow.document.getElementById(id).firstChild; |
| 8 range.setStart(elem, start); |
| 9 range.setEnd(elem, end); |
| 10 frameWindow.internals.addTextMatchMarker(range, false); |
| 11 } |
| 12 |
| 13 function repaintTest() { |
| 14 document.getElementById('iframe').contentDocument.getElementById('to-be-change
d').textContent = 'After change'; |
| 15 } |
| 16 |
| 17 if (window.internals) { |
| 18 onload = function() { |
| 19 highlightRange('unchanged', 11, 17); |
| 20 highlightRange('to-be-changed', 15, 21); |
| 21 runRepaintTest(); |
| 22 }; |
| 23 } |
| 24 </script> |
| 25 Tests paint invalidation of the scrollbar (to repaint tickmarks) on document cha
nge when there are text match markers. |
| 26 Passes if the tickmarks are updated on document change.<br> |
| 27 <!-- Currently paint invalidation of main frame scrollbar is not tracked, |
| 28 so use a frame to show the invalidation of tickmarks. --> |
| 29 <iframe id="iframe" style="position: absolute; top: 100px; height: 400px" srcdoc
=" |
| 30 <div id='unchanged'> |
| 31 Unchanged: findme |
| 32 </div> |
| 33 <div id='to-be-changed' onclick='this.textContent=&quot;After change&q
uot;'> |
| 34 To be changed: findme (Manual testing: Find-in-page 'findme', then click her
e) |
| 35 </div> |
| 36 <div style='height: 1000px'><!-- To show the scrollbar --></div>"> |
| 37 </iframe> |
OLD | NEW |