Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: LayoutTests/fast/repaint/resources/text-based-repaint.js

Issue 205263004: Convert svg repaint tests to pixel test only repaint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove fixedpos Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4
4 function runRepaintTest() 5 function runRepaintTest()
5 { 6 {
6 if (!window.testRunner || !window.internals) { 7 if (!window.testRunner || !window.internals) {
7 setTimeout(repaintTest, 100); 8 setTimeout(repaintTest, 100);
8 return; 9 return;
9 } 10 }
10 11
11 if (window.enablePixelTesting) 12 if (window.enablePixelTesting)
12 testRunner.dumpAsTextWithPixelResults(); 13 testRunner.dumpAsTextWithPixelResults();
13 else 14 else
14 testRunner.dumpAsText(); 15 testRunner.dumpAsText();
15 16
16 if (window.testIsAsync) 17 if (window.testIsAsync)
17 testRunner.waitUntilDone(); 18 testRunner.waitUntilDone();
18 19
19 forceStyleRecalc(); 20 forceStyleRecalc();
20 21
21 window.internals.startTrackingRepaints(document); 22 window.internals.startTrackingRepaints(document);
22 23
23 repaintTest(); 24 repaintTest();
24 25
25 if (!window.testIsAsync) 26 if (!window.testIsAsync)
26 finishRepaintTest(); 27 finishRepaintTest();
27 } 28 }
28 29
30 function runRepaintAndPixelTest()
31 {
32 window.enablePixelTesting = true;
33 window.outputRepaintRects = false;
34 runRepaintTest();
35 }
36
29 function forceStyleRecalc() 37 function forceStyleRecalc()
30 { 38 {
31 if (document.body) 39 if (document.body)
32 document.body.offsetTop; 40 document.body.offsetTop;
33 else if (document.documentElement) 41 else if (document.documentElement)
34 document.documentElement.offsetTop; 42 document.documentElement.offsetTop;
35 } 43 }
36 44
37 function finishRepaintTest() 45 function finishRepaintTest()
38 { 46 {
39 // Force a style recalc. 47 // Force a style recalc.
40 forceStyleRecalc(); 48 forceStyleRecalc();
41 49
42 var repaintRects = window.internals.repaintRectsAsText(document); 50 var repaintRects = window.internals.repaintRectsAsText(document);
43 51
44 internals.stopTrackingRepaints(document); 52 internals.stopTrackingRepaints(document);
45 53
46 var pre = document.createElement('pre'); 54 if (window.outputRepaintRects) {
47 pre.style.opacity = 0; // appear in text dumps, but not images 55 if (document.body) {
48 document.body.appendChild(pre); 56 var root = document.body;
49 pre.textContent += repaintRects; 57 } else if (document.documentElement) {
58 var root = document.createElementNS('http://www.w3.org/2000/svg', 'f oreignObject');
59 document.documentElement.appendChild(root);
60 }
61 var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre' );
62 // Make this element appear in text dumps, but try to avoid affecting
63 // output pixels (being visible, creating overflow, &c).
64 pre.style.opacity = 0;
65 pre.textContent += repaintRects;
66 root.appendChild(pre);
67 }
50 68
51 if (window.afterTest) 69 if (window.afterTest)
52 window.afterTest(); 70 window.afterTest();
53 71
54 if (window.testIsAsync) 72 if (window.testIsAsync)
55 testRunner.notifyDone(); 73 testRunner.notifyDone();
56 } 74 }
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/as-background-image/svg-background-partial-redraw.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698