Bug 847589 - Paris binding for AnimationEvent, r=Ms2ger
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 14 Mar 2013 23:16:03 +0200
changeset 124901 c3a84e883c3dff5b7c5464508688a9669edbc759
parent 124900 fc80b4d5c4ecfb296660ef4f400999e1584a09d2
child 124902 cceb495a89d695ef43e9209471b2d57b2c5fd29a
push id24666
push useropettay@mozilla.com
push dateFri, 15 Mar 2013 09:40:00 +0000
treeherdermozilla-inbound@a1b34cb6b77e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs847589
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 \