зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f63f144516
Коммит
7b0ef88536
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче