зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1355349
- Treat properties that can't be animated by the Servo backend as unanimatable; r=hiro
If we attempt to call animation-related methods on the Servo backend (e.g. Servo_ComputedValues_ExtractAnimationValue) and pass a property that is not (yet) animatable by Servo, it will panic so we should avoid passing these properties. An alternative, is to make methods like Servo_ComputedValues_ExtractAnimationValue fallible by having them first check if the passed-in value is animatable and return null in that case. That too, is probably worth doing (call sites like KeyframeEffectReadOnly::EnsureBaseStyle that assume it is fallible could assert that the result is non-null since, provided that property is animatable, the method should still be fallible) but refusing to animate these properties from the start is cleaner so we just do that for now. MozReview-Commit-ID: ESYcbkTtfXG --HG-- extra : rebase_source : 60e4469d0883c49b77118f9235f0f4b369f6cd3f
This commit is contained in:
Родитель
01cd8b3017
Коммит
4e2036b283
|
@ -28,7 +28,8 @@ nsSMILCSSProperty::nsSMILCSSProperty(nsCSSPropertyID aPropID,
|
|||
, mElement(aElement)
|
||||
, mBaseStyleContext(aBaseStyleContext)
|
||||
{
|
||||
MOZ_ASSERT(IsPropertyAnimatable(mPropID),
|
||||
MOZ_ASSERT(IsPropertyAnimatable(mPropID,
|
||||
aElement->OwnerDoc()->GetStyleBackendType()),
|
||||
"Creating a nsSMILCSSProperty for a property "
|
||||
"that's not supported for animation");
|
||||
}
|
||||
|
@ -93,7 +94,9 @@ nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
|
|||
nsSMILValue& aValue,
|
||||
bool& aPreventCachingOfSandwich) const
|
||||
{
|
||||
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID,
|
||||
mElement->OwnerDoc()->GetStyleBackendType()),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue,
|
||||
&aPreventCachingOfSandwich);
|
||||
|
@ -114,7 +117,9 @@ nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
|
|||
nsresult
|
||||
nsSMILCSSProperty::SetAnimValue(const nsSMILValue& aValue)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID,
|
||||
mElement->OwnerDoc()->GetStyleBackendType()),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
// Convert nsSMILValue to string
|
||||
nsAutoString valStr;
|
||||
|
@ -146,8 +151,15 @@ nsSMILCSSProperty::ClearAnimValue()
|
|||
// Based on http://www.w3.org/TR/SVG/propidx.html
|
||||
// static
|
||||
bool
|
||||
nsSMILCSSProperty::IsPropertyAnimatable(nsCSSPropertyID aPropID)
|
||||
nsSMILCSSProperty::IsPropertyAnimatable(nsCSSPropertyID aPropID,
|
||||
StyleBackendType aBackend)
|
||||
{
|
||||
// Bug 1353918: Drop this check
|
||||
if (aBackend == StyleBackendType::Servo &&
|
||||
!Servo_Property_IsAnimatable(aPropID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// NOTE: Right now, Gecko doesn't recognize the following properties from
|
||||
// the SVG Property Index:
|
||||
// alignment-baseline
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define NS_SMILCSSPROPERTY_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/StyleBackendType.h"
|
||||
#include "nsISMILAttr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCSSPropertyID.h"
|
||||
|
@ -58,10 +59,14 @@ public:
|
|||
* SMIL animation.
|
||||
*
|
||||
* @param aProperty The property to check for animation support.
|
||||
* @param aBackend The style backend to check for animation support.
|
||||
* This is a temporary measure until the Servo backend
|
||||
* supports all animatable properties (bug 1353918).
|
||||
* @return true if the given property is supported for SMIL animation, or
|
||||
* false otherwise
|
||||
*/
|
||||
static bool IsPropertyAnimatable(nsCSSPropertyID aPropID);
|
||||
static bool IsPropertyAnimatable(nsCSSPropertyID aPropID,
|
||||
mozilla::StyleBackendType aBackend);
|
||||
|
||||
protected:
|
||||
nsCSSPropertyID mPropID;
|
||||
|
|
|
@ -160,7 +160,8 @@ nsSMILCompositor::GetCSSPropertyToAnimate() const
|
|||
nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
|
||||
CSSEnabledState::eForAllContent);
|
||||
|
||||
if (!nsSMILCSSProperty::IsPropertyAnimatable(propID)) {
|
||||
if (!nsSMILCSSProperty::IsPropertyAnimatable(propID,
|
||||
mKey.mElement->OwnerDoc()->GetStyleBackendType())) {
|
||||
return eCSSProperty_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче