Bug 784846 - The ShouldPrerender check for async animations is wrong r=mattwoodrow

This commit is contained in:
David Zbarsky 2012-08-23 02:05:27 -04:00
parent 5371efd533
commit b099208605
2 changed files with 20 additions and 5 deletions

View File

@ -345,7 +345,7 @@ AddAnimationsAndTransitionsToLayer(Layer* aLayer, nsDisplayListBuilder* aBuilder
// If the frame is not prerendered, bail out. Layout will still perform the
// animation.
if (!nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder, frame)) {
if (!aItem->CanUseAsyncAnimations(aBuilder)) {
if (nsLayoutUtils::IsAnimationLoggingEnabled()) {
printf_stderr("Performance warning: Async animation disabled because the frame for element '%s'",
nsAtomCString(aContent->Tag()).get());

View File

@ -910,13 +910,20 @@ public:
*/
virtual void DisableComponentAlpha() {}
/**
* Check if we can add async animations to the layer for this display item.
*/
virtual bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) {
return false;
}
protected:
friend class nsDisplayList;
nsDisplayItem() {
mAbove = nullptr;
}
nsIFrame* mFrame;
// Result of ToReferenceFrame(mFrame), if mFrame is non-null
nsPoint mToReferenceFrame;
@ -1873,7 +1880,7 @@ public:
protected:
nsDisplayWrapper() {}
};
/**
* The standard display item to paint a stacking context with translucency
* set by the stacking context root frame's 'opacity' style.
@ -1885,7 +1892,7 @@ public:
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayOpacity();
#endif
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool* aSnap);
virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
@ -1899,6 +1906,10 @@ public:
const nsRect& aAllowVisibleRegionExpansion);
virtual bool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) {
return GetUnderlyingFrame()->AreLayersMarkedActive(nsChangeHint_UpdateOpacityLayer);
}
};
/**
@ -2410,6 +2421,10 @@ public:
*/
static bool ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame);
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) {
return nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder,
GetUnderlyingFrame());
}
private:
nsDisplayWrapList mStoredList;