Backed out changeset 6eb3b0501d00 (bug 1331704)

This commit is contained in:
Sebastian Hengst 2017-02-11 11:32:14 +01:00
Родитель c7040ed466
Коммит 9a8981039c
2 изменённых файлов: 45 добавлений и 14 удалений

Просмотреть файл

@ -286,10 +286,6 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
nsTArray<AnimationProperty> properties = BuildProperties(aStyleContext);
// We need to update base styles even if any properties are not changed at all
// since base styles might have been changed due to parent style changes, etc.
EnsureBaseStyles(aStyleContext, properties);
if (mProperties == properties) {
return;
}
@ -397,7 +393,9 @@ KeyframeEffectReadOnly::GetUnderlyingStyle(
// If we are composing with composite operation that is not 'replace'
// and we have not composed style for the property yet, we have to get
// the base style for the property.
result = BaseStyle(aProperty);
RefPtr<nsStyleContext> styleContext =
GetTargetStyleContextWithoutAnimation();
result = ResolveBaseStyle(aProperty, styleContext);
}
return result;
@ -439,24 +437,38 @@ KeyframeEffectReadOnly::CompositeValue(
}
void
KeyframeEffectReadOnly::EnsureBaseStyles(
nsStyleContext* aStyleContext,
const nsTArray<AnimationProperty>& aProperties)
KeyframeEffectReadOnly::EnsureBaseStylesForCompositor(
const nsCSSPropertyIDSet& aPropertiesToSkip)
{
if (!mTarget) {
return;
}
mBaseStyleValues.Clear();
RefPtr<nsStyleContext> styleContext;
for (const AnimationProperty& property : mProperties) {
if (!nsCSSProps::PropHasFlags(property.mProperty,
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) {
continue;
}
if (aPropertiesToSkip.HasProperty(property.mProperty)) {
continue;
}
for (const AnimationProperty& property : aProperties) {
for (const AnimationPropertySegment& segment : property.mSegments) {
if (segment.mFromComposite == dom::CompositeOperation::Replace &&
segment.mToComposite == dom::CompositeOperation::Replace) {
continue;
}
Unused << ResolveBaseStyle(property.mProperty, aStyleContext);
if (!styleContext) {
styleContext = GetTargetStyleContextWithoutAnimation();
}
MOZ_RELEASE_ASSERT(styleContext);
StyleAnimationValue result =
ResolveBaseStyle(property.mProperty, styleContext);
break;
}
}
@ -483,6 +495,16 @@ KeyframeEffectReadOnly::ComposeStyle(
// If the progress is null, we don't have fill data for the current
// time so we shouldn't animate.
if (computedTiming.mProgress.IsNull()) {
// If we are not in-effect, this effect might still be sent to the
// compositor and later become in-effect (e.g. if it is in the delay phase,
// or, if it is in the end delay phase but with a negative playback rate).
// In that case, we might need the base style in order to perform
// additive/accumulative animation on the compositor.
// Note, however, that we don't actually send animations with a negative
// playback rate in their end delay phase to the compositor at this stage
// (bug 1330498).
EnsureBaseStylesForCompositor(aPropertiesToSkip);
return;
}
@ -652,6 +674,14 @@ KeyframeEffectReadOnly::ComposeStyle(
}
}
}
// For properties that can be run on the compositor, we may need to prepare
// base styles to send to the compositor even if the current processing
// segment for properties does not have either an additive or accumulative
// composite mode, and even if the animation is not in-effect. That's because
// the animation may later progress to a segment which has an additive or
// accumulative composite on the compositor mode.
EnsureBaseStylesForCompositor(aPropertiesToSkip);
}
bool

Просмотреть файл

@ -386,9 +386,10 @@ protected:
nsCSSPropertyID aProperty,
const RefPtr<AnimValuesStyleRule>& aAnimationRule);
// Ensure the base styles is available for any properties in |aProperties|.
void EnsureBaseStyles(nsStyleContext* aStyleContext,
const nsTArray<AnimationProperty>& aProperties);
// Ensure the base styles is available for any properties that can be run on
// the compositor and which are not includes in |aPropertiesToSkip|.
void EnsureBaseStylesForCompositor(
const nsCSSPropertyIDSet& aPropertiesToSkip);
// Returns the base style resolved by |aStyleContext| for |aProperty|.
StyleAnimationValue ResolveBaseStyle(nsCSSPropertyID aProperty,