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/. */
7 #ifndef nsTimingFunction_h
8 #define nsTimingFunction_h
10 #include "mozilla/ServoStyleConsts.h"
12 struct nsTimingFunction
{
13 mozilla::StyleComputedTimingFunction mTiming
;
15 explicit nsTimingFunction(
16 mozilla::StyleTimingKeyword aKeyword
= mozilla::StyleTimingKeyword::Ease
)
17 : mTiming(mozilla::StyleComputedTimingFunction::Keyword(aKeyword
)) {}
19 nsTimingFunction(float x1
, float y1
, float x2
, float y2
)
20 : mTiming(mozilla::StyleComputedTimingFunction::CubicBezier(x1
, y1
, x2
,
23 bool IsLinear() const {
24 return mTiming
.IsKeyword() &&
25 mTiming
.AsKeyword() == mozilla::StyleTimingKeyword::Linear
;
28 bool operator==(const nsTimingFunction
& aOther
) const {
29 return mTiming
== aOther
.mTiming
;
32 bool operator!=(const nsTimingFunction
& aOther
) const {
33 return !(*this == aOther
);
37 #endif // nsTimingFunction_h