зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1025709 part 10 - Move active layer notification out of CanPerformOnCompositorThread to call sites; r=heycam
A previous patch moved CanPerformOnCompositorThread to CommonElementAnimationData including a FIXME saying that active layer notification should happen at call sites. Now that the code for GetAnimationsForCompositor is common, we can do the active layer notification there.
This commit is contained in:
Родитель
a722f517b1
Коммит
9d2caa34ca
|
@ -92,6 +92,18 @@ CommonAnimationManager::GetAnimationsForCompositor(nsIContent* aContent,
|
|||
CommonElementAnimationData::CanAnimate_AllowPartial)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// This animation can be done on the compositor.
|
||||
// Mark the frame as active, in case we are able to throttle this animation.
|
||||
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(animations->mElement);
|
||||
if (frame) {
|
||||
if (aProperty == eCSSProperty_opacity) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_opacity);
|
||||
} else if (aProperty == eCSSProperty_transform) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_transform);
|
||||
}
|
||||
}
|
||||
|
||||
return animations;
|
||||
}
|
||||
|
||||
|
@ -654,8 +666,6 @@ CommonElementAnimationData::CanPerformOnCompositorThread(
|
|||
}
|
||||
}
|
||||
|
||||
bool hasOpacity = false;
|
||||
bool hasTransform = false;
|
||||
bool existsProperty = false;
|
||||
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
|
||||
const ElementAnimation* anim = mAnimations[animIdx];
|
||||
|
@ -674,11 +684,6 @@ CommonElementAnimationData::CanPerformOnCompositorThread(
|
|||
IsCompositorAnimationDisabledForFrame(frame)) {
|
||||
return false;
|
||||
}
|
||||
if (prop.mProperty == eCSSProperty_opacity) {
|
||||
hasOpacity = true;
|
||||
} else if (prop.mProperty == eCSSProperty_transform) {
|
||||
hasTransform = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,14 +692,6 @@ CommonElementAnimationData::CanPerformOnCompositorThread(
|
|||
return false;
|
||||
}
|
||||
|
||||
// This animation can be done on the compositor. Mark the frame as active, in
|
||||
// case we are able to throttle this animation.
|
||||
if (hasOpacity) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_opacity);
|
||||
}
|
||||
if (hasTransform) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_transform);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ protected:
|
|||
virtual void ElementDataRemoved() = 0;
|
||||
void RemoveAllElementData();
|
||||
|
||||
// When this returns a value other than nullptr, it also,
|
||||
// as a side-effect, notifies the ActiveLayerTracker.
|
||||
static CommonElementAnimationData*
|
||||
GetAnimationsForCompositor(nsIContent* aContent,
|
||||
nsIAtom* aElementProperty,
|
||||
|
@ -469,10 +471,6 @@ struct CommonElementAnimationData : public PRCList
|
|||
// time can be fully represented by data sent to the compositor.
|
||||
// (This is useful for determining whether throttle the animation
|
||||
// (suppress main-thread style updates).)
|
||||
//
|
||||
// Note that when CanPerformOnCompositorThread returns true, it also,
|
||||
// as a side-effect, notifies the ActiveLayerTracker. FIXME: This
|
||||
// should probably move to the relevant callers.
|
||||
bool CanPerformOnCompositorThread(CanAnimateFlags aFlags) const;
|
||||
bool HasAnimationOfProperty(nsCSSProperty aProperty) const;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче