зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c5da825e8bd9 (bug 1343153) for timing out in dom/animation/test/crashtests/1278485-1.html, at least on Stylo. r=backout
This commit is contained in:
Родитель
1ba83457d7
Коммит
08eaa88de2
|
@ -15,41 +15,13 @@ namespace mozilla {
|
|||
class ComputedTimingFunction
|
||||
{
|
||||
public:
|
||||
static ComputedTimingFunction
|
||||
CubicBezier(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
return ComputedTimingFunction(x1, y1, x2, y2);
|
||||
}
|
||||
static ComputedTimingFunction
|
||||
Steps(nsTimingFunction::Type aType, uint32_t aSteps)
|
||||
{
|
||||
MOZ_ASSERT(aType == nsTimingFunction::Type::StepStart ||
|
||||
aType == nsTimingFunction::Type::StepEnd,
|
||||
"The type of timing function should be either step-start or "
|
||||
"step-end");
|
||||
MOZ_ASSERT(aSteps > 0, "The number of steps should be 1 or more");
|
||||
return ComputedTimingFunction(aType, aSteps);
|
||||
}
|
||||
static ComputedTimingFunction
|
||||
Frames(uint32_t aFrames)
|
||||
{
|
||||
MOZ_ASSERT(aFrames > 1, "The number of frames should be 2 or more");
|
||||
return ComputedTimingFunction(nsTimingFunction::Type::Frames, aFrames);
|
||||
}
|
||||
|
||||
ComputedTimingFunction() = default;
|
||||
explicit ComputedTimingFunction(const nsTimingFunction& aFunction)
|
||||
{
|
||||
Init(aFunction);
|
||||
}
|
||||
void Init(const nsTimingFunction& aFunction);
|
||||
|
||||
// BeforeFlag is used in step timing function.
|
||||
// https://w3c.github.io/web-animations/#before-flag
|
||||
enum class BeforeFlag {
|
||||
Unset,
|
||||
Set
|
||||
};
|
||||
void Init(const nsTimingFunction &aFunction);
|
||||
double GetValue(double aPortion, BeforeFlag aBeforeFlag) const;
|
||||
const nsSMILKeySpline* GetFunction() const
|
||||
{
|
||||
|
@ -93,14 +65,7 @@ public:
|
|||
const Maybe<ComputedTimingFunction>& aRhs);
|
||||
|
||||
private:
|
||||
ComputedTimingFunction(double x1, double y1, double x2, double y2)
|
||||
: mType(nsTimingFunction::Type::CubicBezier)
|
||||
, mTimingFunction(x1, y1, x2, y2) { }
|
||||
ComputedTimingFunction(nsTimingFunction::Type aType, uint32_t aStepsOrFrames)
|
||||
: mType(aType)
|
||||
, mStepsOrFrames(aStepsOrFrames) { }
|
||||
|
||||
nsTimingFunction::Type mType = nsTimingFunction::Type::Linear;
|
||||
nsTimingFunction::Type mType;
|
||||
nsSMILKeySpline mTimingFunction;
|
||||
uint32_t mStepsOrFrames;
|
||||
};
|
||||
|
|
|
@ -142,7 +142,9 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
|||
case eCSSUnit_Steps: {
|
||||
nsTimingFunction timingFunction;
|
||||
nsRuleNode::ComputeTimingFunction(list->mValue, timingFunction);
|
||||
return Some(ComputedTimingFunction(timingFunction));
|
||||
ComputedTimingFunction computedTimingFunction;
|
||||
computedTimingFunction.Init(timingFunction);
|
||||
return Some(computedTimingFunction);
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function list "
|
||||
|
|
|
@ -672,10 +672,12 @@ AsyncPanZoomController::InitializeGlobalState()
|
|||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
gZoomAnimationFunction = new ComputedTimingFunction(
|
||||
gZoomAnimationFunction = new ComputedTimingFunction();
|
||||
gZoomAnimationFunction->Init(
|
||||
nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE));
|
||||
ClearOnShutdown(&gZoomAnimationFunction);
|
||||
gVelocityCurveFunction = new ComputedTimingFunction(
|
||||
gVelocityCurveFunction = new ComputedTimingFunction();
|
||||
gVelocityCurveFunction->Init(
|
||||
nsTimingFunction(gfxPrefs::APZCurveFunctionX1(),
|
||||
gfxPrefs::APZCurveFunctionY1(),
|
||||
gfxPrefs::APZCurveFunctionX2(),
|
||||
|
|
|
@ -19,20 +19,26 @@ AnimationUtils::TimingFunctionToComputedTimingFunction(
|
|||
case TimingFunction::Tnull_t:
|
||||
return Nothing();
|
||||
case TimingFunction::TCubicBezierFunction: {
|
||||
ComputedTimingFunction result;
|
||||
CubicBezierFunction cbf = aTimingFunction.get_CubicBezierFunction();
|
||||
return Some(ComputedTimingFunction::CubicBezier(cbf.x1(), cbf.y1(),
|
||||
cbf.x2(), cbf.y2()));
|
||||
result.Init(nsTimingFunction(cbf.x1(), cbf.y1(), cbf.x2(), cbf.y2()));
|
||||
return Some(result);
|
||||
}
|
||||
case TimingFunction::TStepFunction: {
|
||||
StepFunction sf = aTimingFunction.get_StepFunction();
|
||||
nsTimingFunction::Type type = sf.type() == 1 ?
|
||||
nsTimingFunction::Type::StepStart :
|
||||
nsTimingFunction::Type::StepEnd;
|
||||
return Some(ComputedTimingFunction::Steps(type, sf.steps()));
|
||||
ComputedTimingFunction result;
|
||||
result.Init(nsTimingFunction(type, sf.steps()));
|
||||
return Some(result);
|
||||
}
|
||||
case TimingFunction::TFramesFunction: {
|
||||
FramesFunction ff = aTimingFunction.get_FramesFunction();
|
||||
return Some(ComputedTimingFunction::Frames(ff.frames()));
|
||||
ComputedTimingFunction result;
|
||||
result.Init(nsTimingFunction(nsTimingFunction::Type::Frames,
|
||||
ff.frames()));
|
||||
return Some(result);
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
|
|
Загрузка…
Ссылка в новой задаче