async function runTests(event) { var testCanvas = make_canvas(); var testCx = testCanvas.getContext("2d"); var testWrapCx = SpecialPowers.wrap(testCx);
// Take a snapshot of the page while scrolled down, so that the fixed header will
// be visually in the middle of the root scroll frame, but should still be at the
// top of the snapshot (since snapshots with a rect are taken relative to the document). var rect = new window.DOMRect(0, 0, 500, 2000);
let image = await SpecialPowers.snapshotContext(window, rect, "rgb(255, 255, 255)", true);
testWrapCx.drawImage(image, 0, 0);
var refCanvas = make_canvas(); var refCx = refCanvas.getContext("2d");
// Construct a reference image with an equivalent red square at the top.
refCx.fillStyle = "white";
refCx.fillRect(0, 0, 500, 2000);
refCx.fillStyle = "red";
refCx.fillRect(0, 0, 500, 200);
assertSnapshots(testCanvas, refCanvas, true, null, "position:fixed element with scrolling", "reference");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.