OLD | NEW |
1 // Asynchronous tests should manually call finishRepaintTest at the appropriate
time. | 1 // Asynchronous tests should manually call finishRepaintTest at the appropriate
time. |
2 window.testIsAsync = false; | 2 window.testIsAsync = false; |
3 window.outputRepaintRects = true; | 3 window.outputRepaintRects = true; |
4 | 4 |
5 function runRepaintTest() | 5 function runRepaintTest() |
6 { | 6 { |
7 if (!window.testRunner || !window.internals) { | 7 if (!window.testRunner || !window.internals) { |
8 setTimeout(repaintTest, 100); | 8 setTimeout(repaintTest, 100); |
9 return; | 9 return; |
10 } | 10 } |
11 | 11 |
| 12 window.internals.settings.setForceCompositingMode(true); |
| 13 |
12 if (window.enablePixelTesting) | 14 if (window.enablePixelTesting) |
13 testRunner.dumpAsTextWithPixelResults(); | 15 testRunner.dumpAsTextWithPixelResults(); |
14 else | 16 else |
15 testRunner.dumpAsText(); | 17 testRunner.dumpAsText(); |
16 | 18 |
17 if (window.testIsAsync) | 19 if (window.testIsAsync) |
18 testRunner.waitUntilDone(); | 20 testRunner.waitUntilDone(); |
19 | 21 |
20 forceStyleRecalc(); | 22 forceStyleRecalc(); |
21 | 23 |
(...skipping 18 matching lines...) Expand all Loading... |
40 document.body.offsetTop; | 42 document.body.offsetTop; |
41 else if (document.documentElement) | 43 else if (document.documentElement) |
42 document.documentElement.offsetTop; | 44 document.documentElement.offsetTop; |
43 } | 45 } |
44 | 46 |
45 function finishRepaintTest() | 47 function finishRepaintTest() |
46 { | 48 { |
47 // Force a style recalc. | 49 // Force a style recalc. |
48 forceStyleRecalc(); | 50 forceStyleRecalc(); |
49 | 51 |
50 var repaintRects = window.internals.repaintRectsAsText(document); | 52 var repaintRects = window.internals.layerTreeAsText(document, window.interna
ls.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
51 | 53 |
52 internals.stopTrackingRepaints(document); | 54 internals.stopTrackingRepaints(document); |
53 | 55 |
54 if (window.outputRepaintRects) { | 56 if (window.outputRepaintRects) { |
55 if (document.body) { | 57 if (document.body) { |
56 var root = document.body; | 58 var root = document.body; |
57 } else if (document.documentElement) { | 59 } else if (document.documentElement) { |
58 var root = document.createElementNS('http://www.w3.org/2000/svg', 'f
oreignObject'); | 60 var root = document.createElementNS('http://www.w3.org/2000/svg', 'f
oreignObject'); |
59 document.documentElement.appendChild(root); | 61 document.documentElement.appendChild(root); |
60 } | 62 } |
61 var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'
); | 63 var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'
); |
62 // Make this element appear in text dumps, but try to avoid affecting | 64 // Make this element appear in text dumps, but try to avoid affecting |
63 // output pixels (being visible, creating overflow, &c). | 65 // output pixels (being visible, creating overflow, &c). |
64 pre.style.opacity = 0; | 66 pre.style.opacity = 0; |
65 pre.textContent += repaintRects; | 67 pre.textContent += repaintRects; |
66 root.appendChild(pre); | 68 root.appendChild(pre); |
67 } | 69 } |
68 | 70 |
69 if (window.afterTest) | 71 if (window.afterTest) |
70 window.afterTest(); | 72 window.afterTest(); |
71 | 73 |
72 if (window.testIsAsync) | 74 if (window.testIsAsync) |
73 testRunner.notifyDone(); | 75 testRunner.notifyDone(); |
74 } | 76 } |
OLD | NEW |