mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1335942 - Part 3: Use AnimationValue as the argument in layers::SetAnimatable. r=hiro,manishearth
MozReview-Commit-ID: 4XnLL6I291q --HG-- extra : rebase_source : 1edb2bbe678f6ecb900945d8cacb776c138fa834
This commit is contained in:
parent
155c2acd50
commit
4fdebcb4a3
@ -420,7 +420,7 @@ ToTimingFunction(const Maybe<ComputedTimingFunction>& aCTF)
|
||||
|
||||
static void
|
||||
SetAnimatable(nsCSSPropertyID aProperty,
|
||||
const StyleAnimationValue& aAnimationValue,
|
||||
const AnimationValue& aAnimationValue,
|
||||
nsIFrame* aFrame,
|
||||
TransformReferenceBox& aRefBox,
|
||||
layers::Animatable& aAnimatable)
|
||||
@ -434,12 +434,14 @@ SetAnimatable(nsCSSPropertyID aProperty,
|
||||
|
||||
switch (aProperty) {
|
||||
case eCSSProperty_opacity:
|
||||
aAnimatable = aAnimationValue.GetFloatValue();
|
||||
aAnimatable = aAnimationValue.GetOpacity();
|
||||
break;
|
||||
case eCSSProperty_transform: {
|
||||
aAnimatable = InfallibleTArray<TransformFunction>();
|
||||
// TODO: Get transform from RawServoAnimationValue.
|
||||
nsCSSValueSharedList* list =
|
||||
aAnimationValue.GetCSSValueSharedListValue();
|
||||
aAnimationValue.mGecko.GetCSSValueSharedListValue();
|
||||
MOZ_ASSERT(list, "Invalid transform list");
|
||||
AddTransformFunctions(list->mHead,
|
||||
aFrame->StyleContext(),
|
||||
aFrame->PresContext(),
|
||||
@ -465,7 +467,9 @@ SetBaseAnimationStyle(nsCSSPropertyID aProperty,
|
||||
MOZ_ASSERT(!baseValue.IsNull(),
|
||||
"The base value should be already there");
|
||||
|
||||
SetAnimatable(aProperty, baseValue, aFrame, aRefBox, aBaseStyle);
|
||||
// FIXME: Bug 1311257: We need to get the baseValue for
|
||||
// RawServoAnimationValue.
|
||||
SetAnimatable(aProperty, { baseValue, nullptr }, aFrame, aRefBox, aBaseStyle);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -557,11 +561,11 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
|
||||
|
||||
AnimationSegment* animSegment = animation->segments().AppendElement();
|
||||
SetAnimatable(aProperty.mProperty,
|
||||
segment.mFromValue.mGecko,
|
||||
segment.mFromValue,
|
||||
aFrame, refBox,
|
||||
animSegment->startState());
|
||||
SetAnimatable(aProperty.mProperty,
|
||||
segment.mToValue.mGecko,
|
||||
segment.mToValue,
|
||||
aFrame, refBox,
|
||||
animSegment->endState());
|
||||
|
||||
|
@ -127,6 +127,8 @@ SERVO_BINDING_FUNC(Servo_AnimationValues_Interpolate,
|
||||
SERVO_BINDING_FUNC(Servo_AnimationValues_Uncompute,
|
||||
RawServoDeclarationBlockStrong,
|
||||
RawServoAnimationValueBorrowedListBorrowed value)
|
||||
SERVO_BINDING_FUNC(Servo_AnimationValues_GetOpacity, float,
|
||||
RawServoAnimationValueBorrowed value)
|
||||
|
||||
// Style attribute
|
||||
SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong,
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsStyleCoord.h"
|
||||
#include "ServoBindings.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsStyleContext;
|
||||
@ -591,6 +592,13 @@ struct AnimationValue
|
||||
// FIXME: Bug 1337229: add a deep == impl for RawServoAnimationValue.
|
||||
return mGecko == aOther.mGecko && mServo == aOther.mServo;
|
||||
}
|
||||
|
||||
bool IsNull() const { return mGecko.IsNull() && !mServo; }
|
||||
|
||||
float GetOpacity() const {
|
||||
return mServo ? Servo_AnimationValues_GetOpacity(mServo)
|
||||
: mGecko.GetFloatValue();
|
||||
}
|
||||
};
|
||||
|
||||
struct PropertyStyleAnimationValuePair
|
||||
|
Loading…
Reference in New Issue
Block a user