Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/ipc/LayerAnimationUtils.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "LayerAnimationUtils.h"
8
#include "mozilla/ComputedTimingFunction.h" // For ComputedTimingFunction
9
#include "mozilla/layers/LayersMessages.h" // For TimingFunction etc.
10
#include "nsTimingFunction.h"
11
12
namespace mozilla {
13
namespace layers {
14
15
/* static */ Maybe<ComputedTimingFunction>
16
AnimationUtils::TimingFunctionToComputedTimingFunction(
17
  const TimingFunction& aTimingFunction)
18
0
{
19
0
  switch (aTimingFunction.type()) {
20
0
    case TimingFunction::Tnull_t:
21
0
      return Nothing();
22
0
    case TimingFunction::TCubicBezierFunction: {
23
0
      CubicBezierFunction cbf = aTimingFunction.get_CubicBezierFunction();
24
0
      return Some(ComputedTimingFunction::CubicBezier(cbf.x1(), cbf.y1(),
25
0
                                                      cbf.x2(), cbf.y2()));
26
0
    }
27
0
    case TimingFunction::TStepFunction: {
28
0
      StepFunction sf = aTimingFunction.get_StepFunction();
29
0
      nsTimingFunction::Type type = sf.type() == 1 ?
30
0
        nsTimingFunction::Type::StepStart :
31
0
        nsTimingFunction::Type::StepEnd;
32
0
      return Some(ComputedTimingFunction::Steps(type, sf.steps()));
33
0
    }
34
0
    case TimingFunction::TFramesFunction: {
35
0
      FramesFunction ff = aTimingFunction.get_FramesFunction();
36
0
      return Some(ComputedTimingFunction::Frames(ff.frames()));
37
0
    }
38
0
    default:
39
0
      MOZ_ASSERT_UNREACHABLE(
40
0
        "Function must be null, bezier, step or frames");
41
0
      break;
42
0
  }
43
0
  return Nothing();
44
0
}
45
46
} // namespace layers
47
} // namespace mozilla