зеркало из 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)
|
, mPseudoType(aPseudoType)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aTarget, "null animation target is not yet supported");
|
MOZ_ASSERT(aTarget, "null animation target is not yet supported");
|
||||||
ResetIsRunningOnCompositor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
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
|
bool
|
||||||
KeyframeEffectReadOnly::IsRunningOnCompositor() const
|
KeyframeEffectReadOnly::IsRunningOnCompositor() const
|
||||||
{
|
{
|
||||||
|
@ -486,8 +472,8 @@ KeyframeEffectReadOnly::IsRunningOnCompositor() const
|
||||||
// one property running on compositor.
|
// one property running on compositor.
|
||||||
// Animation.IsRunningOnCompotitor will return more fine grained
|
// Animation.IsRunningOnCompotitor will return more fine grained
|
||||||
// information in bug 1196114.
|
// information in bug 1196114.
|
||||||
for (bool isPropertyRunningOnCompositor : mIsPropertyRunningOnCompositor) {
|
for (const AnimationProperty& property : mProperties) {
|
||||||
if (isPropertyRunningOnCompositor) {
|
if (property.mIsRunningOnCompositor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,19 +484,13 @@ void
|
||||||
KeyframeEffectReadOnly::SetIsRunningOnCompositor(nsCSSProperty aProperty,
|
KeyframeEffectReadOnly::SetIsRunningOnCompositor(nsCSSProperty aProperty,
|
||||||
bool aIsRunning)
|
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,
|
MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty,
|
||||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
||||||
"Property being animated on compositor is a recognized "
|
"Property being animated on compositor is a recognized "
|
||||||
"compositor-animatable property");
|
"compositor-animatable property");
|
||||||
const auto& info = LayerAnimationInfo::sRecords;
|
for (AnimationProperty& property : mProperties) {
|
||||||
for (size_t i = 0; i < ArrayLength(mIsPropertyRunningOnCompositor); i++) {
|
if (property.mProperty == aProperty) {
|
||||||
if (info[i].mProperty == aProperty) {
|
property.mIsRunningOnCompositor = aIsRunning;
|
||||||
mIsPropertyRunningOnCompositor[i] = aIsRunning;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,8 +503,8 @@ KeyframeEffectReadOnly::~KeyframeEffectReadOnly()
|
||||||
void
|
void
|
||||||
KeyframeEffectReadOnly::ResetIsRunningOnCompositor()
|
KeyframeEffectReadOnly::ResetIsRunningOnCompositor()
|
||||||
{
|
{
|
||||||
for (bool& isPropertyRunningOnCompositor : mIsPropertyRunningOnCompositor) {
|
for (AnimationProperty& property : mProperties) {
|
||||||
isPropertyRunningOnCompositor = false;
|
property.mIsRunningOnCompositor = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,9 +536,7 @@ KeyframeEffectReadOnly::UpdateTargetRegistration()
|
||||||
// Any effects not in the effect set will not be included in the set of
|
// 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
|
// candidate effects for running on the compositor and hence they won't
|
||||||
// have their compositor status updated so we should do that now.
|
// have their compositor status updated so we should do that now.
|
||||||
for (bool& isRunningOnCompositor : mIsPropertyRunningOnCompositor) {
|
ResetIsRunningOnCompositor();
|
||||||
isRunningOnCompositor = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1822,7 +1800,7 @@ KeyframeEffectReadOnly::CanThrottle() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// First we need to check layer generation and transform overflow
|
// 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
|
// occasionally unthrottle these animations even if the animations are
|
||||||
// already running on compositor.
|
// already running on compositor.
|
||||||
for (const LayerAnimationInfo::Record& record :
|
for (const LayerAnimationInfo::Record& record :
|
||||||
|
@ -1854,7 +1832,7 @@ KeyframeEffectReadOnly::CanThrottle() const
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const AnimationProperty& property : mProperties) {
|
for (const AnimationProperty& property : mProperties) {
|
||||||
if (!IsPropertyRunningOnCompositor(property.mProperty)) {
|
if (!property.mIsRunningOnCompositor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ struct AnimationPropertySegment
|
||||||
|
|
||||||
struct AnimationProperty
|
struct AnimationProperty
|
||||||
{
|
{
|
||||||
nsCSSProperty mProperty;
|
nsCSSProperty mProperty = eCSSProperty_UNKNOWN;
|
||||||
|
|
||||||
// Does this property win in the CSS Cascade?
|
// Does this property win in the CSS Cascade?
|
||||||
//
|
//
|
||||||
|
@ -136,16 +136,26 @@ struct AnimationProperty
|
||||||
// For other properties, we make it always be true.
|
// For other properties, we make it always be true.
|
||||||
// **NOTE 2**: This member is not included when comparing AnimationProperty
|
// **NOTE 2**: This member is not included when comparing AnimationProperty
|
||||||
// objects for equality.
|
// 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;
|
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
|
// This is because AnimationProperty objects are compared when recreating
|
||||||
// CSS animations to determine if mutation observer change records need to
|
// CSS animations to determine if mutation observer change records need to
|
||||||
// be created or not. However, at the point when these objects are compared
|
// 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
|
// neither the mWinsInCascade nor the mIsRunningOnCompositor will have been
|
||||||
// this member to avoid generating spurious change records.
|
// set on the new objects so we ignore these members to avoid generating
|
||||||
|
// spurious change records.
|
||||||
bool operator==(const AnimationProperty& aOther) const {
|
bool operator==(const AnimationProperty& aOther) const {
|
||||||
return mProperty == aOther.mProperty &&
|
return mProperty == aOther.mProperty &&
|
||||||
mSegments == aOther.mSegments;
|
mSegments == aOther.mSegments;
|
||||||
|
@ -279,8 +289,6 @@ public:
|
||||||
// Any updated properties are added to |aSetProperties|.
|
// Any updated properties are added to |aSetProperties|.
|
||||||
void ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
void ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||||
nsCSSPropertySet& aSetProperties);
|
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.
|
// Returns true if at least one property is being animated on compositor.
|
||||||
bool IsRunningOnCompositor() const;
|
bool IsRunningOnCompositor() const;
|
||||||
void SetIsRunningOnCompositor(nsCSSProperty aProperty, bool aIsRunning);
|
void SetIsRunningOnCompositor(nsCSSProperty aProperty, bool aIsRunning);
|
||||||
|
@ -341,17 +349,6 @@ protected:
|
||||||
|
|
||||||
InfallibleTArray<AnimationProperty> mProperties;
|
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:
|
private:
|
||||||
nsIFrame* GetAnimationFrame() const;
|
nsIFrame* GetAnimationFrame() const;
|
||||||
|
|
||||||
|
|
|
@ -789,7 +789,6 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
||||||
|
|
||||||
AnimationProperty &propData = *destEffect->Properties().AppendElement();
|
AnimationProperty &propData = *destEffect->Properties().AppendElement();
|
||||||
propData.mProperty = prop;
|
propData.mProperty = prop;
|
||||||
propData.mWinsInCascade = true;
|
|
||||||
|
|
||||||
KeyframeData *fromKeyframe = nullptr;
|
KeyframeData *fromKeyframe = nullptr;
|
||||||
RefPtr<nsStyleContext> fromContext;
|
RefPtr<nsStyleContext> fromContext;
|
||||||
|
|
|
@ -679,7 +679,6 @@ nsTransitionManager::ConsiderStartingTransition(
|
||||||
|
|
||||||
AnimationProperty& prop = *pt->Properties().AppendElement();
|
AnimationProperty& prop = *pt->Properties().AppendElement();
|
||||||
prop.mProperty = aProperty;
|
prop.mProperty = aProperty;
|
||||||
prop.mWinsInCascade = true;
|
|
||||||
|
|
||||||
AnimationPropertySegment& segment = *prop.mSegments.AppendElement();
|
AnimationPropertySegment& segment = *prop.mSegments.AppendElement();
|
||||||
segment.mFromValue = startValue;
|
segment.mFromValue = startValue;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче