Bug 1350743 - Re-use nsStyleContext without animations to extract animation values for each property. r=birtles

MozReview-Commit-ID: L4AmCAp0DLn

--HG--
extra : rebase_source : 568be90539c7ffb0c47e03c4a8d1687e5560e87d
This commit is contained in:
Hiroyuki Ikezoe 2017-03-27 09:15:26 +09:00
Родитель f63f144516
Коммит 7b0ef88536
2 изменённых файлов: 23 добавлений и 10 удалений

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

@ -463,35 +463,44 @@ KeyframeEffectReadOnly::EnsureBaseStyles(
mBaseStyleValues.Clear();
RefPtr<nsStyleContext> cachedBaseStyleContext;
for (const AnimationProperty& property : aProperties) {
for (const AnimationPropertySegment& segment : property.mSegments) {
if (segment.HasReplacableValues()) {
continue;
}
EnsureBaseStyle(property.mProperty, aStyleContext);
EnsureBaseStyle(property.mProperty,
aStyleContext,
cachedBaseStyleContext);
break;
}
}
}
void
KeyframeEffectReadOnly::EnsureBaseStyle(nsCSSPropertyID aProperty,
nsStyleContext* aStyleContext)
KeyframeEffectReadOnly::EnsureBaseStyle(
nsCSSPropertyID aProperty,
nsStyleContext* aStyleContext,
RefPtr<nsStyleContext>& aCachedBaseStyleContext)
{
if (mBaseStyleValues.Contains(aProperty)) {
return;
}
RefPtr<nsStyleContext> styleContextWithoutAnimation =
aStyleContext->PresContext()->StyleSet()->AsGecko()->
ResolveStyleByRemovingAnimation(mTarget->mElement,
aStyleContext,
eRestyle_AllHintsWithAnimations);
if (!aCachedBaseStyleContext) {
aCachedBaseStyleContext =
aStyleContext->PresContext()->StyleSet()->AsGecko()->
ResolveStyleByRemovingAnimation(mTarget->mElement,
aStyleContext,
eRestyle_AllHintsWithAnimations);
}
StyleAnimationValue result;
DebugOnly<bool> success =
StyleAnimationValue::ExtractComputedValue(aProperty,
styleContextWithoutAnimation,
aCachedBaseStyleContext,
result);
MOZ_ASSERT(success, "Should be able to extract computed animation value");

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

@ -419,8 +419,12 @@ protected:
// If no base style is already stored for |aProperty|, resolves the base style
// for |aProperty| using |aStyleContext| and stores it in mBaseStyleValues.
// If |aCachedBaseStyleContext| is non-null, it will be used, otherwise the
// base style context will be resolved and stored in
// |aCachedBaseStyleContext|.
void EnsureBaseStyle(nsCSSPropertyID aProperty,
nsStyleContext* aStyleContext);
nsStyleContext* aStyleContext,
RefPtr<nsStyleContext>& aCachedBaseStyleContext);
Maybe<OwningAnimationTarget> mTarget;