import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1147491, part 1 - Fix playbackRate crash due to integer rounding causing divide-by-zero. r=dholbert (7726fc9ce)
- Bug 1147491, part 2 - Disable use of BaseTimeDuration::operator/ with floating point values. r=ehsan (073909011)
- Bug 1147491 - Partially backout part 2 while figuring out B2G orange. r=orange CLOSED TREE (b37b02f50)
- Bug 1147491, part 2 - Disable use of BaseTimeDuration::operator/ with floating point values. r=ehsan (ca7cffb4d)
This commit is contained in:
2020-03-19 22:30:08 +08:00
parent ef8889749c
commit f875e0174d
4 changed files with 11 additions and 5 deletions
+4 -3
View File
@@ -107,7 +107,7 @@ AnimationPlayer::SilentlySetCurrentTime(const TimeDuration& aSeekTime)
}
} else {
mStartTime.SetValue(mTimeline->GetCurrentTime().Value() -
(aSeekTime / mPlaybackRate));
(aSeekTime.MultDouble(1 / mPlaybackRate)));
}
mPreviousCurrentTime.SetNull();
@@ -604,7 +604,8 @@ AnimationPlayer::ResumeAt(const TimeDuration& aReadyTime)
// we should use. In all other cases, we resolve it from the ready time.
if (mStartTime.IsNull()) {
if (mPlaybackRate != 0) {
mStartTime.SetValue(aReadyTime - (mHoldTime.Value() / mPlaybackRate));
mStartTime.SetValue(aReadyTime -
(mHoldTime.Value().MultDouble(1 / mPlaybackRate)));
mHoldTime.SetNull();
} else {
mStartTime.SetValue(aReadyTime);
@@ -679,7 +680,7 @@ AnimationPlayer::UpdateFinishedState(bool aSeekFlag)
!currentTime.IsNull()) {
if (aSeekFlag && !mHoldTime.IsNull()) {
mStartTime.SetValue(mTimeline->GetCurrentTime().Value() -
(mHoldTime.Value() / mPlaybackRate));
(mHoldTime.Value().MultDouble(1 / mPlaybackRate)));
}
mHoldTime.SetNull();
}
+1 -1
View File
@@ -86,7 +86,7 @@ public:
T mean()
{
MOZ_ASSERT(!empty());
return T(mTotal / mValues.length());
return T(mTotal / int64_t(mValues.length()));
}
bool empty()
+1 -1
View File
@@ -271,7 +271,7 @@ GoannaTouchDispatcher::ResampleTouchMoves(MultiTouchInput& aOutTouch, TimeStamp
TimeDuration touchDiff = currentTouch.mTimeStamp - baseTouch.mTimeStamp;
if (currentTouch.mTimeStamp < sampleTime) {
TimeDuration maxResampleTime = std::min(touchDiff / 2, mMaxPredict);
TimeDuration maxResampleTime = std::min(touchDiff / int64_t(2), mMaxPredict);
TimeStamp maxTimestamp = currentTouch.mTimeStamp + maxResampleTime;
if (sampleTime > maxTimestamp) {
sampleTime = maxTimestamp;
+5
View File
@@ -181,6 +181,11 @@ private:
// If required, use MultDouble explicitly and with care.
BaseTimeDuration operator*(const double aMultiplier) const = delete;
// Block double divisor (for the same reason, and because dividing by
// fractional values would otherwise invoke the int64_t variant, and rounding
// the passed argument can then cause divide-by-zero) - Bug 1147491.
BaseTimeDuration operator/(const double aDivisor) const = delete;
public:
BaseTimeDuration MultDouble(double aMultiplier) const
{