Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / nsTransitionManager.h
blobcabdf470307a5e1c70d07fcd4dbb1a3572d7fcb1
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;
18 struct nsStyleUIReset;
20 namespace mozilla {
21 class ComputedStyle;
22 enum class PseudoStyleType : uint8_t;
23 } // namespace mozilla
25 class nsTransitionManager final
26 : public mozilla::CommonAnimationManager<mozilla::dom::CSSTransition> {
27 public:
28 explicit nsTransitionManager(nsPresContext* aPresContext)
29 : mozilla::CommonAnimationManager<mozilla::dom::CSSTransition>(
30 aPresContext) {}
32 ~nsTransitionManager() final = default;
34 typedef mozilla::AnimationCollection<mozilla::dom::CSSTransition>
35 CSSTransitionCollection;
37 /**
38 * Update transitions for stylo.
40 bool UpdateTransitions(mozilla::dom::Element* aElement,
41 mozilla::PseudoStyleType aPseudoType,
42 const mozilla::ComputedStyle& aOldStyle,
43 const mozilla::ComputedStyle& aNewStyle);
45 protected:
46 typedef nsTArray<RefPtr<mozilla::dom::CSSTransition>>
47 OwningCSSTransitionPtrArray;
49 // Update transitions. This will start new transitions,
50 // replace existing transitions, and stop existing transitions
51 // as needed. aDisp and aElement must be non-null.
52 // aElementTransitions is the collection of current transitions, and it
53 // could be a nullptr if we don't have any transitions.
54 bool DoUpdateTransitions(const nsStyleUIReset& aStyle,
55 mozilla::dom::Element* aElement,
56 mozilla::PseudoStyleType aPseudoType,
57 CSSTransitionCollection*& aElementTransitions,
58 const mozilla::ComputedStyle& aOldStyle,
59 const mozilla::ComputedStyle& aNewStyle);
61 // Returns whether the transition actually started.
62 bool ConsiderInitiatingTransition(
63 nsCSSPropertyID aProperty, const nsStyleUIReset& aStyle,
64 uint32_t transitionIdx, mozilla::dom::Element* aElement,
65 mozilla::PseudoStyleType aPseudoType,
66 CSSTransitionCollection*& aElementTransitions,
67 const mozilla::ComputedStyle& aOldStyle,
68 const mozilla::ComputedStyle& aNewStyle,
69 nsCSSPropertyIDSet& aPropertiesChecked);
71 already_AddRefed<mozilla::dom::CSSTransition> DoCreateTransition(
72 nsCSSPropertyID aProperty, mozilla::dom::Element* aElement,
73 mozilla::PseudoStyleType aPseudoType,
74 const mozilla::ComputedStyle& aNewStyle,
75 CSSTransitionCollection*& aElementTransitions,
76 mozilla::TimingParams&& aTiming, mozilla::AnimationValue&& aStartValue,
77 mozilla::AnimationValue&& aEndValue,
78 mozilla::AnimationValue&& aStartForReversingTest, double aReversePortion);
80 void DoCancelTransition(mozilla::dom::Element* aElement,
81 mozilla::PseudoStyleType aPseudoType,
82 CSSTransitionCollection*& aElementTransitions,
83 size_t aIndex);
86 #endif /* !defined(nsTransitionManager_h_) */