Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 "mozilla/dom/AnimationEffectTimingReadOnly.h"
8 :
9 : #include "mozilla/AnimationUtils.h"
10 : #include "mozilla/dom/AnimatableBinding.h"
11 : #include "mozilla/dom/AnimationEffectTimingReadOnlyBinding.h"
12 : #include "mozilla/dom/CSSPseudoElement.h"
13 : #include "mozilla/dom/KeyframeEffectBinding.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AnimationEffectTimingReadOnly, mDocument)
19 :
20 0 : NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AnimationEffectTimingReadOnly, AddRef)
21 0 : NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AnimationEffectTimingReadOnly, Release)
22 :
23 : JSObject*
24 0 : AnimationEffectTimingReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
25 : {
26 0 : return AnimationEffectTimingReadOnlyBinding::Wrap(aCx, this, aGivenProto);
27 : }
28 :
29 : void
30 0 : AnimationEffectTimingReadOnly::GetDuration(
31 : OwningUnrestrictedDoubleOrString& aRetVal) const
32 : {
33 0 : if (mTiming.Duration()) {
34 0 : aRetVal.SetAsUnrestrictedDouble() = mTiming.Duration()->ToMilliseconds();
35 : } else {
36 0 : aRetVal.SetAsString().AssignLiteral("auto");
37 : }
38 0 : }
39 :
40 : void
41 0 : AnimationEffectTimingReadOnly::GetEasing(nsString& aRetVal) const
42 : {
43 0 : if (mTiming.TimingFunction()) {
44 0 : mTiming.TimingFunction()->AppendToString(aRetVal);
45 : } else {
46 0 : aRetVal.AssignLiteral("linear");
47 : }
48 0 : }
49 :
50 : } // namespace dom
51 : } // namespace mozilla
|