mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1109390 part 20 - Add an options flag to GetAnimationsForCompositor to control; r=jwatt
This patch adds an options flag to GetAnimationsForCompositor for two reasons. a) We want to reuse this functionality in nsLayoutUtils.cpp rather than duplicating the same logic. To do that and maintain the existing behavior, however, we need to *not* update the active layer tracker when calling this from nsLayoutUtils.cpp. b) It's surprising that GetAnimationsForCompositor also has this side effect of updating the active layer tracker. Adding this as an option makes it clear at the call site that this is what will happen.
This commit is contained in:
parent
b10106d3f9
commit
60c21b31d2
@ -121,10 +121,12 @@ CommonAnimationManager::CheckNeedsRefresh()
|
||||
AnimationPlayerCollection*
|
||||
CommonAnimationManager::GetAnimationsForCompositor(nsIContent* aContent,
|
||||
nsIAtom* aElementProperty,
|
||||
nsCSSProperty aProperty)
|
||||
nsCSSProperty aProperty,
|
||||
GetCompositorAnimationOptions aFlags)
|
||||
{
|
||||
if (!aContent->MayHaveAnimations())
|
||||
return nullptr;
|
||||
|
||||
AnimationPlayerCollection* collection =
|
||||
static_cast<AnimationPlayerCollection*>(
|
||||
aContent->GetProperty(aElementProperty));
|
||||
@ -135,6 +137,10 @@ CommonAnimationManager::GetAnimationsForCompositor(nsIContent* aContent,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!(aFlags & GetCompositorAnimationOptions::NotifyActiveLayerTracker)) {
|
||||
return collection;
|
||||
}
|
||||
|
||||
// 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(collection->mElement);
|
||||
|
@ -35,6 +35,14 @@ namespace mozilla {
|
||||
class RestyleTracker;
|
||||
struct AnimationPlayerCollection;
|
||||
|
||||
// Options to set when fetching animations to run on the compositor.
|
||||
enum class GetCompositorAnimationOptions {
|
||||
// When fetching compositor animations, if there are any such animations,
|
||||
// also let the ActiveLayerTracker know at the same time.
|
||||
NotifyActiveLayerTracker = 1 << 0
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(GetCompositorAnimationOptions)
|
||||
|
||||
namespace css {
|
||||
|
||||
bool IsGeometricProperty(nsCSSProperty aProperty);
|
||||
@ -158,12 +166,11 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
// When this returns a value other than nullptr, it also,
|
||||
// as a side-effect, notifies the ActiveLayerTracker.
|
||||
static AnimationPlayerCollection*
|
||||
GetAnimationsForCompositor(nsIContent* aContent,
|
||||
nsIAtom* aElementProperty,
|
||||
nsCSSProperty aProperty);
|
||||
nsCSSProperty aProperty,
|
||||
GetCompositorAnimationOptions aFlags);
|
||||
|
||||
PRCList mElementCollections;
|
||||
nsPresContext *mPresContext; // weak (non-null from ctor to Disconnect)
|
||||
|
@ -169,7 +169,8 @@ public:
|
||||
GetAnimationsForCompositor(nsIContent* aContent, nsCSSProperty aProperty)
|
||||
{
|
||||
return mozilla::css::CommonAnimationManager::GetAnimationsForCompositor(
|
||||
aContent, nsGkAtoms::animationsProperty, aProperty);
|
||||
aContent, nsGkAtoms::animationsProperty, aProperty,
|
||||
mozilla::GetCompositorAnimationOptions::NotifyActiveLayerTracker);
|
||||
}
|
||||
|
||||
void UpdateStyleAndEvents(mozilla::AnimationPlayerCollection* aEA,
|
||||
|
@ -107,7 +107,8 @@ public:
|
||||
GetAnimationsForCompositor(nsIContent* aContent, nsCSSProperty aProperty)
|
||||
{
|
||||
return mozilla::css::CommonAnimationManager::GetAnimationsForCompositor(
|
||||
aContent, nsGkAtoms::transitionsProperty, aProperty);
|
||||
aContent, nsGkAtoms::transitionsProperty, aProperty,
|
||||
mozilla::GetCompositorAnimationOptions::NotifyActiveLayerTracker);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user