function waitForAnimationFrames(aFrameCount) {
const timeAtStart = window.document.timeline.currentTime;
return new Promise(function (resolve, reject) {
function handleFrame() {
if (
timeAtStart != window.document.timeline.currentTime &&
--aFrameCount <= 0
) {
resolve();
} else {
window.requestAnimationFrame(handleFrame); // wait another frame
}
}
window.requestAnimationFrame(handleFrame);
});
}
window.addEventListener('load', async function() {
if (!omtaEnabled) {
ok(true, 'Skipping the test since OMTA is disabled');
SimpleTest.finish();
return;
}
// Wait for the transition to start running on the main thread and
// compositor.
await firstTransition.ready;
await waitForPaints();
// Wait for a while to let the transition run a little bit on the compositor.
// Note that we throttle the transition so we don't compose its transition
// rule on the main thread. In general, we only compose the transition on the
// main thread once after creating the transition, so its value could be 1px
// (equal to its start value) now.
await waitForAnimationFrames(20);
// Start second transition, which is a reversing transition from the current
// value to `translate: 1px`. Note that the current value shouldn't be 1px;
// otherwise, there is no transition. div.style.translate = '';
const secondTransitions = div.getAnimations();
ok(secondTransitions.length == 1, "should have a reversing transition");
if (secondTransitions.length == 1) {
await secondTransitions[0].ready;
await waitForPaints();
await waitForAnimationFrames(2);
let matrix = SpecialPowers.DOMWindowUtils.getOMTAStyle(div, "translate");
ok(!matricesRoughlyEqual(convertTo3dMatrix(matrix),
convertTo3dMatrix("matrix(1, 0, 0, 1, 50, 0)")), "translate is set on compositor thread after reversing");
}
SimpleTest.finish();
});
</script>
</body>
</html>
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet am 2026-09-29)
¤
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.