mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Backed out 5 changesets (bug 1235112, bug 1237467) for nsRuleNode::Transition crashes
Backed out changeset ac21baf87df2 (bug 1235112) Backed out changeset c47a6e0a6d95 (bug 1237467) Backed out changeset 7609ca218902 (bug 1237467) Backed out changeset d63ca2677bd5 (bug 1237467) Backed out changeset 5a3d7e16b1e0 (bug 1237467) --HG-- extra : commitid : LONozKsGtli
This commit is contained in:
parent
ab5e6b6e17
commit
0ce7a5f39e
@ -19,7 +19,6 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
|
||||
#include "nsRuleProcessorData.h" // For ElementRuleProcessorData etc.
|
||||
#include "nsTArray.h"
|
||||
#include "RestyleManager.h"
|
||||
|
||||
@ -237,36 +236,17 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
CascadeLevel aCascadeLevel)
|
||||
{
|
||||
// NOTE: We need to be careful about early returns in this method where
|
||||
// we *don't* update mElementsToRestyle. When we get a call to
|
||||
// RequestRestyle that results in a call to PostRestyleForAnimation, we
|
||||
// will set a bool flag in mElementsToRestyle indicating that we've
|
||||
// called PostRestyleForAnimation so we don't need to call it again
|
||||
// until that restyle happens. During that restyle, if we arrive here
|
||||
// and *don't* update mElementsToRestyle we'll continue to skip calling
|
||||
// PostRestyleForAnimation from RequestRestyle.
|
||||
|
||||
if (!mPresContext || !mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mPresContext->RestyleManager()->SkipAnimationRules()) {
|
||||
// We don't need to worry about updating mElementsToRestyle in this case
|
||||
// since this is not the animation restyle we requested when we called
|
||||
// PostRestyleForAnimation (see comment at start of this method).
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effectSet) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effectSet) {
|
||||
// If the EffectSet has been removed but the element has been marked as
|
||||
// needing an animation restyle, we should act as if that animation
|
||||
// restyle has now been completed.
|
||||
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
|
||||
PseudoElementHashKey key = { aElement, aPseudoType };
|
||||
elementsToRestyle.Remove(key);
|
||||
|
||||
if (mPresContext->RestyleManager()->SkipAnimationRules()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -700,110 +680,4 @@ EffectCompositor::GetPresContext(Element* aElement)
|
||||
return shell->GetPresContext();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
//
|
||||
// Nested class: AnimationStyleRuleProcessor
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS(EffectCompositor::AnimationStyleRuleProcessor,
|
||||
nsIStyleRuleProcessor)
|
||||
|
||||
nsRestyleHint
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasStateDependentStyle(
|
||||
StateRuleProcessorData* aData)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasStateDependentStyle(
|
||||
PseudoElementStateRuleProcessorData* aData)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
bool
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasDocumentStateDependentStyle(
|
||||
StateRuleProcessorData* aData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasAttributeDependentStyle(
|
||||
AttributeRuleProcessorData* aData,
|
||||
RestyleHintData& aRestyleHintDataResult)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
bool
|
||||
EffectCompositor::AnimationStyleRuleProcessor::MediumFeaturesChanged(
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
ElementRuleProcessorData* aData)
|
||||
{
|
||||
nsIStyleRule *rule =
|
||||
mCompositor->GetAnimationRule(aData->mElement,
|
||||
nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
||||
mCascadeLevel);
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
PseudoElementRuleProcessorData* aData)
|
||||
{
|
||||
if (aData->mPseudoType != nsCSSPseudoElements::ePseudo_before &&
|
||||
aData->mPseudoType != nsCSSPseudoElements::ePseudo_after) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIStyleRule *rule =
|
||||
mCompositor->GetAnimationRule(aData->mElement,
|
||||
aData->mPseudoType,
|
||||
mCascadeLevel);
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
AnonBoxRuleProcessorData* aData)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
XULTreeRuleProcessorData* aData)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t
|
||||
EffectCompositor::AnimationStyleRuleProcessor::SizeOfExcludingThis(
|
||||
MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
EffectCompositor::AnimationStyleRuleProcessor::SizeOfIncludingThis(
|
||||
MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/OwningNonNull.h"
|
||||
#include "mozilla/Pair.h"
|
||||
#include "mozilla/PseudoElementHashEntry.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
@ -17,7 +16,6 @@
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsCSSPropertySet;
|
||||
@ -41,13 +39,7 @@ class EffectCompositor
|
||||
public:
|
||||
explicit EffectCompositor(nsPresContext* aPresContext)
|
||||
: mPresContext(aPresContext)
|
||||
{
|
||||
for (size_t i = 0; i < kCascadeLevelCount; i++) {
|
||||
CascadeLevel cascadeLevel = CascadeLevel(i);
|
||||
mRuleProcessors[cascadeLevel] =
|
||||
new AnimationStyleRuleProcessor(this, cascadeLevel);
|
||||
}
|
||||
}
|
||||
{ }
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EffectCompositor)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(EffectCompositor)
|
||||
@ -131,11 +123,6 @@ public:
|
||||
// elements.
|
||||
void AddStyleUpdatesTo(RestyleTracker& aTracker);
|
||||
|
||||
nsIStyleRuleProcessor* RuleProcessor(CascadeLevel aCascadeLevel) const
|
||||
{
|
||||
return mRuleProcessors[aCascadeLevel];
|
||||
}
|
||||
|
||||
static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
nsCSSProperty aProperty);
|
||||
|
||||
@ -227,51 +214,6 @@ private:
|
||||
EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
|
||||
nsDataHashtable<PseudoElementHashEntry, bool>>
|
||||
mElementsToRestyle;
|
||||
|
||||
class AnimationStyleRuleProcessor final : public nsIStyleRuleProcessor
|
||||
{
|
||||
public:
|
||||
AnimationStyleRuleProcessor(EffectCompositor* aCompositor,
|
||||
CascadeLevel aCascadeLevel)
|
||||
: mCompositor(aCompositor)
|
||||
, mCascadeLevel(aCascadeLevel)
|
||||
{
|
||||
MOZ_ASSERT(aCompositor);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRuleProcessor (parts)
|
||||
nsRestyleHint HasStateDependentStyle(
|
||||
StateRuleProcessorData* aData) override;
|
||||
nsRestyleHint HasStateDependentStyle(
|
||||
PseudoElementStateRuleProcessorData* aData) override;
|
||||
bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) override;
|
||||
nsRestyleHint HasAttributeDependentStyle(
|
||||
AttributeRuleProcessorData* aData,
|
||||
RestyleHintData& aRestyleHintDataResult) override;
|
||||
bool MediumFeaturesChanged(nsPresContext* aPresContext) override;
|
||||
void RulesMatching(ElementRuleProcessorData* aData) override;
|
||||
void RulesMatching(PseudoElementRuleProcessorData* aData) override;
|
||||
void RulesMatching(AnonBoxRuleProcessorData* aData) override;
|
||||
#ifdef MOZ_XUL
|
||||
void RulesMatching(XULTreeRuleProcessorData* aData) override;
|
||||
#endif
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
|
||||
private:
|
||||
~AnimationStyleRuleProcessor() = default;
|
||||
|
||||
EffectCompositor* mCompositor;
|
||||
CascadeLevel mCascadeLevel;
|
||||
};
|
||||
|
||||
EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
|
||||
OwningNonNull<AnimationStyleRuleProcessor>>
|
||||
mRuleProcessors;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -108,24 +108,6 @@ EffectSet::GetOrCreateEffectSet(dom::Element* aElement,
|
||||
return effectSet;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
EffectSet::DestroyEffectSet(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType)
|
||||
{
|
||||
nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
|
||||
EffectSet* effectSet =
|
||||
static_cast<EffectSet*>(aElement->GetProperty(propName));
|
||||
if (!effectSet) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!effectSet->IsBeingEnumerated(),
|
||||
"Should not destroy an effect set while it is being enumerated");
|
||||
effectSet = nullptr;
|
||||
|
||||
aElement->DeleteProperty(propName);
|
||||
}
|
||||
|
||||
void
|
||||
EffectSet::UpdateAnimationGeneration(nsPresContext* aPresContext)
|
||||
{
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define mozilla_EffectSet_h
|
||||
|
||||
#include "mozilla/AnimValuesStyleRule.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
@ -33,7 +32,6 @@ public:
|
||||
EffectSet()
|
||||
: mCascadeNeedsUpdate(false)
|
||||
, mAnimationGeneration(0)
|
||||
, mActiveIterators(0)
|
||||
#ifdef DEBUG
|
||||
, mCalledPropertyDtor(false)
|
||||
#endif
|
||||
@ -45,9 +43,6 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(mCalledPropertyDtor,
|
||||
"must call destructor through element property dtor");
|
||||
MOZ_ASSERT(mActiveIterators == 0,
|
||||
"Effect set should not be destroyed while it is being "
|
||||
"enumerated");
|
||||
MOZ_COUNT_DTOR(EffectSet);
|
||||
}
|
||||
static void PropertyDtor(void* aObject, nsIAtom* aPropertyName,
|
||||
@ -61,8 +56,6 @@ public:
|
||||
static EffectSet* GetEffectSet(const nsIFrame* aFrame);
|
||||
static EffectSet* GetOrCreateEffectSet(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType);
|
||||
static void DestroyEffectSet(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType);
|
||||
|
||||
void AddEffect(dom::KeyframeEffectReadOnly& aEffect);
|
||||
void RemoveEffect(dom::KeyframeEffectReadOnly& aEffect);
|
||||
@ -81,35 +74,20 @@ public:
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
explicit Iterator(EffectSet& aEffectSet)
|
||||
: mEffectSet(aEffectSet)
|
||||
, mHashIterator(mozilla::Move(aEffectSet.mEffects.Iter()))
|
||||
, mIsEndIterator(false)
|
||||
{
|
||||
mEffectSet.mActiveIterators++;
|
||||
}
|
||||
|
||||
explicit Iterator(OwningEffectSet::Iterator&& aHashIterator)
|
||||
: mHashIterator(mozilla::Move(aHashIterator))
|
||||
, mIsEndIterator(false) { }
|
||||
Iterator(Iterator&& aOther)
|
||||
: mEffectSet(aOther.mEffectSet)
|
||||
, mHashIterator(mozilla::Move(aOther.mHashIterator))
|
||||
, mIsEndIterator(aOther.mIsEndIterator)
|
||||
{
|
||||
mEffectSet.mActiveIterators++;
|
||||
}
|
||||
: mHashIterator(mozilla::Move(aOther.mHashIterator))
|
||||
, mIsEndIterator(aOther.mIsEndIterator) { }
|
||||
|
||||
static Iterator EndIterator(EffectSet& aEffectSet)
|
||||
static Iterator EndIterator(OwningEffectSet::Iterator&& aHashIterator)
|
||||
{
|
||||
Iterator result(aEffectSet);
|
||||
Iterator result(mozilla::Move(aHashIterator));
|
||||
result.mIsEndIterator = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
~Iterator()
|
||||
{
|
||||
MOZ_ASSERT(mEffectSet.mActiveIterators > 0);
|
||||
mEffectSet.mActiveIterators--;
|
||||
}
|
||||
|
||||
bool operator!=(const Iterator& aOther) const {
|
||||
if (Done() || aOther.Done()) {
|
||||
return Done() != aOther.Done();
|
||||
@ -139,19 +117,15 @@ public:
|
||||
return mIsEndIterator || mHashIterator.Done();
|
||||
}
|
||||
|
||||
EffectSet& mEffectSet;
|
||||
OwningEffectSet::Iterator mHashIterator;
|
||||
bool mIsEndIterator;
|
||||
};
|
||||
|
||||
friend class Iterator;
|
||||
|
||||
Iterator begin() { return Iterator(*this); }
|
||||
Iterator end() { return Iterator::EndIterator(*this); }
|
||||
#ifdef DEBUG
|
||||
bool IsBeingEnumerated() const { return mActiveIterators != 0; }
|
||||
#endif
|
||||
|
||||
Iterator begin() { return Iterator(mEffects.Iter()); }
|
||||
Iterator end()
|
||||
{
|
||||
return Iterator::EndIterator(mEffects.Iter());
|
||||
}
|
||||
bool IsEmpty() const { return mEffects.IsEmpty(); }
|
||||
|
||||
RefPtr<AnimValuesStyleRule>& AnimationRule(EffectCompositor::CascadeLevel
|
||||
@ -221,10 +195,6 @@ private:
|
||||
// the animation manager.
|
||||
uint64_t mAnimationGeneration;
|
||||
|
||||
// Track how many iterators are referencing this effect set when we are
|
||||
// destroyed, we can assert that nothing is still pointing to us.
|
||||
DebugOnly<uint64_t> mActiveIterators;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool mCalledPropertyDtor;
|
||||
#endif
|
||||
|
@ -186,14 +186,6 @@ KeyframeEffectReadOnly::NotifyAnimationTimingUpdated()
|
||||
RequestRestyle(mTarget, mPseudoType, restyleType,
|
||||
mAnimation->CascadeLevel());
|
||||
}
|
||||
|
||||
// If we're not relevant, we will have been removed from the EffectSet.
|
||||
// As a result, when the restyle we requested above is fulfilled, our
|
||||
// ComposeStyle will not get called and mProgressOnLastCompose will not
|
||||
// be updated. Instead, we need to manually clear it.
|
||||
if (!isRelevant) {
|
||||
mProgressOnLastCompose.SetNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,9 +615,6 @@ KeyframeEffectReadOnly::UpdateTargetRegistration()
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
|
||||
if (effectSet) {
|
||||
effectSet->RemoveEffect(*this);
|
||||
if (effectSet->IsEmpty()) {
|
||||
EffectSet::DestroyEffectSet(mTarget, mPseudoType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +135,121 @@ CommonAnimationManager::GetAnimationCollection(const nsIFrame* aFrame)
|
||||
false /* aCreateIfNeeded */);
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
CommonAnimationManager::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
CommonAnimationManager::HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
bool
|
||||
CommonAnimationManager::HasDocumentStateDependentStyle(StateRuleProcessorData* aData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
CommonAnimationManager::HasAttributeDependentStyle(
|
||||
AttributeRuleProcessorData* aData,
|
||||
RestyleHintData& aRestyleHintDataResult)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
CommonAnimationManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
CommonAnimationManager::RulesMatching(ElementRuleProcessorData* aData)
|
||||
{
|
||||
MOZ_ASSERT(aData->mPresContext == mPresContext,
|
||||
"pres context mismatch");
|
||||
|
||||
EffectCompositor::CascadeLevel cascadeLevel =
|
||||
IsAnimationManager() ?
|
||||
EffectCompositor::CascadeLevel::Animations :
|
||||
EffectCompositor::CascadeLevel::Transitions;
|
||||
nsCSSPseudoElements::Type pseudoType =
|
||||
nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
||||
|
||||
nsIStyleRule *rule =
|
||||
mPresContext->EffectCompositor()->GetAnimationRule(aData->mElement,
|
||||
pseudoType,
|
||||
cascadeLevel);
|
||||
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
CommonAnimationManager::RulesMatching(PseudoElementRuleProcessorData* aData)
|
||||
{
|
||||
MOZ_ASSERT(aData->mPresContext == mPresContext,
|
||||
"pres context mismatch");
|
||||
if (aData->mPseudoType != nsCSSPseudoElements::ePseudo_before &&
|
||||
aData->mPseudoType != nsCSSPseudoElements::ePseudo_after) {
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: Do we really want to be the only thing keeping a
|
||||
// pseudo-element alive? I *think* the non-animation restyle should
|
||||
// handle that, but should add a test.
|
||||
|
||||
EffectCompositor::CascadeLevel cascadeLevel =
|
||||
IsAnimationManager() ?
|
||||
EffectCompositor::CascadeLevel::Animations :
|
||||
EffectCompositor::CascadeLevel::Transitions;
|
||||
nsIStyleRule *rule =
|
||||
mPresContext->EffectCompositor()->GetAnimationRule(aData->mElement,
|
||||
aData->mPseudoType,
|
||||
cascadeLevel);
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
CommonAnimationManager::RulesMatching(AnonBoxRuleProcessorData* aData)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
/* virtual */ void
|
||||
CommonAnimationManager::RulesMatching(XULTreeRuleProcessorData* aData)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* virtual */ size_t
|
||||
CommonAnimationManager::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mElementCollections
|
||||
//
|
||||
// The following members are not measured
|
||||
// - mPresContext, because it's non-owning
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
CommonAnimationManager::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
CommonAnimationManager::ExtractComputedValueForTransition(
|
||||
nsCSSProperty aProperty,
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define mozilla_css_AnimationCommon_h
|
||||
|
||||
#include <algorithm> // For <std::stable_sort>
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsCSSProperty.h"
|
||||
#include "nsDisplayList.h" // For nsDisplayItem::Type
|
||||
@ -32,10 +33,29 @@ namespace mozilla {
|
||||
|
||||
struct AnimationCollection;
|
||||
|
||||
class CommonAnimationManager {
|
||||
class CommonAnimationManager : public nsIStyleRuleProcessor {
|
||||
public:
|
||||
explicit CommonAnimationManager(nsPresContext *aPresContext);
|
||||
|
||||
// nsIStyleRuleProcessor (parts)
|
||||
virtual nsRestyleHint HasStateDependentStyle(StateRuleProcessorData* aData) override;
|
||||
virtual nsRestyleHint HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData) override;
|
||||
virtual bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) override;
|
||||
virtual nsRestyleHint
|
||||
HasAttributeDependentStyle(AttributeRuleProcessorData* aData,
|
||||
RestyleHintData& aRestyleHintDataResult) override;
|
||||
virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) override;
|
||||
virtual void RulesMatching(ElementRuleProcessorData* aData) override;
|
||||
virtual void RulesMatching(PseudoElementRuleProcessorData* aData) override;
|
||||
virtual void RulesMatching(AnonBoxRuleProcessorData* aData) override;
|
||||
#ifdef MOZ_XUL
|
||||
virtual void RulesMatching(XULTreeRuleProcessorData* aData) override;
|
||||
#endif
|
||||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
|
||||
// NOTE: This can return null after Disconnect().
|
||||
nsPresContext* PresContext() const { return mPresContext; }
|
||||
|
||||
|
@ -298,8 +298,29 @@ CSSAnimation::ElapsedTimeToTimeStamp(const StickyTimeDuration&
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(nsAnimationManager, mEventDispatcher)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsAnimationManager, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsAnimationManager, Release)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAnimationManager)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAnimationManager)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAnimationManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStyleRuleProcessor)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStyleRuleProcessor)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
/* virtual */ size_t
|
||||
nsAnimationManager::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mEventDispatcher
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsAnimationManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
nsIStyleRule*
|
||||
nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
||||
|
@ -280,8 +280,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsAnimationManager)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsAnimationManager)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsAnimationManager)
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
// nsIStyleRuleProcessor (parts)
|
||||
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
|
||||
/**
|
||||
* Return the style rule that RulesMatching should add for
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsRuleProcessorData.h"
|
||||
#include "nsTransitionManager.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsStyleSheetService.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
@ -450,13 +451,11 @@ nsStyleSet::GatherRuleProcessors(SheetType aType)
|
||||
// levels that do not contain CSS style sheets
|
||||
case SheetType::Animation:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] = PresContext()->EffectCompositor()->
|
||||
RuleProcessor(EffectCompositor::CascadeLevel::Animations);
|
||||
mRuleProcessors[aType] = PresContext()->AnimationManager();
|
||||
return NS_OK;
|
||||
case SheetType::Transition:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] = PresContext()->EffectCompositor()->
|
||||
RuleProcessor(EffectCompositor::CascadeLevel::Transitions);
|
||||
mRuleProcessors[aType] = PresContext()->TransitionManager();
|
||||
return NS_OK;
|
||||
case SheetType::StyleAttr:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
|
@ -205,8 +205,13 @@ CSSTransition::HasLowerCompositeOrderThan(const CSSTransition& aOther) const
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(nsTransitionManager, mEventDispatcher)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsTransitionManager, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsTransitionManager, Release)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTransitionManager)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTransitionManager)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTransitionManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStyleRuleProcessor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
void
|
||||
nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
||||
@ -781,3 +786,23 @@ nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
|
||||
collection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nsIStyleRuleProcessor implementation
|
||||
*/
|
||||
|
||||
/* virtual */ size_t
|
||||
nsTransitionManager::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mEventDispatcher
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsTransitionManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
@ -253,8 +253,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsTransitionManager)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTransitionManager)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsTransitionManager)
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
typedef mozilla::AnimationCollection AnimationCollection;
|
||||
|
||||
@ -296,6 +296,11 @@ public:
|
||||
return mInAnimationOnlyStyleUpdate;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
MOZ_MUST_OVERRIDE override;
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
MOZ_MUST_OVERRIDE override;
|
||||
|
||||
void QueueEvent(mozilla::TransitionEventInfo&& aEventInfo)
|
||||
{
|
||||
mEventDispatcher.QueueEvent(
|
||||
|
Loading…
Reference in New Issue
Block a user