Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/AnimationPropertySegment.h
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 file,
5
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_AnimationPropertySegment_h
8
#define mozilla_dom_AnimationPropertySegment_h
9
10
#include "mozilla/ComputedTimingFunction.h"
11
#include "mozilla/Maybe.h"
12
#include "mozilla/StyleAnimationValue.h" // For AnimationValue
13
#include "mozilla/dom/BaseKeyframeTypesBinding.h" // For CompositeOperation
14
15
namespace mozilla {
16
17
struct AnimationPropertySegment
18
{
19
  float mFromKey, mToKey;
20
  // NOTE: In the case that no keyframe for 0 or 1 offset is specified
21
  // the unit of mFromValue or mToValue is eUnit_Null.
22
  AnimationValue mFromValue, mToValue;
23
24
  Maybe<ComputedTimingFunction> mTimingFunction;
25
  dom::CompositeOperation mFromComposite = dom::CompositeOperation::Replace;
26
  dom::CompositeOperation mToComposite = dom::CompositeOperation::Replace;
27
28
  bool HasReplaceableValues() const
29
0
  {
30
0
    return HasReplaceableFromValue() && HasReplaceableToValue();
31
0
  }
32
33
  bool HasReplaceableFromValue() const
34
0
  {
35
0
    return !mFromValue.IsNull() &&
36
0
           mFromComposite == dom::CompositeOperation::Replace;
37
0
  }
38
39
  bool HasReplaceableToValue() const
40
0
  {
41
0
    return !mToValue.IsNull() &&
42
0
           mToComposite == dom::CompositeOperation::Replace;
43
0
  }
44
45
  bool operator==(const AnimationPropertySegment& aOther) const
46
0
  {
47
0
    return mFromKey == aOther.mFromKey &&
48
0
           mToKey == aOther.mToKey &&
49
0
           mFromValue == aOther.mFromValue &&
50
0
           mToValue == aOther.mToValue &&
51
0
           mTimingFunction == aOther.mTimingFunction &&
52
0
           mFromComposite == aOther.mFromComposite &&
53
0
           mToComposite == aOther.mToComposite;
54
0
  }
55
  bool operator!=(const AnimationPropertySegment& aOther) const
56
0
  {
57
0
    return !(*this == aOther);
58
0
  }
59
};
60
61
}
62
63
#endif // mozilla_dom_AnimationPropertySegment_h