1 : /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is nsTransitionManager.
16 : *
17 : * The Initial Developer of the Original Code is the Mozilla Foundation.
18 : * Portions created by the Initial Developer are Copyright (C) 2009
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * L. David Baron <dbaron@dbaron.org>, Mozilla Corporation (original author)
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 2 or later (the "GPL"), or
26 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : /* Code to start and animate CSS transitions. */
39 :
40 : #ifndef nsTransitionManager_h_
41 : #define nsTransitionManager_h_
42 :
43 : #include "AnimationCommon.h"
44 : #include "nsCSSPseudoElements.h"
45 :
46 : class nsStyleContext;
47 : class nsPresContext;
48 : class nsCSSPropertySet;
49 : struct nsTransition;
50 : struct ElementTransitions;
51 :
52 : class nsTransitionManager : public mozilla::css::CommonAnimationManager
53 0 : {
54 : public:
55 0 : nsTransitionManager(nsPresContext *aPresContext)
56 0 : : mozilla::css::CommonAnimationManager(aPresContext)
57 : {
58 0 : }
59 :
60 : /**
61 : * StyleContextChanged
62 : *
63 : * To be called from nsFrameManager::ReResolveStyleContext when the
64 : * style of an element has changed, to initiate transitions from
65 : * that style change. For style contexts with :before and :after
66 : * pseudos, aElement is expected to be the generated before/after
67 : * element.
68 : *
69 : * It may return a "cover rule" (see CoverTransitionStartStyleRule) to
70 : * cover up some of the changes for the duration of the restyling of
71 : * descendants. If it does, this function will take care of causing
72 : * the necessary restyle afterwards, but the caller must restyle the
73 : * element *again* with the original sequence of rules plus the
74 : * returned cover rule as the most specific rule.
75 : */
76 : already_AddRefed<nsIStyleRule>
77 : StyleContextChanged(mozilla::dom::Element *aElement,
78 : nsStyleContext *aOldStyleContext,
79 : nsStyleContext *aNewStyleContext);
80 :
81 : // nsIStyleRuleProcessor (parts)
82 : virtual void RulesMatching(ElementRuleProcessorData* aData);
83 : virtual void RulesMatching(PseudoElementRuleProcessorData* aData);
84 : virtual void RulesMatching(AnonBoxRuleProcessorData* aData);
85 : #ifdef MOZ_XUL
86 : virtual void RulesMatching(XULTreeRuleProcessorData* aData);
87 : #endif
88 : virtual NS_MUST_OVERRIDE size_t
89 : SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE;
90 : virtual NS_MUST_OVERRIDE size_t
91 : SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE;
92 :
93 : // nsARefreshObserver
94 : virtual void WillRefresh(mozilla::TimeStamp aTime);
95 :
96 : private:
97 : void ConsiderStartingTransition(nsCSSProperty aProperty,
98 : const nsTransition& aTransition,
99 : mozilla::dom::Element *aElement,
100 : ElementTransitions *&aElementTransitions,
101 : nsStyleContext *aOldStyleContext,
102 : nsStyleContext *aNewStyleContext,
103 : bool *aStartedAny,
104 : nsCSSPropertySet *aWhichStarted);
105 : ElementTransitions* GetElementTransitions(mozilla::dom::Element *aElement,
106 : nsCSSPseudoElements::Type aPseudoType,
107 : bool aCreateIfNeeded);
108 : void WalkTransitionRule(RuleProcessorData* aData,
109 : nsCSSPseudoElements::Type aPseudoType);
110 : };
111 :
112 : #endif /* !defined(nsTransitionManager_h_) */
|