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