gecko-dev/layout/style/nsTransitionManager.h
2012-05-21 12:12:37 +01:00

81 lines
3.2 KiB
C++

/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Code to start and animate CSS transitions. */
#ifndef nsTransitionManager_h_
#define nsTransitionManager_h_
#include "AnimationCommon.h"
#include "nsCSSPseudoElements.h"
class nsStyleContext;
class nsPresContext;
class nsCSSPropertySet;
struct nsTransition;
struct ElementTransitions;
class nsTransitionManager : public mozilla::css::CommonAnimationManager
{
public:
nsTransitionManager(nsPresContext *aPresContext)
: mozilla::css::CommonAnimationManager(aPresContext)
{
}
/**
* StyleContextChanged
*
* To be called from nsFrameManager::ReResolveStyleContext when the
* style of an element has changed, to initiate transitions from
* that style change. For style contexts with :before and :after
* pseudos, aElement is expected to be the generated before/after
* element.
*
* It may return a "cover rule" (see CoverTransitionStartStyleRule) to
* cover up some of the changes for the duration of the restyling of
* descendants. If it does, this function will take care of causing
* the necessary restyle afterwards, but the caller must restyle the
* element *again* with the original sequence of rules plus the
* returned cover rule as the most specific rule.
*/
already_AddRefed<nsIStyleRule>
StyleContextChanged(mozilla::dom::Element *aElement,
nsStyleContext *aOldStyleContext,
nsStyleContext *aNewStyleContext);
// nsIStyleRuleProcessor (parts)
virtual void RulesMatching(ElementRuleProcessorData* aData);
virtual void RulesMatching(PseudoElementRuleProcessorData* aData);
virtual void RulesMatching(AnonBoxRuleProcessorData* aData);
#ifdef MOZ_XUL
virtual void RulesMatching(XULTreeRuleProcessorData* aData);
#endif
virtual NS_MUST_OVERRIDE size_t
SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE;
virtual NS_MUST_OVERRIDE size_t
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE;
// nsARefreshObserver
virtual void WillRefresh(mozilla::TimeStamp aTime);
private:
void ConsiderStartingTransition(nsCSSProperty aProperty,
const nsTransition& aTransition,
mozilla::dom::Element *aElement,
ElementTransitions *&aElementTransitions,
nsStyleContext *aOldStyleContext,
nsStyleContext *aNewStyleContext,
bool *aStartedAny,
nsCSSPropertySet *aWhichStarted);
ElementTransitions* GetElementTransitions(mozilla::dom::Element *aElement,
nsCSSPseudoElements::Type aPseudoType,
bool aCreateIfNeeded);
void WalkTransitionRule(RuleProcessorData* aData,
nsCSSPseudoElements::Type aPseudoType);
};
#endif /* !defined(nsTransitionManager_h_) */