dom/interfaces/events/nsIDOMEvent.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "domstubs.idl"
     8 interface nsIDOMEventTarget;
    10 [ptr] native WidgetEventPtr(mozilla::WidgetEvent);
    11 [ptr] native DOMEventPtr(mozilla::dom::Event);
    12 [ptr] native IPCMessagePtr(IPC::Message);
    13 [ptr] native ConstIPCMessagePtr(const IPC::Message);
    14 [ptr] native EventTargetPtr(mozilla::dom::EventTarget);
    15 %{C++
    16 #ifdef ERROR
    17 #undef ERROR
    18 #endif
    20 #include "mozilla/EventForwards.h"
    21 class nsPresContext;
    22 class nsInvalidateRequestList;
    23 namespace IPC {
    24 class Message;
    25 }
    26 namespace mozilla {
    27 namespace dom {
    28 class Event;
    29 class EventTarget;
    30 } // namespace dom
    31 } // namespace mozilla
    32 %}
    34 /**
    35  * The nsIDOMEvent interface is the primary datatype for all events in
    36  * the Document Object Model.
    37  *
    38  * For more information on this interface please see 
    39  * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and
    40  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
    41  */
    43 [scriptable, builtinclass, uuid(02d54f52-a1f5-4ad2-b560-36f14012935e)]
    44 interface nsIDOMEvent : nsISupports
    45 {
    46   // PhaseType
    47   /**
    48    * The event isn't being dispatched.
    49    */
    50   const unsigned short      NONE                           = 0;
    51   /**
    52    * The current event phase is the capturing phase.
    53    */
    54   const unsigned short      CAPTURING_PHASE                = 1;
    56   /**
    57    * The event is currently being evaluated at the target EventTarget.
    58    */
    59   const unsigned short      AT_TARGET                      = 2;
    61   /**
    62    * The current event phase is the bubbling phase.
    63    */
    64   const unsigned short      BUBBLING_PHASE                 = 3;
    66   /**
    67    * The name of the event (case-insensitive). The name must be an XML 
    68    * name.
    69    */
    70   readonly attribute DOMString          type;
    72   /**
    73    * Used to indicate the EventTarget to which the event was originally 
    74    * dispatched.
    75    */
    76   readonly attribute nsIDOMEventTarget  target;
    78   /**
    79    * Used to indicate the EventTarget whose EventListeners are currently 
    80    * being processed. This is particularly useful during capturing and 
    81    * bubbling.
    82    */
    83   readonly attribute nsIDOMEventTarget  currentTarget;
    85   /**
    86    * Used to indicate which phase of event flow is currently being 
    87    * evaluated.
    88    */
    89   readonly attribute unsigned short     eventPhase;
    91   /**
    92    * Used to indicate whether or not an event is a bubbling event. If the 
    93    * event can bubble the value is true, else the value is false.
    94    */
    95   readonly attribute boolean            bubbles;
    97   /**
    98    * Used to indicate whether or not an event can have its default action 
    99    * prevented. If the default action can be prevented the value is true, 
   100    * else the value is false.
   101    */
   102   readonly attribute boolean            cancelable;
   104   /**
   105    * Used to specify the time (in milliseconds relative to the epoch) at 
   106    * which the event was created. Due to the fact that some systems may 
   107    * not provide this information the value of timeStamp may be not 
   108    * available for all events. When not available, a value of 0 will be 
   109    * returned. Examples of epoch time are the time of the system start or 
   110    * 0:0:0 UTC 1st January 1970.
   111    */
   112   readonly attribute DOMTimeStamp       timeStamp;
   114   /**
   115    * The stopPropagation method is used prevent further propagation of an 
   116    * event during event flow. If this method is called by any 
   117    * EventListener the event will cease propagating through the tree. The 
   118    * event will complete dispatch to all listeners on the current 
   119    * EventTarget before event flow stops. This method may be used during 
   120    * any stage of event flow.
   121    */
   122   void                      stopPropagation();
   124   /**
   125    * If an event is cancelable, the preventDefault method is used to 
   126    * signify that the event is to be canceled, meaning any default action 
   127    * normally taken by the implementation as a result of the event will 
   128    * not occur. If, during any stage of event flow, the preventDefault 
   129    * method is called the event is canceled. Any default action associated 
   130    * with the event will not occur. Calling this method for a 
   131    * non-cancelable event has no effect. Once preventDefault has been 
   132    * called it will remain in effect throughout the remainder of the 
   133    * event's propagation. This method may be used during any stage of 
   134    * event flow.
   135    */
   136   void                      preventDefault();
   138   /**
   139    * The initEvent method is used to initialize the value of an Event 
   140    * created through the DocumentEvent interface. This method may only be 
   141    * called before the Event has been dispatched via the dispatchEvent 
   142    * method, though it may be called multiple times during that phase if 
   143    * necessary. If called multiple times the final invocation takes 
   144    * precedence. If called from a subclass of Event interface only the 
   145    * values specified in the initEvent method are modified, all other 
   146    * attributes are left unchanged.
   147    *
   148    * @param   eventTypeArg Specifies the event type. This type may be 
   149    *                       any event type currently defined in this 
   150    *                       specification or a new event type.. The string 
   151    *                       must be an XML name.
   152    *                       Any new event type must not begin with any 
   153    *                       upper, lower, or mixed case version of the 
   154    *                       string "DOM". This prefix is reserved for 
   155    *                       future DOM event sets. It is also strongly 
   156    *                       recommended that third parties adding their 
   157    *                       own events use their own prefix to avoid 
   158    *                       confusion and lessen the probability of 
   159    *                       conflicts with other new events.
   160    * @param   canBubbleArg Specifies whether or not the event can bubble.
   161    * @param   cancelableArg Specifies whether or not the event's default 
   162    *                        action can be prevented.
   163    */
   164   void                      initEvent(in DOMString eventTypeArg,
   165                                       in boolean canBubbleArg,
   166                                       in boolean cancelableArg);
   168   /**
   169    * Used to indicate whether preventDefault() has been called for this event.
   170    */
   171   readonly attribute boolean defaultPrevented;
   173   /**
   174    * Prevents other event listeners from being triggered and,
   175    * unlike Event.stopPropagation() its effect is immediate.
   176    */
   177   void                       stopImmediatePropagation();
   179   const long ALT_MASK     = 0x00000001;
   180   const long CONTROL_MASK = 0x00000002;
   181   const long SHIFT_MASK   = 0x00000004;
   182   const long META_MASK    = 0x00000008;
   184   /** The original target of the event, before any retargetings. */
   185   readonly attribute nsIDOMEventTarget  originalTarget;
   186   /**
   187    * The explicit original target of the event.  If the event was retargeted
   188    * for some reason other than an anonymous boundary crossing, this will be set
   189    * to the target before the retargeting occurs.  For example, mouse events
   190    * are retargeted to their parent node when they happen over text nodes (bug
   191    * 185889), and in that case .target will show the parent and
   192    * .explicitOriginalTarget will show the text node.
   193    * .explicitOriginalTarget differs from .originalTarget in that it will never
   194    * contain anonymous content.
   195    */
   196   readonly attribute nsIDOMEventTarget  explicitOriginalTarget;
   198   /**
   199    * @deprecated Use nsIDOMEvent::defaultPrevented.
   200    * To be removed in bug 691151.
   201    */
   202   boolean                   getPreventDefault();
   204   readonly attribute boolean isTrusted;
   206   [noscript] void duplicatePrivateData();
   207   [noscript] void setTarget(in nsIDOMEventTarget aTarget);
   208   [notxpcom] boolean IsDispatchStopped();
   209   [notxpcom] WidgetEventPtr GetInternalNSEvent();
   210   [noscript,notxpcom] void SetTrusted(in boolean aTrusted);
   211   [notxpcom] void Serialize(in IPCMessagePtr aMsg,
   212                             in boolean aSerializeInterfaceType);
   213   [notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, out voidPtr aIter);
   214   [noscript,notxpcom] void SetOwner(in EventTargetPtr aOwner);
   215   [notxpcom] DOMEventPtr InternalDOMEvent();
   216 };
   218 %{C++
   220 nsresult
   221 NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
   222                mozilla::dom::EventTarget* aOwner,
   223                nsPresContext* aPresContext,
   224                mozilla::WidgetEvent* aEvent);
   225 nsresult
   226 NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
   227                             mozilla::dom::EventTarget* aOwner,
   228                             nsPresContext* aPresContext,
   229                             mozilla::WidgetEvent* aEvent);
   230 nsresult
   231 NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
   232                  mozilla::dom::EventTarget* aOwner,
   233                  nsPresContext* aPresContext,
   234                  mozilla::WidgetGUIEvent* aEvent);
   235 nsresult
   236 NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
   237                     mozilla::dom::EventTarget* aOwner,
   238                     nsPresContext* aPresContext,
   239                     mozilla::WidgetMouseEvent* aEvent);
   240 nsresult
   241 NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
   242                     mozilla::dom::EventTarget* aOwner,
   243                     nsPresContext* aPresContext,
   244                     mozilla::InternalFocusEvent* aEvent);
   245 nsresult
   246 NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
   247                           mozilla::dom::EventTarget* aOwner,
   248                           nsPresContext* aPresContext,
   249                           mozilla::WidgetMouseScrollEvent* aEvent);
   250 nsresult
   251 NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult,
   252                     mozilla::dom::EventTarget* aOwner,
   253                     nsPresContext* aPresContext,
   254                     mozilla::WidgetWheelEvent* aEvent);
   255 nsresult
   256 NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
   257                    mozilla::dom::EventTarget* aOwner,
   258                    nsPresContext* aPresContext,
   259                    mozilla::WidgetDragEvent* aEvent);
   260 nsresult
   261 NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult,
   262                         mozilla::dom::EventTarget* aOwner,
   263                         nsPresContext* aPresContext,
   264                         mozilla::InternalClipboardEvent* aEvent);
   265 nsresult
   266 NS_NewDOMInputEvent(nsIDOMEvent** aInstancePtrResult,
   267                     mozilla::dom::EventTarget* aOwner,
   268                     nsPresContext* aPresContext,
   269                     mozilla::InternalEditorInputEvent* aEvent);
   270 nsresult
   271 NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult,
   272                        mozilla::dom::EventTarget* aOwner,
   273                        nsPresContext* aPresContext,
   274                        mozilla::WidgetKeyboardEvent* aEvent);
   275 nsresult
   276 NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
   277                           mozilla::dom::EventTarget* aOwner,
   278                           nsPresContext* aPresContext,
   279                           mozilla::WidgetCompositionEvent* aEvent);
   280 nsresult
   281 NS_NewDOMMutationEvent(nsIDOMEvent** aResult,
   282                        mozilla::dom::EventTarget* aOwner,
   283                        nsPresContext* aPresContext,
   284                        mozilla::InternalMutationEvent* aEvent);
   285 nsresult
   286 NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult,
   287                            mozilla::dom::EventTarget* aOwner,
   288                            nsPresContext* aPresContext,
   289                            mozilla::WidgetEvent* aEvent);
   290 nsresult
   291 NS_NewDOMTextEvent(nsIDOMEvent** aResult,
   292                    mozilla::dom::EventTarget* aOwner,
   293                    nsPresContext* aPresContext,
   294                    mozilla::WidgetTextEvent* aEvent);
   295 nsresult
   296 NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult,
   297                            mozilla::dom::EventTarget* aOwner,
   298                            nsPresContext* aPresContext,
   299                            mozilla::WidgetEvent* aEvent);
   300 nsresult
   301 NS_NewDOMSVGEvent(nsIDOMEvent** aResult,
   302                   mozilla::dom::EventTarget* aOwner,
   303                   nsPresContext* aPresContext,
   304                   mozilla::WidgetEvent* aEvent);
   305 nsresult
   306 NS_NewDOMSVGZoomEvent(nsIDOMEvent** aResult,
   307                       mozilla::dom::EventTarget* aOwner,
   308                       nsPresContext* aPresContext,
   309                       mozilla::WidgetGUIEvent* aEvent);
   310 nsresult
   311 NS_NewDOMTimeEvent(nsIDOMEvent** aResult,
   312                    mozilla::dom::EventTarget* aOwner,
   313                    nsPresContext* aPresContext,
   314                    mozilla::WidgetEvent* aEvent);
   315 nsresult
   316 NS_NewDOMXULCommandEvent(nsIDOMEvent** aResult,
   317                          mozilla::dom::EventTarget* aOwner,
   318                          nsPresContext* aPresContext,
   319                          mozilla::WidgetInputEvent* aEvent);
   320 nsresult
   321 NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
   322                       mozilla::dom::EventTarget* aOwner,
   323                       nsPresContext* aPresContext,
   324                       mozilla::WidgetCommandEvent* aEvent);
   325 nsresult
   326 NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
   327                       mozilla::dom::EventTarget* aOwner,
   328                       nsPresContext* aPresContext,
   329                       mozilla::WidgetEvent* aEvent);
   330 nsresult
   331 NS_NewDOMProgressEvent(nsIDOMEvent** aInstancePtrResult,
   332                        mozilla::dom::EventTarget* aOwner,
   333                        nsPresContext* aPresContext,
   334                        mozilla::WidgetEvent* aEvent);
   335 // This empties aInvalidateRequests.
   336 nsresult
   337 NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aResult,
   338                           mozilla::dom::EventTarget* aOwner,
   339                           nsPresContext* aPresContext,
   340                           mozilla::WidgetEvent* aEvent,
   341                           uint32_t aEventType = 0,
   342                           nsInvalidateRequestList* aInvalidateRequests = nullptr);
   343 nsresult
   344 NS_NewDOMSimpleGestureEvent(nsIDOMEvent** aInstancePtrResult,
   345                             mozilla::dom::EventTarget* aOwner,
   346                             nsPresContext* aPresContext,
   347                             mozilla::WidgetSimpleGestureEvent* aEvent);
   348 nsresult
   349 NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult,
   350                          mozilla::dom::EventTarget* aOwner,
   351                          nsPresContext* aPresContext,
   352                          mozilla::InternalScrollAreaEvent* aEvent);
   353 nsresult
   354 NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult,
   355                          mozilla::dom::EventTarget* aOwner,
   356                          nsPresContext* aPresContext,
   357                          mozilla::InternalTransitionEvent* aEvent);
   358 nsresult
   359 NS_NewDOMAnimationEvent(nsIDOMEvent** aInstancePtrResult,
   360                         mozilla::dom::EventTarget* aOwner,
   361                         nsPresContext* aPresContext,
   362                         mozilla::InternalAnimationEvent* aEvent);
   363 nsresult
   364 NS_NewDOMPointerEvent(nsIDOMEvent** aInstancePtrResult,
   365                       mozilla::dom::EventTarget* aOwner,
   366                       nsPresContext* aPresContext,
   367                       mozilla::WidgetPointerEvent* aEvent);
   368 nsresult
   369 NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
   370                     mozilla::dom::EventTarget* aOwner,
   371                     nsPresContext* aPresContext,
   372                     mozilla::WidgetTouchEvent* aEvent);
   373 nsresult
   374 NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
   375                           mozilla::dom::EventTarget* aOwner,
   376                           nsPresContext* aPresContext,
   377                           mozilla::WidgetEvent* aEvent);
   378 nsresult
   379 NS_NewDOMMozApplicationEvent(nsIDOMEvent** aInstancePtrResult,
   380                              mozilla::dom::EventTarget* aOwner,
   381                              nsPresContext* aPresContext,
   382                              mozilla::WidgetEvent* aEvent);
   383 %}

mercurial