// Flush styles since getUnanimatedComputedStyle flushes pending styles even
// with FLUSH_NONE option if the element hasn't yet styled.
getComputedStyle(div).opacity;
div.style.opacity = "0";
is(utils.getUnanimatedComputedStyle(div, null, "opacity", utils.FLUSH_NONE), "1", "getUnanimatedComputedStyle with FLUSH_NONE should not flush pending styles");
is(utils.getUnanimatedComputedStyle(div, null, "opacity", utils.FLUSH_STYLE), "0", "getUnanimatedComputedStyle with FLUSH_STYLE should flush pending styles");
div.remove();
test_needsFlushWithThrottledAnimations();
}
function checkUnanimatedComputedStyle(property, initialStyle, pseudoType,
expectedBeforeAnimation,
expectedDuringAnimation,
animate, animationType) {
const div = document.createElement("div");
document.body.appendChild(div);
if (initialStyle) { div.style[property] = initialStyle;
}
if (pseudoType) { div.classList.add("pseudo");
}
is(utils.getUnanimatedComputedStyle(div, pseudoType, property, utils.FLUSH_STYLE),
expectedBeforeAnimation,
`'${ property }' property with '${ initialStyle }'style `
+ `should be '${ expectedBeforeAnimation }' `
+ `before animating by ${ animationType }`);
const animation = animate(div);
animation.currentTime = 500;
is(utils.getUnanimatedComputedStyle(div, pseudoType, property, utils.FLUSH_STYLE),
expectedDuringAnimation,
`'${ property }' property with '${ initialStyle }'style `
+ `should be '${ expectedDuringAnimation }' `
+ `even while animating by ${ animationType }`);
div.remove();
}
function test_needsFlushWithThrottledAnimations() {
const div = document.createElement("div"); div.style = "width: 100px; height: 100px; background-color: blue;";
document.body.appendChild(div);
const animation = div.animate({ opacity: [ 0, 1 ] },
{ duration: 100000, iterations: Infinity });
waitForAnimationReadyToRestyle(animation).then(() => {
ok(SpecialPowers.wrap(animation).isRunningOnCompositor, "Opacity animation should run on the compositor");
// FIXME! Bug 1442861: We should make sure needsFlush() returns true
// before flusing layout.
//ok(utils.needsFlush(SpecialPowers.Ci.nsIDOMWindowUtils.FLUSH_STYLE),
// "needsFlush should return true if there is an animation on the compositor");
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.