Bug 1390352 - Make Servo_AnimationValues_ComputeDistance return negative value instead of 0.0 when the function fails to distinguish its failure. r=hiro

We need to check whether the function fails or not in order to check whether
we support the specified paced animation values.

Current servo returns 0.0 when failed computing distance, so servo doesn't
distinguish its failure. This patch makes Servo_AnimationValue_ComputeDistance
return a negative value when the function fails.

MozReview-Commit-ID: 43Q4gu4xwHc

--HG--
extra : rebase_source : fa159b4b03e2e84c0a365455de4c0d2cf5d4f2ce
This commit is contained in:
Mantaroh Yoshinaga 2017-08-24 10:21:14 +09:00
Родитель 3f453dfcd4
Коммит 4c7997db68
2 изменённых файлов: 9 добавлений и 2 удалений

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

@ -456,6 +456,10 @@ ComputeDistanceForServo(const ValueWrapper* aFromWrapper,
} }
double distance = Servo_AnimationValues_ComputeDistance(*fromValue, *toValue); double distance = Servo_AnimationValues_ComputeDistance(*fromValue, *toValue);
if (distance < 0.0) {
return NS_ERROR_FAILURE;
}
if (len == 1) { if (len == 1) {
aDistance = distance; aDistance = distance;
return NS_OK; return NS_OK;

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

@ -5400,11 +5400,14 @@ AnimationValue::ComputeDistance(nsCSSPropertyID aProperty,
!mServo == !aOther.mServo, !mServo == !aOther.mServo,
"Animation values should have the same style engine"); "Animation values should have the same style engine");
double distance= 0.0;
if (mServo) { if (mServo) {
return Servo_AnimationValues_ComputeDistance(mServo, aOther.mServo); distance = Servo_AnimationValues_ComputeDistance(mServo, aOther.mServo);
return distance < 0.0
? 0.0
: distance;
} }
double distance = 0.0;
return StyleAnimationValue::ComputeDistance(aProperty, return StyleAnimationValue::ComputeDistance(aProperty,
mGecko, mGecko,
aOther.mGecko, aOther.mGecko,