Bug 847599 - Paris binding for TransitionEvent, r=Ms2ger
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 14 Mar 2013 23:16:13 +0200
changeset 124902 cceb495a89d695ef43e9209471b2d57b2c5fd29a
parent 124901 c3a84e883c3dff5b7c5464508688a9669edbc759
child 124903 8c88ac65a81b348d1af88f2deb436867b6445119
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
bugs847599
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 847599 - Paris binding for TransitionEvent, r=Ms2ger
content/events/src/nsDOMTransitionEvent.cpp
content/events/src/nsDOMTransitionEvent.h
dom/bindings/Bindings.conf
dom/webidl/TransitionEvent.webidl
dom/webidl/WebIDL.mk
--- a/content/events/src/nsDOMTransitionEvent.cpp
+++ b/content/events/src/nsDOMTransitionEvent.cpp
@@ -19,16 +19,17 @@ nsDOMTransitionEvent::nsDOMTransitionEve
 {
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
+  SetIsDOMBinding();
 }
 
 nsDOMTransitionEvent::~nsDOMTransitionEvent()
 {
   if (mEventIsInternal) {
     delete TransitionEvent();
     mEvent = nullptr;
   }
@@ -49,17 +50,17 @@ nsDOMTransitionEvent::GetPropertyName(ns
 {
   aPropertyName = TransitionEvent()->propertyName;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMTransitionEvent::GetElapsedTime(float *aElapsedTime)
 {
-  *aElapsedTime = TransitionEvent()->elapsedTime;
+  *aElapsedTime = ElapsedTime();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMTransitionEvent::InitTransitionEvent(const nsAString & typeArg,
                                           bool canBubbleArg,
                                           bool cancelableArg,
                                           const nsAString & propertyNameArg,
--- a/content/events/src/nsDOMTransitionEvent.h
+++ b/content/events/src/nsDOMTransitionEvent.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 nsDOMTransitionEvent_h_
 #define nsDOMTransitionEvent_h_
 
 #include "nsDOMEvent.h"
 #include "nsIDOMTransitionEvent.h"
 #include "nsString.h"
+#include "mozilla/dom/TransitionEventBinding.h"
 
 class nsTransitionEvent;
 
 class nsDOMTransitionEvent : public nsDOMEvent,
                              public nsIDOMTransitionEvent
 {
 public:
   nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
                        nsPresContext *aPresContext,
                        nsTransitionEvent *aEvent);
   ~nsDOMTransitionEvent();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_FORWARD_TO_NSDOMEVENT
   NS_DECL_NSIDOMTRANSITIONEVENT
 
+  virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
+  {
+    return mozilla::dom::TransitionEventBinding::Wrap(aCx, aScope, this);
+  }
+
+  // xpidl implementation
+  // GetPropertyName(nsAString& aPropertyName)
+
+  float ElapsedTime()
+  {
+    return TransitionEvent()->elapsedTime;
+  }
+
+  void InitTransitionEvent(const nsAString& aType,
+                           bool aCanBubble,
+                           bool aCancelable,
+                           const nsAString& aPropertyName,
+                           float aElapsedTime,
+                           mozilla::ErrorResult& aRv)
+  {
+    aRv = InitTransitionEvent(aType, aCanBubble, aCancelable, aPropertyName,
+                              aElapsedTime);
+  }
 private:
   nsTransitionEvent* TransitionEvent() {
     NS_ABORT_IF_FALSE(mEvent->eventStructType == NS_TRANSITION_EVENT,
                       "unexpected struct type");
     return static_cast<nsTransitionEvent*>(mEvent);
   }
 };
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -870,16 +870,20 @@ DOMInterfaces = {
     'workers': True,
     'implicitJSContext': [ 'encode' ],
 }],
 
 'TimeRanges': {
     'wrapperCache': False
 },
 
+'TransitionEvent': {
+    'nativeType': 'nsDOMTransitionEvent',
+},
+
 'TreeWalker': {
     'wrapperCache': False,
     'resultNotAddRefed': [ 'root', 'currentNode' ],
 },
 
 'UIEvent': {
     'nativeType': 'nsDOMUIEvent',
 },
new file mode 100644
--- /dev/null
+++ b/dom/webidl/TransitionEvent.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/.
+ *
+ * Transition events are defined in:
+ * http://www.w3.org/TR/css3-transitions/#transition-events-
+ * http://dev.w3.org/csswg/css3-transitions/#transition-events-
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+interface TransitionEvent : Event {
+  readonly attribute DOMString propertyName;
+  readonly attribute float     elapsedTime;
+
+  [Throws]
+  void initTransitionEvent(DOMString aType,
+                           boolean aCanBubble,
+                           boolean aCancelable,
+                           DOMString aPropertyName,
+                           float aElapsedTime);
+};
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -226,16 +226,17 @@ webidl_files = \
   SVGUseElement.webidl \
   SVGURIReference.webidl \
   SVGViewElement.webidl \
   SVGZoomAndPan.webidl \
   Text.webidl \
   TextDecoder.webidl \
   TextEncoder.webidl \
   TimeRanges.webidl \
+  TransitionEvent.webidl \
   TreeWalker.webidl \
   UIEvent.webidl \
   URL.webidl \
   ValidityState.webidl \
   WebComponents.webidl \
   WebSocket.webidl \
   UndoManager.webidl \
   URLUtils.webidl \