From c4a38c62e455dbc7a5d16c4e4a821e9b7c9d60de Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Fri, 4 Dec 2015 08:34:17 +0900 Subject: [PATCH] Bug 1226118 part 13 - Move the GetAnimationCollection definitions side-by-side; r=dholbert This is to match the order in the header file and because in the next patch I'd like to somewhat re-implement one method in terms of the other and having them side-by-side will make it easier to read the code. This patch makes no code changes whatsoever besides shifting the placement of the function definitions within the .cpp file. --- layout/style/AnimationCommon.cpp | 98 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index aa26115b5cc..7928ab8eee4 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -66,6 +66,55 @@ CommonAnimationManager::RemoveAllElementCollections() } } +AnimationCollection* +CommonAnimationManager::GetAnimationCollection(dom::Element *aElement, + nsCSSPseudoElements::Type + aPseudoType, + bool aCreateIfNeeded) +{ + if (!aCreateIfNeeded && mElementCollections.isEmpty()) { + // Early return for the most common case. + return nullptr; + } + + nsIAtom *propName; + if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) { + propName = GetAnimationsAtom(); + } else if (aPseudoType == nsCSSPseudoElements::ePseudo_before) { + propName = GetAnimationsBeforeAtom(); + } else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) { + propName = GetAnimationsAfterAtom(); + } else { + NS_ASSERTION(!aCreateIfNeeded, + "should never try to create transitions for pseudo " + "other than :before or :after"); + return nullptr; + } + AnimationCollection* collection = + static_cast(aElement->GetProperty(propName)); + if (!collection && aCreateIfNeeded) { + // FIXME: Consider arena-allocating? + collection = new AnimationCollection(aElement, propName, this); + nsresult rv = + aElement->SetProperty(propName, collection, + &AnimationCollection::PropertyDtor, false); + if (NS_FAILED(rv)) { + NS_WARNING("SetProperty failed"); + // The collection must be destroyed via PropertyDtor, otherwise + // mCalledPropertyDtor assertion is triggered in destructor. + AnimationCollection::PropertyDtor(aElement, propName, collection, nullptr); + return nullptr; + } + if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) { + aElement->SetMayHaveAnimations(); + } + + AddElementCollection(collection); + } + + return collection; +} + AnimationCollection* CommonAnimationManager::GetAnimationCollection(const nsIFrame* aFrame) { @@ -235,55 +284,6 @@ CommonAnimationManager::ExtractComputedValueForTransition( return result; } -AnimationCollection* -CommonAnimationManager::GetAnimationCollection(dom::Element *aElement, - nsCSSPseudoElements::Type - aPseudoType, - bool aCreateIfNeeded) -{ - if (!aCreateIfNeeded && mElementCollections.isEmpty()) { - // Early return for the most common case. - return nullptr; - } - - nsIAtom *propName; - if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) { - propName = GetAnimationsAtom(); - } else if (aPseudoType == nsCSSPseudoElements::ePseudo_before) { - propName = GetAnimationsBeforeAtom(); - } else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) { - propName = GetAnimationsAfterAtom(); - } else { - NS_ASSERTION(!aCreateIfNeeded, - "should never try to create transitions for pseudo " - "other than :before or :after"); - return nullptr; - } - AnimationCollection* collection = - static_cast(aElement->GetProperty(propName)); - if (!collection && aCreateIfNeeded) { - // FIXME: Consider arena-allocating? - collection = new AnimationCollection(aElement, propName, this); - nsresult rv = - aElement->SetProperty(propName, collection, - &AnimationCollection::PropertyDtor, false); - if (NS_FAILED(rv)) { - NS_WARNING("SetProperty failed"); - // The collection must be destroyed via PropertyDtor, otherwise - // mCalledPropertyDtor assertion is triggered in destructor. - AnimationCollection::PropertyDtor(aElement, propName, collection, nullptr); - return nullptr; - } - if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) { - aElement->SetMayHaveAnimations(); - } - - AddElementCollection(collection); - } - - return collection; -} - void CommonAnimationManager::FlushAnimations() {