Bug 847589 - Paris binding for AnimationEvent, r=Ms2ger
☠☠ backed out by 9f128f1af706 ☠ ☠
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 14 Mar 2013 13:03:00 +0200
changeset 124799 46ba7eb77ae139dce3e30bb39c3343360be676f6
parent 124798 7d91d21471d0c15fb21221947460272a803c3cfb
child 124800 6ab8497cb00fcf154e9d215b5a9af7477cec9cfd
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersMs2ger
bugs847589
milestone22.0a1
Bug 847589 - Paris binding for AnimationEvent, r=Ms2ger
content/events/src/nsDOMAnimationEvent.cpp
content/events/src/nsDOMAnimationEvent.h
dom/bindings/Bindings.conf
dom/webidl/AnimationEvent.webidl
dom/webidl/WebIDL.mk
--- a/content/events/src/nsDOMAnimationEvent.cpp
+++ b/content/events/src/nsDOMAnimationEvent.cpp
@@ -19,16 +19,17 @@ nsDOMAnimationEvent::nsDOMAnimationEvent
 {
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
+  SetIsDOMBinding();
 }
 
 nsDOMAnimationEvent::~nsDOMAnimationEvent()
 {
   if (mEventIsInternal) {
     delete AnimationEvent();
     mEvent = nullptr;
   }
@@ -49,17 +50,17 @@ nsDOMAnimationEvent::GetAnimationName(ns
 {
   aAnimationName = AnimationEvent()->animationName;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAnimationEvent::GetElapsedTime(float *aElapsedTime)
 {
-  *aElapsedTime = AnimationEvent()->elapsedTime;
+  *aElapsedTime = ElapsedTime();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAnimationEvent::InitAnimationEvent(const nsAString & typeArg,
                                         bool canBubbleArg,
                                         bool cancelableArg,
                                         const nsAString & animationNameArg,
--- a/content/events/src/nsDOMAnimationEvent.h
+++ b/content/events/src/nsDOMAnimationEvent.h
@@ -3,32 +3,56 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsDOMAnimationEvent_h_
 #define nsDOMAnimationEvent_h_
 
 #include "nsDOMEvent.h"
 #include "nsIDOMAnimationEvent.h"
 #include "nsString.h"
+#include "mozilla/dom/AnimationEventBinding.h"
 
 class nsAnimationEvent;
 
 class nsDOMAnimationEvent : public nsDOMEvent,
                             public nsIDOMAnimationEvent
 {
 public:
   nsDOMAnimationEvent(mozilla::dom::EventTarget* aOwner,
                       nsPresContext *aPresContext,
                       nsAnimationEvent *aEvent);
   ~nsDOMAnimationEvent();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_FORWARD_TO_NSDOMEVENT
   NS_DECL_NSIDOMANIMATIONEVENT
 
+  virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
+  {
+    return mozilla::dom::AnimationEventBinding::Wrap(aCx, aScope, this);
+  }
+
+  // xpidl implementation
+  // GetAnimationName(nsAString& aAnimationName);
+
+  float ElapsedTime()
+  {
+    return AnimationEvent()->elapsedTime;
+  }
+
+  void InitAnimationEvent(const nsAString& aType,
+                          bool aCanBubble,
+                          bool aCancelable,
+                          const nsAString& aAnimationName,
+                          float aElapsedTime,
+                          mozilla::ErrorResult& aRv)
+  {
+    aRv = InitAnimationEvent(aType, aCanBubble, aCancelable, aAnimationName,
+                             aElapsedTime);
+  }
 private:
   nsAnimationEvent* AnimationEvent() {
     NS_ABORT_IF_FALSE(mEvent->eventStructType == NS_ANIMATION_EVENT,
                       "unexpected struct type");
     return static_cast<nsAnimationEvent*>(mEvent);
   }
 };
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -73,16 +73,20 @@
 #
 # A descriptor can also have 'skipGen': True specified if it should be skipped
 # when deciding what header includes to generate and should never have an
 # implementation generated for it.  This is only needed in special cases like
 # worker descriptors for objects that will never actually appear in workers.
 
 DOMInterfaces = {
 
+'AnimationEvent': {
+    'nativeType': 'nsDOMAnimationEvent',
+},
+
 'ArchiveReader': {
     'nativeType': 'mozilla::dom::file::ArchiveReader',
 },
 
 'AudioChannelManager': {
     'nativeType': 'mozilla::dom::system::AudioChannelManager',
     'headerFile': 'AudioChannelManager.h'
 },
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AnimationEvent.webidl
@@ -0,0 +1,24 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * http://www.w3.org/TR/css3-animations/#animation-events-
+ * http://dev.w3.org/csswg/css3-animations/#animation-events-
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+interface AnimationEvent : Event {
+  readonly attribute DOMString animationName;
+  readonly attribute float     elapsedTime;
+
+  [Throws]
+  void initAnimationEvent(DOMString type,
+                          boolean canBubble,
+                          boolean cancelable,
+                          DOMString animationName,
+                          float elapsedTime);
+};
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -4,16 +4,17 @@
 
 webidl_base = $(topsrcdir)/dom/webidl
 
 generated_webidl_files = \
   CSS2Properties.webidl \
   $(NULL)
 
 webidl_files = \
+  AnimationEvent.webidl \
   ArchiveReader.webidl \
   AudioBuffer.webidl \
   AudioBufferSourceNode.webidl \
   AudioContext.webidl \
   AudioDestinationNode.webidl \
   AudioListener.webidl \
   AudioNode.webidl \
   AudioParam.webidl \