Bug 1253164 - Make nsIFrame allow running async animations once the frame is able able to run animations on the compositor again. r?birtles
For example, we don't run transform animations on large frames but once
the frame size is small enough we should run transform animations on the frame.
MozReview-Commit-ID: DkfB9g2Gcdi
--- a/dom/animation/test/chrome/test_animation_performance_warning.html
+++ b/dom/animation/test/chrome/test_animation_performance_warning.html
@@ -1190,20 +1190,19 @@ function start() {
[ {
property: 'transform',
runningOnCompositor: false,
warning: expectedWarning
} ]);
animation.effect.target.style = 'width: 100px; height: 100px';
return waitForFrame();
}).then(() => {
- // FIXME: Bug 1253164: the animation should get back on compositor.
assert_animation_property_state_equals(
animation.effect.getProperties(),
- [ { property: 'transform', runningOnCompositor: false } ]);
+ [ { property: 'transform', runningOnCompositor: true } ]);
});
}, 'transform on too big element - area');
promise_test(t => {
var animation = addDivAndAnimate(t,
{ class: 'compositable' },
{ transform: [ 'translate(0px)',
'translate(100px)'] },
@@ -1226,20 +1225,19 @@ function start() {
[ {
property: 'transform',
runningOnCompositor: false,
warning: expectedWarning
} ]);
animation.effect.target.style = 'width: 100px; height: 100px';
return waitForFrame();
}).then(() => {
- // FIXME: Bug 1253164: the animation should get back on compositor.
assert_animation_property_state_equals(
animation.effect.getProperties(),
- [ { property: 'transform', runningOnCompositor: false } ]);
+ [ { property: 'transform', runningOnCompositor: true } ]);
});
}, 'transform on too big element - dimensions');
promise_test(t => {
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.setAttribute('width', '100');
svg.setAttribute('height', '100');
var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -8719,16 +8719,20 @@ already_AddRefed<Layer> nsDisplayTransfo
// Add the preserve-3d flag for this layer, BuildContainerLayerFor clears all flags,
// so we never need to explicitely unset this flag.
if (mFrame->Extend3DContext() && !mNoExtendContext) {
container->SetContentFlags(container->GetContentFlags() | Layer::CONTENT_EXTEND_3D_CONTEXT);
} else {
container->SetContentFlags(container->GetContentFlags() & ~Layer::CONTENT_EXTEND_3D_CONTEXT);
}
+ if (mAllowAsyncAnimation) {
+ mFrame->SetProperty(nsIFrame::RefusedAsyncAnimationProperty(), false);
+ }
+
nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(container, aBuilder,
this, mFrame,
eCSSProperty_transform);
if (mAllowAsyncAnimation && MayBeAnimated(aBuilder)) {
// Only allow async updates to the transform if we're an animated layer, since that's what
// triggers us to set the correct AGR in the constructor and makes sure FrameLayerBuilder
// won't compute occlusions for this layer.
container->SetUserData(nsIFrame::LayerIsPrerenderedDataKey(),