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