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">
12 SimpleTest.waitForExplicitFinish();
13 window.addEventListener(
"load", openSourceWindow);
17 function openSourceWindow(event) {
18 if (event.target != document) {
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;
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);
37 async function runTests() {
38 var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D);
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);
46 await runDrawWindowTests(snapshot, true);
56 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug
</a>