Bug 1263486 part 3 - Use nsCSSValue move constructor in CSSAnimationBuilder::GetComputedValue
MozReview-Commit-ID: H79OAEkdq4L
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -558,27 +558,26 @@ private:
nsCSSPropertySet aAnimatedProperties,
nsCSSPropertySet aPropertiesSetAtStart,
nsCSSPropertySet aPropertiesSetAtEnd,
const Maybe<ComputedTimingFunction>& aInheritedTimingFunction,
nsTArray<Keyframe>& aKeyframes);
void AppendProperty(nsPresContext* aPresContext,
nsCSSProperty aProperty,
nsTArray<PropertyValuePair>& aPropertyValues);
- void GetComputedValue(nsPresContext* aPresContext,
- nsCSSProperty aProperty,
- nsCSSValue& aResult);
+ nsCSSValue GetComputedValue(nsPresContext* aPresContext,
+ nsCSSProperty aProperty);
static TimingParams TimingParamsFrom(
const StyleAnimation& aStyleAnimation)
{
TimingParams timing;
timing.mDuration.emplace(StickyTimeDuration::FromMilliseconds(
- aStyleAnimation.GetDuration()));
+ aStyleAnimation.GetDuration()));
timing.mDelay = TimeDuration::FromMilliseconds(aStyleAnimation.GetDelay());
timing.mIterations = aStyleAnimation.GetIterationCount();
MOZ_ASSERT(timing.mIterations >= 0.0 && !IsNaN(timing.mIterations),
"mIterations should be nonnegative & finite, as ensured by "
"CSSParser");
timing.mDirection = aStyleAnimation.GetDirection();
timing.mFill = aStyleAnimation.GetFillMode();
@@ -1018,52 +1017,49 @@ CSSAnimationBuilder::FillInMissingKeyfra
void
CSSAnimationBuilder::AppendProperty(
nsPresContext* aPresContext,
nsCSSProperty aProperty,
nsTArray<PropertyValuePair>& aPropertyValues)
{
PropertyValuePair propertyValue;
propertyValue.mProperty = aProperty;
- GetComputedValue(aPresContext, aProperty, propertyValue.mValue);
+ propertyValue.mValue = GetComputedValue(aPresContext, aProperty);
aPropertyValues.AppendElement(Move(propertyValue));
}
-void
+nsCSSValue
CSSAnimationBuilder::GetComputedValue(nsPresContext* aPresContext,
- nsCSSProperty aProperty,
- nsCSSValue& aResult)
+ nsCSSProperty aProperty)
{
+ nsCSSValue result;
StyleAnimationValue computedValue;
if (!mStyleWithoutAnimation) {
MOZ_ASSERT(aPresContext->StyleSet()->IsGecko(),
"ServoStyleSet should not use nsAnimationManager for "
"animations");
mStyleWithoutAnimation = aPresContext->StyleSet()->AsGecko()->
ResolveStyleWithoutAnimation(mTarget, mStyleContext,
eRestyle_AllHintsWithAnimations);
}
if (StyleAnimationValue::ExtractComputedValue(aProperty,
mStyleWithoutAnimation,
- computedValue) &&
- StyleAnimationValue::UncomputeValue(
- aProperty, Move(computedValue), aResult)) {
- // If we hit this assertion or the MOZ_ASSERT_UNREACHABLE below, it
- // probably means we are fetching a value from the computed style that
- // we don't know how to represent as a StyleAnimationValue.
- MOZ_ASSERT(aResult.GetUnit() != eCSSUnit_Null,
- "Got null computed value");
- return;
+ computedValue)) {
+ StyleAnimationValue::UncomputeValue(aProperty, Move(computedValue), result);
}
- MOZ_ASSERT_UNREACHABLE("Failed to get computed value");
- aResult.Reset();
+ // If we hit this assertion, it probably means we are fetching a value from
+ // the computed style that we don't know how to represent as
+ // a StyleAnimationValue.
+ MOZ_ASSERT(result.GetUnit() != eCSSUnit_Null, "Got null computed value");
+
+ return result;
}
void
nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
dom::Element* aTarget,
CSSAnimationCollection* aCollection,
OwningCSSAnimationPtrArray& aAnimations)
{