Bug 1340005 - Part 2: Implement AnimationValue::Transform. r=birtles

MozReview-Commit-ID: BDKcpDIM9nb

--HG--
extra : rebase_source : 43a5e7f053d746198f422487f7e19f535ccd9dc5
This commit is contained in:
Boris Chiou 2017-10-27 21:06:30 +02:00
parent 701609334e
commit 7086921688
4 changed files with 28 additions and 1 deletions

View File

@ -474,7 +474,9 @@ ToAnimationValue(const Animatable& aAnimatable)
case Animatable::TArrayOfTransformFunction: {
const InfallibleTArray<TransformFunction>& transforms =
aAnimatable.get_ArrayOfTransformFunction();
result.mGecko.SetTransformValue(CreateCSSValueList(transforms));
RefPtr<nsCSSValueSharedList> list(CreateCSSValueList(transforms));
MOZ_ASSERT(list, "Transform list should be non null");
result = AnimationValue::Transform(StyleBackendType::Gecko, *list);
}
break;
case Animatable::Tfloat:

View File

@ -376,6 +376,9 @@ SERVO_BINDING_FUNC(Servo_AnimationValue_Opacity,
SERVO_BINDING_FUNC(Servo_AnimationValue_GetTransform, void,
RawServoAnimationValueBorrowed value,
RefPtr<nsCSSValueSharedList>* list)
SERVO_BINDING_FUNC(Servo_AnimationValue_Transform,
RawServoAnimationValueStrong,
const nsCSSValueSharedList& list)
SERVO_BINDING_FUNC(Servo_AnimationValue_DeepEqual, bool,
RawServoAnimationValueBorrowed,
RawServoAnimationValueBorrowed)

View File

@ -5511,3 +5511,22 @@ AnimationValue::Opacity(StyleBackendType aBackendType, float aOpacity)
}
return result;
}
/* static */ AnimationValue
AnimationValue::Transform(StyleBackendType aBackendType,
nsCSSValueSharedList& aList)
{
AnimationValue result;
switch (aBackendType) {
case StyleBackendType::Servo:
result.mServo = Servo_AnimationValue_Transform(aList).Consume();
break;
case StyleBackendType::Gecko:
result.mGecko.SetTransformValue(&aList);
break;
default:
MOZ_ASSERT_UNREACHABLE("Unsupported style backend");
}
return result;
}

View File

@ -639,6 +639,9 @@ struct AnimationValue
// Create an AnimationValue from an opacity value.
static AnimationValue Opacity(StyleBackendType aBackendType, float aOpacity);
// Create an AnimationValue from a transform list.
static AnimationValue Transform(StyleBackendType aBackendType,
nsCSSValueSharedList& aList);
// mGecko and mServo are mutually exclusive: only one or the other should
// ever be set.