mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix division-by-zero crash that dholbert saw, although I haven't been able to, and make the code a bit more robust. (Bug 582379) r=bzbarsky a2.0=blocking
This commit is contained in:
parent
cc52f8c0a0
commit
e0c6877082
@ -204,12 +204,23 @@ ElementTransitions::EnsureStyleRuleFor(TimeStamp aRefreshTime)
|
||||
continue;
|
||||
}
|
||||
|
||||
double timePortion =
|
||||
(aRefreshTime - pt.mStartTime).ToSeconds() / pt.mDuration.ToSeconds();
|
||||
if (timePortion < 0.0)
|
||||
timePortion = 0.0; // use start value during transition-delay
|
||||
if (timePortion > 1.0)
|
||||
timePortion = 1.0; // we might be behind on flushing
|
||||
double duration = pt.mDuration.ToSeconds();
|
||||
NS_ABORT_IF_FALSE(duration >= 0.0, "negative duration forbidden");
|
||||
double timePortion;
|
||||
if (duration == 0.0) {
|
||||
if (aRefreshTime >= pt.mStartTime) {
|
||||
timePortion = 0.0;
|
||||
} else {
|
||||
timePortion = 1.0;
|
||||
}
|
||||
} else {
|
||||
timePortion = (aRefreshTime - pt.mStartTime).ToSeconds() /
|
||||
pt.mDuration.ToSeconds();
|
||||
if (timePortion < 0.0)
|
||||
timePortion = 0.0; // use start value during transition-delay
|
||||
if (timePortion > 1.0)
|
||||
timePortion = 1.0; // we might be behind on flushing
|
||||
}
|
||||
|
||||
double valuePortion =
|
||||
pt.mTimingFunction.GetSplineValue(timePortion);
|
||||
@ -636,6 +647,10 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
|
||||
pt.mProperty = aProperty;
|
||||
float delay = aTransition.GetDelay();
|
||||
float duration = aTransition.GetDuration();
|
||||
if (duration < 0.0) {
|
||||
// The spec says a negative duration is treated as zero.
|
||||
duration = 0.0;
|
||||
}
|
||||
if (durationFraction != 1.0) {
|
||||
// Negative delays are essentially part of the transition
|
||||
// function, so reduce them along with the duration, but don't
|
||||
|
Loading…
Reference in New Issue
Block a user