Bug 1274944 - Part 1: Add writable spacing attribute.
Use [SetterThrows] for KeyframeEffect.spacing because it throws if the input
string is not conformed to the grammar.
MozReview-Commit-ID: CkAnPu8TnV
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -120,10 +120,18 @@ KeyframeEffect::SetTarget(const Nullable
nsNodeUtils::AnimationAdded(mAnimation);
}
} else if (mEffectOptions.mSpacingMode == SpacingMode::paced) {
// New target is null, so fall back to distribute spacing.
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
}
}
+void
+KeyframeEffect::SetSpacing(JSContext* aCx,
+ const nsAString& aSpacing,
+ ErrorResult& aRv)
+{
+ // TODO: Implement this in the next patch.
+}
+
} // namespace dom
} // namespace mozilla
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -60,14 +60,16 @@ public:
void NotifySpecifiedTimingUpdated();
// This method calls GetTargetStyleContext which is not safe to use when
// we are in the middle of updating style. If we need to use this when
// updating style, we should pass the nsStyleContext into this method and use
// that to update the properties rather than calling
// GetStyleContextForElement.
void SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget);
+
+ void SetSpacing(JSContext* aCx, const nsAString& aSpacing, ErrorResult& aRv);
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_KeyframeEffect_h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -619,16 +619,20 @@ DOMInterfaces = {
'nativeType': 'nsIInputStream',
'notflattened': True
},
'KeyEvent': {
'concrete': False
},
+'KeyframeEffect': {
+ 'implicitJSContext': { 'setterOnly': [ 'spacing' ] }
+},
+
'LegacyMozTCPSocket': {
'headerFile': 'TCPSocket.h',
'wrapperCache': False,
},
'LocalMediaStream': {
'headerFile': 'DOMMediaStream.h',
'nativeType': 'mozilla::DOMLocalMediaStream'
--- a/dom/webidl/KeyframeEffect.webidl
+++ b/dom/webidl/KeyframeEffect.webidl
@@ -68,13 +68,13 @@ partial interface KeyframeEffectReadOnly
object? keyframes,
optional (unrestricted double or KeyframeEffectOptions) options)]
interface KeyframeEffect : KeyframeEffectReadOnly {
inherit attribute (Element or CSSPseudoElement)? target;
// Bug 1216843 - implement animation composition
// inherit attribute IterationCompositeOperation iterationComposite;
// Bug 1216844 - implement additive animation
// inherit attribute CompositeOperation composite;
- // Bug 1244590 - implement spacing modes
- // inherit attribute DOMString spacing;
+ [SetterThrows]
+ inherit attribute DOMString spacing;
[Throws]
void setKeyframes (object? keyframes);
};