Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android' OR os == 'linux' OR os == 'win' && ccov OR os == 'win'
- Manifest: dom/canvas/test/chrome/chrome.toml
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for canvas drawWindow</title>
<script type="application/javascript" src="file_drawWindow_common.js"></script>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
window.addEventListener("load", openSourceWindow);
var sourceWindow;
function openSourceWindow(event) {
if (event.target != document) {
return;
}
// Add a little bottom padding to the window so that we don't capture the
// rounded corners at the bottom, which our GL drawing code on OS X draws
// for regular windows.
// (The reftest framework doesn't have this problem because it doesn't use
// a regular window with a titlebar, so there are no rounded corners.)
const WINDOW_INNER_WIDTH = CANVAS_WIDTH;
const WINDOW_INNER_HEIGHT = CANVAS_HEIGHT + 10;
// Need to open as a toplevel chrome window so that
// DRAWWINDOW_USE_WIDGET_LAYERS is honored.
sourceWindow = window.browsingContext.topChromeWindow.open("file_drawWindow_source.html", "",
`chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`);
SimpleTest.waitForFocus(runTests, sourceWindow);
}
async function runTests() {
var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D);
let snapshot = function(context, x, y, width, height, bg) {
var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS |
cxInterfaceWrap.DRAWWINDOW_DRAW_CARET |
cxInterfaceWrap.DRAWWINDOW_DRAW_VIEW;
context.drawWindow(sourceWindow, x, y, width, height, bg, flags);
}
await runDrawWindowTests(snapshot, true);
sourceWindow.close();
SimpleTest.finish();
}
</script>
</head>
<body>
</body>
</html>