Bug 1146626 - Refresh the reftest snapshot after adjusting the async scroll offsets. r=roc

This commit is contained in:
Markus Stange 2015-03-25 22:35:57 -04:00
Родитель 3b1eafd81a
Коммит d72114bc33
1 изменённых файлов: 22 добавлений и 8 удалений

Просмотреть файл

@ -242,12 +242,13 @@ function setupDisplayport(contentRootElement) {
}
}
// Returns whether any offsets were updated
function setupAsyncScrollOffsets(options) {
var currentDoc = content.document;
var contentRootElement = currentDoc ? currentDoc.documentElement : null;
if (!contentRootElement) {
return;
return false;
}
function setupAsyncScrollOffsetsForElement(element, winUtils) {
@ -258,30 +259,38 @@ function setupAsyncScrollOffsets(options) {
// This might fail when called from RecordResult since layers
// may not have been constructed yet
winUtils.setAsyncScrollOffset(element, sx, sy);
return true;
} catch (e) {
if (!options.allowFailure) {
throw e;
}
}
}
return false;
}
function setupAsyncScrollOffsetsForElementSubtree(element, winUtils) {
setupAsyncScrollOffsetsForElement(element, winUtils);
var updatedAny = setupAsyncScrollOffsetsForElement(element, winUtils);
for (var c = element.firstElementChild; c; c = c.nextElementSibling) {
setupAsyncScrollOffsetsForElementSubtree(c, winUtils);
if (setupAsyncScrollOffsetsForElementSubtree(c, winUtils)) {
updatedAny = true;
}
}
if (element.contentDocument) {
LogInfo("Descending into subdocument (async offsets)");
setupAsyncScrollOffsetsForElementSubtree(element.contentDocument.documentElement,
windowUtilsForWindow(element.contentWindow));
if (setupAsyncScrollOffsetsForElementSubtree(element.contentDocument.documentElement,
windowUtilsForWindow(element.contentWindow))) {
updatedAny = true;
}
}
return updatedAny;
}
var asyncScroll = contentRootElement.hasAttribute("reftest-async-scroll");
if (asyncScroll) {
setupAsyncScrollOffsetsForElementSubtree(contentRootElement, windowUtils());
return setupAsyncScrollOffsetsForElementSubtree(contentRootElement, windowUtils());
}
return false;
}
function resetDisplayportAndViewport() {
@ -794,8 +803,13 @@ function RecordResult()
}
// Setup async scroll offsets now in case SynchronizeForSnapshot is not
// called (due to reftest-no-sync-layers being supplied).
setupAsyncScrollOffsets({allowFailure:true});
// called (due to reftest-no-sync-layers being supplied, or in the single
// process case).
var changedAsyncScrollOffsets = setupAsyncScrollOffsets({allowFailure:true}) ;
if (changedAsyncScrollOffsets && !gBrowserIsRemote) {
sendAsyncMessage("reftest:UpdateWholeCanvasForInvalidation");
}
SendTestDone(currentTestRunTime);
FinishTestItem();
}