Line data Source code
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_KeyframeEffect_h
8 : #define mozilla_dom_KeyframeEffect_h
9 :
10 : #include "nsWrapperCache.h"
11 : #include "mozilla/dom/BindingDeclarations.h"
12 : #include "mozilla/dom/KeyframeEffectReadOnly.h"
13 : #include "mozilla/AnimationTarget.h" // For (Non)OwningAnimationTarget
14 : #include "mozilla/Maybe.h"
15 :
16 : struct JSContext;
17 : class JSObject;
18 : class nsIDocument;
19 :
20 : namespace mozilla {
21 :
22 : class ErrorResult;
23 : struct KeyframeEffectParams;
24 : struct TimingParams;
25 :
26 : namespace dom {
27 :
28 : class ElementOrCSSPseudoElement;
29 : class GlobalObject;
30 : class UnrestrictedDoubleOrKeyframeAnimationOptions;
31 : class UnrestrictedDoubleOrKeyframeEffectOptions;
32 :
33 0 : class KeyframeEffect : public KeyframeEffectReadOnly
34 : {
35 : public:
36 : KeyframeEffect(nsIDocument* aDocument,
37 : const Maybe<OwningAnimationTarget>& aTarget,
38 : const TimingParams& aTiming,
39 : const KeyframeEffectParams& aOptions);
40 :
41 : JSObject* WrapObject(JSContext* aCx,
42 : JS::Handle<JSObject*> aGivenProto) override;
43 :
44 : static already_AddRefed<KeyframeEffect>
45 : Constructor(const GlobalObject& aGlobal,
46 : const Nullable<ElementOrCSSPseudoElement>& aTarget,
47 : JS::Handle<JSObject*> aKeyframes,
48 : const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
49 : ErrorResult& aRv);
50 :
51 : static already_AddRefed<KeyframeEffect>
52 : Constructor(const GlobalObject& aGlobal,
53 : KeyframeEffectReadOnly& aSource,
54 : ErrorResult& aRv);
55 :
56 : // Variant of Constructor that accepts a KeyframeAnimationOptions object
57 : // for use with for Animatable.animate.
58 : // Not exposed to content.
59 : static already_AddRefed<KeyframeEffect>
60 : Constructor(const GlobalObject& aGlobal,
61 : const Nullable<ElementOrCSSPseudoElement>& aTarget,
62 : JS::Handle<JSObject*> aKeyframes,
63 : const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
64 : ErrorResult& aRv);
65 :
66 : void NotifySpecifiedTimingUpdated();
67 :
68 : // This method calls GetTargetStyleContext which is not safe to use when
69 : // we are in the middle of updating style. If we need to use this when
70 : // updating style, we should pass the nsStyleContext into this method and use
71 : // that to update the properties rather than calling
72 : // GetStyleContext.
73 : void SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget);
74 :
75 0 : IterationCompositeOperation IterationComposite(CallerType aCallerType)
76 : {
77 0 : return KeyframeEffectReadOnly::IterationComposite();
78 : }
79 : void SetIterationComposite(
80 : const IterationCompositeOperation& aIterationComposite,
81 : CallerType aCallerType);
82 : void SetComposite(const CompositeOperation& aComposite);
83 : };
84 :
85 : } // namespace dom
86 : } // namespace mozilla
87 :
88 : #endif // mozilla_dom_KeyframeEffect_h
|