Bug 745681: Prepare the reftest harness for Bug 695480. r=dbaron a=test-only

This commit is contained in:
Kyle Huey 2012-04-23 13:36:50 -07:00
parent adad6bf7e4
commit 569fa9dcee

View File

@ -511,11 +511,16 @@ function OnDocumentLoad(event)
} }
var contentRootElement = currentDoc ? currentDoc.documentElement : null; var contentRootElement = currentDoc ? currentDoc.documentElement : null;
currentDoc = null;
setupZoom(contentRootElement); setupZoom(contentRootElement);
setupDisplayport(contentRootElement); setupDisplayport(contentRootElement);
var inPrintMode = false; var inPrintMode = false;
function AfterOnLoadScripts() { function AfterOnLoadScripts() {
// Regrab the root element, because the document may have changed.
var contentRootElement =
content.document ? content.document.documentElement : null;
// Take a snapshot now. We need to do this before we check whether // Take a snapshot now. We need to do this before we check whether
// we should wait, since this might trigger dispatching of // we should wait, since this might trigger dispatching of
// MozPaintWait events and make shouldWaitForExplicitPaintWaiters() true // MozPaintWait events and make shouldWaitForExplicitPaintWaiters() true
@ -671,7 +676,6 @@ function LogInfo(str)
const SYNC_DEFAULT = 0x0; const SYNC_DEFAULT = 0x0;
const SYNC_ALLOW_DISABLE = 0x1; const SYNC_ALLOW_DISABLE = 0x1;
var gDummyCanvas = null;
function SynchronizeForSnapshot(flags) function SynchronizeForSnapshot(flags)
{ {
if (flags & SYNC_ALLOW_DISABLE) { if (flags & SYNC_ALLOW_DISABLE) {
@ -682,13 +686,11 @@ function SynchronizeForSnapshot(flags)
} }
} }
if (gDummyCanvas == null) { var dummyCanvas = content.document.createElementNS(XHTML_NS, "canvas");
gDummyCanvas = content.document.createElementNS(XHTML_NS, "canvas"); dummyCanvas.setAttribute("width", 1);
gDummyCanvas.setAttribute("width", 1); dummyCanvas.setAttribute("height", 1);
gDummyCanvas.setAttribute("height", 1);
}
var ctx = gDummyCanvas.getContext("2d"); var ctx = dummyCanvas.getContext("2d");
var flags = ctx.DRAWWINDOW_DRAW_CARET | ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_USE_WIDGET_LAYERS; var flags = ctx.DRAWWINDOW_DRAW_CARET | ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_USE_WIDGET_LAYERS;
ctx.drawWindow(content, 0, 0, 1, 1, "rgb(255,255,255)", flags); ctx.drawWindow(content, 0, 0, 1, 1, "rgb(255,255,255)", flags);
} }