Bug 847599 - Paris binding for TransitionEvent, r=Ms2ger
☠☠ backed out by 44810fa6c312 ☠ ☠
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 14 Mar 2013 13:07:02 +0200
changeset 124800 6ab8497cb00fcf154e9d215b5a9af7477cec9cfd
parent 124799 46ba7eb77ae139dce3e30bb39c3343360be676f6
child 124801 ea13caf078a735f3bd4904a56900df59cd6e8e18
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersMs2ger
bugs847599
milestone22.0a1
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
@@ -224,16 +224,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 \