Bug 1353208 - Factor out nsSMILCompositor::GetCSSPropertyToAnimate helper method; r=dholbert

In bug 1315874 we will create a method to check if we're likely to need to
resolve base styles or not, and for that we need to extract the check for
whether or not we're animating a CSS property.

MozReview-Commit-ID: 9Ybsi91fro8

--HG--
extra : rebase_source : e2f72a7d807bfbe026fbd1a603cd993c3d502584
This commit is contained in:
Brian Birtles 2017-03-30 13:10:08 +09:00
Родитель 1efabc2e0b
Коммит e96d223104
2 изменённых файлов: 32 добавлений и 16 удалений

Просмотреть файл

@ -127,11 +127,28 @@ nsSMILCompositor::ClearAnimationEffects()
// --------------------------
UniquePtr<nsISMILAttr>
nsSMILCompositor::CreateSMILAttr()
{
nsCSSPropertyID propID = GetCSSPropertyToAnimate();
if (propID != eCSSProperty_UNKNOWN) {
return MakeUnique<nsSMILCSSProperty>(propID, mKey.mElement.get());
}
return mKey.mElement->GetAnimatedAttr(mKey.mAttributeNamespaceID,
mKey.mAttributeName);
}
nsCSSPropertyID
nsSMILCompositor::GetCSSPropertyToAnimate() const
{
nsCSSPropertyID propID =
nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
CSSEnabledState::eForAllContent);
if (nsSMILCSSProperty::IsPropertyAnimatable(propID)) {
if (!nsSMILCSSProperty::IsPropertyAnimatable(propID)) {
return eCSSProperty_UNKNOWN;
}
// If we are animating the 'width' or 'height' of an outer SVG
// element we should animate it as a CSS property, but for other elements
// (e.g. <rect>) we should animate it as a length attribute.
@ -141,13 +158,8 @@ nsSMILCompositor::CreateSMILAttr()
mKey.mAttributeName == nsGkAtoms::height) &&
mKey.mElement->GetNameSpaceID() == kNameSpaceID_SVG &&
!mKey.mElement->IsAttributeMapped(mKey.mAttributeName);
if (!animateAsAttr) {
return MakeUnique<nsSMILCSSProperty>(propID, mKey.mElement.get());
}
}
return mKey.mElement->GetAnimatedAttr(mKey.mAttributeNamespaceID,
mKey.mAttributeName);
return animateAsAttr ? eCSSProperty_UNKNOWN : propID;
}
uint32_t

Просмотреть файл

@ -76,6 +76,10 @@ public:
// Create a nsISMILAttr for my target, on the heap.
mozilla::UniquePtr<nsISMILAttr> CreateSMILAttr();
// Returns the CSS property this compositor should animate, or
// eCSSProperty_UNKNOWN if this compositor does not animate a CSS property.
nsCSSPropertyID GetCSSPropertyToAnimate() const;
// Finds the index of the first function that will affect our animation
// sandwich. Also toggles the 'mForceCompositing' flag if it finds that any
// (used) functions have changed.