test_drawWindow_widget_layers.html (2194B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test for canvas drawWindow</title> 6 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 7 <script src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script> 8 <script type="application/javascript" src="file_drawWindow_common.js"></script> 9 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> 10 <script type="application/javascript"> 11 12 SimpleTest.waitForExplicitFinish(); 13 window.addEventListener("load", openSourceWindow); 14 15 var sourceWindow; 16 17 function openSourceWindow(event) { 18 if (event.target != document) { 19 return; 20 } 21 22 // Add a little bottom padding to the window so that we don't capture the 23 // rounded corners at the bottom, which our GL drawing code on OS X draws 24 // for regular windows. 25 // (The reftest framework doesn't have this problem because it doesn't use 26 // a regular window with a titlebar, so there are no rounded corners.) 27 const WINDOW_INNER_WIDTH = CANVAS_WIDTH; 28 const WINDOW_INNER_HEIGHT = CANVAS_HEIGHT + 10; 29 30 // Need to open as a toplevel chrome window so that 31 // DRAWWINDOW_USE_WIDGET_LAYERS is honored. 32 sourceWindow = window.browsingContext.topChromeWindow.open("file_drawWindow_source.html", "", 33 `chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`); 34 SimpleTest.waitForFocus(runTests, sourceWindow); 35 } 36 37 async function runTests() { 38 var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D); 39 40 let snapshot = function(context, x, y, width, height, bg) { 41 var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS | 42 cxInterfaceWrap.DRAWWINDOW_DRAW_CARET | 43 cxInterfaceWrap.DRAWWINDOW_DRAW_VIEW; 44 context.drawWindow(sourceWindow, x, y, width, height, bg, flags); 45 } 46 await runDrawWindowTests(snapshot, true); 47 48 sourceWindow.close(); 49 50 SimpleTest.finish(); 51 } 52 53 </script> 54 </head> 55 <body> 56 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> 57 </body> 58 </html>