Bug 1698786: part 2) Change some compile-time dependent `printf`s to `MOZ_LOG` in...
[gecko.git] / layout / style / nsTransitionManager.h
blob180bd6b8c2dc4d6416cc884aff85e08c8b4e500d
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"
16 class nsPresContext;
17 class nsCSSPropertyIDSet;
19 namespace mozilla {
20 class ComputedStyle;
21 enum class PseudoStyleType : uint8_t;
22 } // namespace mozilla
24 class nsTransitionManager final
25 : public mozilla::CommonAnimationManager<mozilla::dom::CSSTransition> {
26 public:
27 explicit nsTransitionManager(nsPresContext* aPresContext)
28 : mozilla::CommonAnimationManager<mozilla::dom::CSSTransition>(
29 aPresContext) {}
31 ~nsTransitionManager() final = default;
33 typedef mozilla::AnimationCollection<mozilla::dom::CSSTransition>
34 CSSTransitionCollection;
36 /**
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);
44 protected:
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_) */