Bug 876626 - Always redraw the entire reftest canvas for async animations tests. r=roc

This commit is contained in:
Matt Woodrow 2013-06-18 19:59:46 +12:00
parent 7b9d5b3e53
commit ac3c3cd458
3 changed files with 45 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="reftest-wait">
<html class="reftest-wait reftest-snapshot-all">
<head>
<style type="text/css">
input {
@ -31,7 +31,7 @@
}
i.removeEventListener("transitionend", arguments.callee, true);
i.getClientRects();
document.documentElement.removeAttribute("class");
document.documentElement.setAttribute("class", "reftest-snapshot-all");
}, true);
i.blur();
i.getClientRects();

View File

@ -241,6 +241,14 @@ function shouldWaitForReftestWaitRemoval(contentRootElement) {
.indexOf("reftest-wait") != -1;
}
function shouldSnapshotWholePage(contentRootElement) {
// use getAttribute because className works differently in HTML and SVG
return contentRootElement &&
contentRootElement.hasAttribute('class') &&
contentRootElement.getAttribute('class').split(/\s+/)
.indexOf("reftest-snapshot-all") != -1;
}
function getNoPaintElements(contentRootElement) {
return contentRootElement.getElementsByClassName('reftest-no-paint');
}
@ -306,7 +314,7 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) {
return;
}
SendUpdateCanvasForEvent(event);
SendUpdateCanvasForEvent(event, contentRootElement);
// These events are fired immediately after a paint. Don't
// confuse ourselves by firing synchronously if we triggered the
// paint ourselves.
@ -840,12 +848,24 @@ function roundTo(x, fraction)
return Math.round(x/fraction)*fraction;
}
function SendUpdateCanvasForEvent(event)
function SendUpdateCanvasForEvent(event, contentRootElement)
{
var win = content;
var scale = markupDocumentViewer().fullZoom;
var rects = [ ];
if (shouldSnapshotWholePage) {
// See comments in SendInitCanvasWithSnapshot() re: the split
// logic here.
if (!gBrowserIsRemote) {
sendSyncMessage("reftest:UpdateWholeCanvasForInvalidation");
} else {
SynchronizeForSnapshot(SYNC_ALLOW_DISABLE);
sendAsyncMessage("reftest:UpdateWholeCanvasForInvalidation");
}
return;
}
var rectList = event.clientRects;
LogInfo("SendUpdateCanvasForEvent with " + rectList.length + " rects");
for (var i = 0; i < rectList.length; ++i) {

View File

@ -1392,6 +1392,18 @@ function UpdateCurrentCanvasForInvalidation(rects)
}
}
function UpdateWholeCurrentCanvasForInvalidation()
{
LogInfo("Updating entire canvas for invalidation");
if (!gCurrentCanvas) {
return;
}
var ctx = gCurrentCanvas.getContext("2d");
DoDrawWindow(ctx, 0, 0, gCurrentCanvas.width, gCurrentCanvas.height);
}
function RecordResult(testRunTime, errorMsg, scriptResults)
{
LogInfo("RecordResult fired");
@ -1790,6 +1802,10 @@ function RegisterMessageListenersAndLoadContentScript()
"reftest:UpdateCanvasForInvalidation",
function (m) { RecvUpdateCanvasForInvalidation(m.json.rects); }
);
gBrowserMessageManager.addMessageListener(
"reftest:UpdateWholeCanvasForInvalidation",
function (m) { RecvUpdateWholeCanvasForInvalidation(); }
);
gBrowserMessageManager.addMessageListener(
"reftest:ExpectProcessCrash",
function (m) { RecvExpectProcessCrash(); }
@ -1870,6 +1886,11 @@ function RecvUpdateCanvasForInvalidation(rects)
UpdateCurrentCanvasForInvalidation(rects);
}
function RecvUpdateWholeCanvasForInvalidation()
{
UpdateWholeCurrentCanvasForInvalidation();
}
function OnProcessCrashed(subject, topic, data)
{
var id;