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 /* Code to start and animate CSS transitions. */
9 #ifndef nsTransitionManager_h_
10 #define nsTransitionManager_h_
12 #include "mozilla/dom/CSSTransition.h"
13 #include "AnimationCommon.h"
14 #include "nsISupportsImpl.h"
17 class nsCSSPropertyIDSet
;
21 enum class PseudoStyleType
: uint8_t;
22 } // namespace mozilla
24 class nsTransitionManager final
25 : public mozilla::CommonAnimationManager
<mozilla::dom::CSSTransition
> {
27 explicit nsTransitionManager(nsPresContext
* aPresContext
)
28 : mozilla::CommonAnimationManager
<mozilla::dom::CSSTransition
>(
31 ~nsTransitionManager() final
= default;
33 typedef mozilla::AnimationCollection
<mozilla::dom::CSSTransition
>
34 CSSTransitionCollection
;
37 * Update transitions for stylo.
39 bool UpdateTransitions(mozilla::dom::Element
* aElement
,
40 mozilla::PseudoStyleType aPseudoType
,
41 const mozilla::ComputedStyle
& aOldStyle
,
42 const mozilla::ComputedStyle
& aNewStyle
);
45 typedef nsTArray
<RefPtr
<mozilla::dom::CSSTransition
>>
46 OwningCSSTransitionPtrArray
;
48 // Update transitions. This will start new transitions,
49 // replace existing transitions, and stop existing transitions
50 // as needed. aDisp and aElement must be non-null.
51 // aElementTransitions is the collection of current transitions, and it
52 // could be a nullptr if we don't have any transitions.
53 bool DoUpdateTransitions(const nsStyleDisplay
& aDisp
,
54 mozilla::dom::Element
* aElement
,
55 mozilla::PseudoStyleType aPseudoType
,
56 CSSTransitionCollection
*& aElementTransitions
,
57 const mozilla::ComputedStyle
& aOldStyle
,
58 const mozilla::ComputedStyle
& aNewStyle
);
60 // Returns whether the transition actually started.
61 bool ConsiderInitiatingTransition(
62 nsCSSPropertyID aProperty
, const nsStyleDisplay
& aStyleDisplay
,
63 uint32_t transitionIdx
, mozilla::dom::Element
* aElement
,
64 mozilla::PseudoStyleType aPseudoType
,
65 CSSTransitionCollection
*& aElementTransitions
,
66 const mozilla::ComputedStyle
& aOldStyle
,
67 const mozilla::ComputedStyle
& aNewStyle
,
68 nsCSSPropertyIDSet
& aPropertiesChecked
);
71 #endif /* !defined(nsTransitionManager_h_) */