Bug 1274944 - Part 1: Add writable spacing attribute. draft
authorBoris Chiou <boris.chiou@gmail.com>
Wed, 31 Aug 2016 16:58:57 +0800
changeset 409799 e20fc280635ae228ae630b23e4b28acad74a4594
parent 409737 dbe4b47941c7b3d6298a0ead5e40dd828096c808
child 409800 f91c53dbd01c96c5d397ab9f97cbc388ea560d72
push id28551
push userbmo:boris.chiou@gmail.com
push dateMon, 05 Sep 2016 07:18:07 +0000
bugs1274944
milestone51.0a1
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
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
dom/bindings/Bindings.conf
dom/webidl/KeyframeEffect.webidl
--- 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);
 };