зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1219543 - Part 1: isRunningOnCompositor flag is now a member of AnimationProperty. r=bbirtles
This commit is contained in:
Родитель
d93d9fdb20
Коммит
1ffc0c63ea
|
@ -96,7 +96,6 @@ KeyframeEffectReadOnly::KeyframeEffectReadOnly(
|
|||
, mPseudoType(aPseudoType)
|
||||
{
|
||||
MOZ_ASSERT(aTarget, "null animation target is not yet supported");
|
||||
ResetIsRunningOnCompositor();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
@ -466,19 +465,6 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
KeyframeEffectReadOnly::IsPropertyRunningOnCompositor(
|
||||
nsCSSProperty aProperty) const
|
||||
{
|
||||
const auto& info = LayerAnimationInfo::sRecords;
|
||||
for (size_t i = 0; i < ArrayLength(mIsPropertyRunningOnCompositor); i++) {
|
||||
if (info[i].mProperty == aProperty) {
|
||||
return mIsPropertyRunningOnCompositor[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
KeyframeEffectReadOnly::IsRunningOnCompositor() const
|
||||
{
|
||||
|
@ -486,8 +472,8 @@ KeyframeEffectReadOnly::IsRunningOnCompositor() const
|
|||
// one property running on compositor.
|
||||
// Animation.IsRunningOnCompotitor will return more fine grained
|
||||
// information in bug 1196114.
|
||||
for (bool isPropertyRunningOnCompositor : mIsPropertyRunningOnCompositor) {
|
||||
if (isPropertyRunningOnCompositor) {
|
||||
for (const AnimationProperty& property : mProperties) {
|
||||
if (property.mIsRunningOnCompositor) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -498,19 +484,13 @@ void
|
|||
KeyframeEffectReadOnly::SetIsRunningOnCompositor(nsCSSProperty aProperty,
|
||||
bool aIsRunning)
|
||||
{
|
||||
static_assert(
|
||||
MOZ_ARRAY_LENGTH(LayerAnimationInfo::sRecords) ==
|
||||
MOZ_ARRAY_LENGTH(mIsPropertyRunningOnCompositor),
|
||||
"The length of mIsPropertyRunningOnCompositor should equal to"
|
||||
"the length of LayserAnimationInfo::sRecords");
|
||||
MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty,
|
||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
||||
"Property being animated on compositor is a recognized "
|
||||
"compositor-animatable property");
|
||||
const auto& info = LayerAnimationInfo::sRecords;
|
||||
for (size_t i = 0; i < ArrayLength(mIsPropertyRunningOnCompositor); i++) {
|
||||
if (info[i].mProperty == aProperty) {
|
||||
mIsPropertyRunningOnCompositor[i] = aIsRunning;
|
||||
for (AnimationProperty& property : mProperties) {
|
||||
if (property.mProperty == aProperty) {
|
||||
property.mIsRunningOnCompositor = aIsRunning;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -523,8 +503,8 @@ KeyframeEffectReadOnly::~KeyframeEffectReadOnly()
|
|||
void
|
||||
KeyframeEffectReadOnly::ResetIsRunningOnCompositor()
|
||||
{
|
||||
for (bool& isPropertyRunningOnCompositor : mIsPropertyRunningOnCompositor) {
|
||||
isPropertyRunningOnCompositor = false;
|
||||
for (AnimationProperty& property : mProperties) {
|
||||
property.mIsRunningOnCompositor = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,9 +536,7 @@ KeyframeEffectReadOnly::UpdateTargetRegistration()
|
|||
// Any effects not in the effect set will not be included in the set of
|
||||
// candidate effects for running on the compositor and hence they won't
|
||||
// have their compositor status updated so we should do that now.
|
||||
for (bool& isRunningOnCompositor : mIsPropertyRunningOnCompositor) {
|
||||
isRunningOnCompositor = false;
|
||||
}
|
||||
ResetIsRunningOnCompositor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1822,7 +1800,7 @@ KeyframeEffectReadOnly::CanThrottle() const
|
|||
}
|
||||
|
||||
// First we need to check layer generation and transform overflow
|
||||
// prior to the IsPropertyRunningOnCompositor check because we should
|
||||
// prior to the property.mIsRunningOnCompositor check because we should
|
||||
// occasionally unthrottle these animations even if the animations are
|
||||
// already running on compositor.
|
||||
for (const LayerAnimationInfo::Record& record :
|
||||
|
@ -1854,7 +1832,7 @@ KeyframeEffectReadOnly::CanThrottle() const
|
|||
}
|
||||
|
||||
for (const AnimationProperty& property : mProperties) {
|
||||
if (!IsPropertyRunningOnCompositor(property.mProperty)) {
|
||||
if (!property.mIsRunningOnCompositor) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ struct AnimationPropertySegment
|
|||
|
||||
struct AnimationProperty
|
||||
{
|
||||
nsCSSProperty mProperty;
|
||||
nsCSSProperty mProperty = eCSSProperty_UNKNOWN;
|
||||
|
||||
// Does this property win in the CSS Cascade?
|
||||
//
|
||||
|
@ -136,16 +136,26 @@ struct AnimationProperty
|
|||
// For other properties, we make it always be true.
|
||||
// **NOTE 2**: This member is not included when comparing AnimationProperty
|
||||
// objects for equality.
|
||||
bool mWinsInCascade;
|
||||
bool mWinsInCascade = true;
|
||||
|
||||
// If true, the propery is currently being animated on the compositor.
|
||||
//
|
||||
// Note that when the owning Animation requests a non-throttled restyle, in
|
||||
// between calling RequestRestyle on its AnimationCollection and when the
|
||||
// restyle is performed, this member may temporarily become false even if
|
||||
// the animation remains on the layer after the restyle.
|
||||
bool mIsRunningOnCompositor = false;
|
||||
|
||||
InfallibleTArray<AnimationPropertySegment> mSegments;
|
||||
|
||||
// NOTE: This operator does *not* compare the mWinsInCascade member.
|
||||
// NOTE: This operator does *not* compare the mWinsInCascade member *or* the
|
||||
// mIsRunningOnCompositor member.
|
||||
// This is because AnimationProperty objects are compared when recreating
|
||||
// CSS animations to determine if mutation observer change records need to
|
||||
// be created or not. However, at the point when these objects are compared
|
||||
// the mWinsInCascade will not have been set on the new objects so we ignore
|
||||
// this member to avoid generating spurious change records.
|
||||
// neither the mWinsInCascade nor the mIsRunningOnCompositor will have been
|
||||
// set on the new objects so we ignore these members to avoid generating
|
||||
// spurious change records.
|
||||
bool operator==(const AnimationProperty& aOther) const {
|
||||
return mProperty == aOther.mProperty &&
|
||||
mSegments == aOther.mSegments;
|
||||
|
@ -279,8 +289,6 @@ public:
|
|||
// Any updated properties are added to |aSetProperties|.
|
||||
void ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||
nsCSSPropertySet& aSetProperties);
|
||||
// Returns true if |aProperty| is currently being animated on compositor.
|
||||
bool IsPropertyRunningOnCompositor(nsCSSProperty aProperty) const;
|
||||
// Returns true if at least one property is being animated on compositor.
|
||||
bool IsRunningOnCompositor() const;
|
||||
void SetIsRunningOnCompositor(nsCSSProperty aProperty, bool aIsRunning);
|
||||
|
@ -341,17 +349,6 @@ protected:
|
|||
|
||||
InfallibleTArray<AnimationProperty> mProperties;
|
||||
|
||||
// Parallel array corresponding to CommonAnimationManager::sLayerAnimationInfo
|
||||
// such that mIsPropertyRunningOnCompositor[x] is true only if this effect has
|
||||
// an animation of CommonAnimationManager::sLayerAnimationInfo[x].mProperty
|
||||
// that is currently running on the compositor.
|
||||
//
|
||||
// Note that when the owning Animation requests a non-throttled restyle, in
|
||||
// between calling RequestRestyle on its AnimationCollection and when the
|
||||
// restyle is performed, this member may temporarily become false even if
|
||||
// the animation remains on the layer after the restyle.
|
||||
bool mIsPropertyRunningOnCompositor[LayerAnimationInfo::kRecords];
|
||||
|
||||
private:
|
||||
nsIFrame* GetAnimationFrame() const;
|
||||
|
||||
|
|
|
@ -789,7 +789,6 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
|||
|
||||
AnimationProperty &propData = *destEffect->Properties().AppendElement();
|
||||
propData.mProperty = prop;
|
||||
propData.mWinsInCascade = true;
|
||||
|
||||
KeyframeData *fromKeyframe = nullptr;
|
||||
RefPtr<nsStyleContext> fromContext;
|
||||
|
|
|
@ -679,7 +679,6 @@ nsTransitionManager::ConsiderStartingTransition(
|
|||
|
||||
AnimationProperty& prop = *pt->Properties().AppendElement();
|
||||
prop.mProperty = aProperty;
|
||||
prop.mWinsInCascade = true;
|
||||
|
||||
AnimationPropertySegment& segment = *prop.mSegments.AppendElement();
|
||||
segment.mFromValue = startValue;
|
||||
|
|
Загрузка…
Ссылка в новой задаче