Bug 1769952 - Fix running raptor on a Win10-64 VM r=sparky
[gecko.git] / dom / animation / AnimationPropertySegment.h
blob72a863985ce330d4f81e63dd17b3d334f10f1ea2
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/. */
7 #ifndef mozilla_dom_AnimationPropertySegment_h
8 #define mozilla_dom_AnimationPropertySegment_h
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
15 namespace mozilla {
17 struct AnimationPropertySegment {
18 float mFromKey, mToKey;
19 // NOTE: In the case that no keyframe for 0 or 1 offset is specified
20 // the unit of mFromValue or mToValue is eUnit_Null.
21 AnimationValue mFromValue, mToValue;
23 Maybe<ComputedTimingFunction> mTimingFunction;
24 dom::CompositeOperation mFromComposite = dom::CompositeOperation::Replace;
25 dom::CompositeOperation mToComposite = dom::CompositeOperation::Replace;
27 bool HasReplaceableValues() const {
28 return HasReplaceableFromValue() && HasReplaceableToValue();
31 bool HasReplaceableFromValue() const {
32 return !mFromValue.IsNull() &&
33 mFromComposite == dom::CompositeOperation::Replace;
36 bool HasReplaceableToValue() const {
37 return !mToValue.IsNull() &&
38 mToComposite == dom::CompositeOperation::Replace;
41 bool operator==(const AnimationPropertySegment& aOther) const {
42 return mFromKey == aOther.mFromKey && mToKey == aOther.mToKey &&
43 mFromValue == aOther.mFromValue && mToValue == aOther.mToValue &&
44 mTimingFunction == aOther.mTimingFunction &&
45 mFromComposite == aOther.mFromComposite &&
46 mToComposite == aOther.mToComposite;
48 bool operator!=(const AnimationPropertySegment& aOther) const {
49 return !(*this == aOther);
53 } // namespace mozilla
55 #endif // mozilla_dom_AnimationPropertySegment_h