From 8c08c46bf6b3cc3a9afa9c41e81e96034f5ac51d Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Tue, 26 Jan 2016 21:14:00 +0100 Subject: [PATCH] Bug 1216842 - Part 1: Add null_t into TimingFunction to skip calculation of linear timing function. r=cam This is a patch for compositor side to represent linear function as null_t/Nothing(). Also the first argument of ToTimingFunction changes to a Maybe. As a result of this change we can also use ToTimingFunction for animation effect's timing function. --- gfx/layers/ipc/LayersMessages.ipdlh | 1 + layout/base/nsDisplayList.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index d341a7e586ca..098e033f58a8 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -93,6 +93,7 @@ struct StepFunction { }; union TimingFunction { + null_t; CubicBezierFunction; StepFunction; }; diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 4829c9777fef..ada5e37d95f1 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -347,16 +347,20 @@ static void AddTransformFunctions(nsCSSValueList* aList, } static TimingFunction -ToTimingFunction(const ComputedTimingFunction& aCTF) +ToTimingFunction(Maybe aCTF) { - if (aCTF.HasSpline()) { - const nsSMILKeySpline* spline = aCTF.GetFunction(); + if (aCTF.isNothing()) { + return TimingFunction(null_t()); + } + + if (aCTF->HasSpline()) { + const nsSMILKeySpline* spline = aCTF->GetFunction(); return TimingFunction(CubicBezierFunction(spline->X1(), spline->Y1(), spline->X2(), spline->Y2())); } - uint32_t type = aCTF.GetType() == nsTimingFunction::Type::StepStart ? 1 : 2; - return TimingFunction(StepFunction(aCTF.GetSteps(), type)); + uint32_t type = aCTF->GetType() == nsTimingFunction::Type::StepStart ? 1 : 2; + return TimingFunction(StepFunction(aCTF->GetSteps(), type)); } static void @@ -421,7 +425,7 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty, animSegment->startPortion() = segment.mFromKey; animSegment->endPortion() = segment.mToKey; - animSegment->sampleFn() = ToTimingFunction(segment.mTimingFunction); + animSegment->sampleFn() = ToTimingFunction(Some(segment.mTimingFunction)); } }