dom/interfaces/events/nsIDOMEvent.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/interfaces/events/nsIDOMEvent.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,383 @@
     1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "domstubs.idl"
    1.10 +
    1.11 +interface nsIDOMEventTarget;
    1.12 +
    1.13 +[ptr] native WidgetEventPtr(mozilla::WidgetEvent);
    1.14 +[ptr] native DOMEventPtr(mozilla::dom::Event);
    1.15 +[ptr] native IPCMessagePtr(IPC::Message);
    1.16 +[ptr] native ConstIPCMessagePtr(const IPC::Message);
    1.17 +[ptr] native EventTargetPtr(mozilla::dom::EventTarget);
    1.18 +%{C++
    1.19 +#ifdef ERROR
    1.20 +#undef ERROR
    1.21 +#endif
    1.22 +
    1.23 +#include "mozilla/EventForwards.h"
    1.24 +class nsPresContext;
    1.25 +class nsInvalidateRequestList;
    1.26 +namespace IPC {
    1.27 +class Message;
    1.28 +}
    1.29 +namespace mozilla {
    1.30 +namespace dom {
    1.31 +class Event;
    1.32 +class EventTarget;
    1.33 +} // namespace dom
    1.34 +} // namespace mozilla
    1.35 +%}
    1.36 +
    1.37 +/**
    1.38 + * The nsIDOMEvent interface is the primary datatype for all events in
    1.39 + * the Document Object Model.
    1.40 + *
    1.41 + * For more information on this interface please see 
    1.42 + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and
    1.43 + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
    1.44 + */
    1.45 +
    1.46 +[scriptable, builtinclass, uuid(02d54f52-a1f5-4ad2-b560-36f14012935e)]
    1.47 +interface nsIDOMEvent : nsISupports
    1.48 +{
    1.49 +  // PhaseType
    1.50 +  /**
    1.51 +   * The event isn't being dispatched.
    1.52 +   */
    1.53 +  const unsigned short      NONE                           = 0;
    1.54 +  /**
    1.55 +   * The current event phase is the capturing phase.
    1.56 +   */
    1.57 +  const unsigned short      CAPTURING_PHASE                = 1;
    1.58 +
    1.59 +  /**
    1.60 +   * The event is currently being evaluated at the target EventTarget.
    1.61 +   */
    1.62 +  const unsigned short      AT_TARGET                      = 2;
    1.63 +
    1.64 +  /**
    1.65 +   * The current event phase is the bubbling phase.
    1.66 +   */
    1.67 +  const unsigned short      BUBBLING_PHASE                 = 3;
    1.68 +
    1.69 +  /**
    1.70 +   * The name of the event (case-insensitive). The name must be an XML 
    1.71 +   * name.
    1.72 +   */
    1.73 +  readonly attribute DOMString          type;
    1.74 +
    1.75 +  /**
    1.76 +   * Used to indicate the EventTarget to which the event was originally 
    1.77 +   * dispatched.
    1.78 +   */
    1.79 +  readonly attribute nsIDOMEventTarget  target;
    1.80 +
    1.81 +  /**
    1.82 +   * Used to indicate the EventTarget whose EventListeners are currently 
    1.83 +   * being processed. This is particularly useful during capturing and 
    1.84 +   * bubbling.
    1.85 +   */
    1.86 +  readonly attribute nsIDOMEventTarget  currentTarget;
    1.87 +
    1.88 +  /**
    1.89 +   * Used to indicate which phase of event flow is currently being 
    1.90 +   * evaluated.
    1.91 +   */
    1.92 +  readonly attribute unsigned short     eventPhase;
    1.93 +
    1.94 +  /**
    1.95 +   * Used to indicate whether or not an event is a bubbling event. If the 
    1.96 +   * event can bubble the value is true, else the value is false.
    1.97 +   */
    1.98 +  readonly attribute boolean            bubbles;
    1.99 +
   1.100 +  /**
   1.101 +   * Used to indicate whether or not an event can have its default action 
   1.102 +   * prevented. If the default action can be prevented the value is true, 
   1.103 +   * else the value is false.
   1.104 +   */
   1.105 +  readonly attribute boolean            cancelable;
   1.106 +
   1.107 +  /**
   1.108 +   * Used to specify the time (in milliseconds relative to the epoch) at 
   1.109 +   * which the event was created. Due to the fact that some systems may 
   1.110 +   * not provide this information the value of timeStamp may be not 
   1.111 +   * available for all events. When not available, a value of 0 will be 
   1.112 +   * returned. Examples of epoch time are the time of the system start or 
   1.113 +   * 0:0:0 UTC 1st January 1970.
   1.114 +   */
   1.115 +  readonly attribute DOMTimeStamp       timeStamp;
   1.116 +
   1.117 +  /**
   1.118 +   * The stopPropagation method is used prevent further propagation of an 
   1.119 +   * event during event flow. If this method is called by any 
   1.120 +   * EventListener the event will cease propagating through the tree. The 
   1.121 +   * event will complete dispatch to all listeners on the current 
   1.122 +   * EventTarget before event flow stops. This method may be used during 
   1.123 +   * any stage of event flow.
   1.124 +   */
   1.125 +  void                      stopPropagation();
   1.126 +
   1.127 +  /**
   1.128 +   * If an event is cancelable, the preventDefault method is used to 
   1.129 +   * signify that the event is to be canceled, meaning any default action 
   1.130 +   * normally taken by the implementation as a result of the event will 
   1.131 +   * not occur. If, during any stage of event flow, the preventDefault 
   1.132 +   * method is called the event is canceled. Any default action associated 
   1.133 +   * with the event will not occur. Calling this method for a 
   1.134 +   * non-cancelable event has no effect. Once preventDefault has been 
   1.135 +   * called it will remain in effect throughout the remainder of the 
   1.136 +   * event's propagation. This method may be used during any stage of 
   1.137 +   * event flow.
   1.138 +   */
   1.139 +  void                      preventDefault();
   1.140 +
   1.141 +  /**
   1.142 +   * The initEvent method is used to initialize the value of an Event 
   1.143 +   * created through the DocumentEvent interface. This method may only be 
   1.144 +   * called before the Event has been dispatched via the dispatchEvent 
   1.145 +   * method, though it may be called multiple times during that phase if 
   1.146 +   * necessary. If called multiple times the final invocation takes 
   1.147 +   * precedence. If called from a subclass of Event interface only the 
   1.148 +   * values specified in the initEvent method are modified, all other 
   1.149 +   * attributes are left unchanged.
   1.150 +   *
   1.151 +   * @param   eventTypeArg Specifies the event type. This type may be 
   1.152 +   *                       any event type currently defined in this 
   1.153 +   *                       specification or a new event type.. The string 
   1.154 +   *                       must be an XML name.
   1.155 +   *                       Any new event type must not begin with any 
   1.156 +   *                       upper, lower, or mixed case version of the 
   1.157 +   *                       string "DOM". This prefix is reserved for 
   1.158 +   *                       future DOM event sets. It is also strongly 
   1.159 +   *                       recommended that third parties adding their 
   1.160 +   *                       own events use their own prefix to avoid 
   1.161 +   *                       confusion and lessen the probability of 
   1.162 +   *                       conflicts with other new events.
   1.163 +   * @param   canBubbleArg Specifies whether or not the event can bubble.
   1.164 +   * @param   cancelableArg Specifies whether or not the event's default 
   1.165 +   *                        action can be prevented.
   1.166 +   */
   1.167 +  void                      initEvent(in DOMString eventTypeArg,
   1.168 +                                      in boolean canBubbleArg,
   1.169 +                                      in boolean cancelableArg);
   1.170 +
   1.171 +  /**
   1.172 +   * Used to indicate whether preventDefault() has been called for this event.
   1.173 +   */
   1.174 +  readonly attribute boolean defaultPrevented;
   1.175 +
   1.176 +  /**
   1.177 +   * Prevents other event listeners from being triggered and,
   1.178 +   * unlike Event.stopPropagation() its effect is immediate.
   1.179 +   */
   1.180 +  void                       stopImmediatePropagation();
   1.181 +
   1.182 +  const long ALT_MASK     = 0x00000001;
   1.183 +  const long CONTROL_MASK = 0x00000002;
   1.184 +  const long SHIFT_MASK   = 0x00000004;
   1.185 +  const long META_MASK    = 0x00000008;
   1.186 +
   1.187 +  /** The original target of the event, before any retargetings. */
   1.188 +  readonly attribute nsIDOMEventTarget  originalTarget;
   1.189 +  /**
   1.190 +   * The explicit original target of the event.  If the event was retargeted
   1.191 +   * for some reason other than an anonymous boundary crossing, this will be set
   1.192 +   * to the target before the retargeting occurs.  For example, mouse events
   1.193 +   * are retargeted to their parent node when they happen over text nodes (bug
   1.194 +   * 185889), and in that case .target will show the parent and
   1.195 +   * .explicitOriginalTarget will show the text node.
   1.196 +   * .explicitOriginalTarget differs from .originalTarget in that it will never
   1.197 +   * contain anonymous content.
   1.198 +   */
   1.199 +  readonly attribute nsIDOMEventTarget  explicitOriginalTarget;
   1.200 +
   1.201 +  /**
   1.202 +   * @deprecated Use nsIDOMEvent::defaultPrevented.
   1.203 +   * To be removed in bug 691151.
   1.204 +   */
   1.205 +  boolean                   getPreventDefault();
   1.206 +
   1.207 +  readonly attribute boolean isTrusted;
   1.208 +
   1.209 +  [noscript] void duplicatePrivateData();
   1.210 +  [noscript] void setTarget(in nsIDOMEventTarget aTarget);
   1.211 +  [notxpcom] boolean IsDispatchStopped();
   1.212 +  [notxpcom] WidgetEventPtr GetInternalNSEvent();
   1.213 +  [noscript,notxpcom] void SetTrusted(in boolean aTrusted);
   1.214 +  [notxpcom] void Serialize(in IPCMessagePtr aMsg,
   1.215 +                            in boolean aSerializeInterfaceType);
   1.216 +  [notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, out voidPtr aIter);
   1.217 +  [noscript,notxpcom] void SetOwner(in EventTargetPtr aOwner);
   1.218 +  [notxpcom] DOMEventPtr InternalDOMEvent();
   1.219 +};
   1.220 +
   1.221 +%{C++
   1.222 +
   1.223 +nsresult
   1.224 +NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
   1.225 +               mozilla::dom::EventTarget* aOwner,
   1.226 +               nsPresContext* aPresContext,
   1.227 +               mozilla::WidgetEvent* aEvent);
   1.228 +nsresult
   1.229 +NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
   1.230 +                            mozilla::dom::EventTarget* aOwner,
   1.231 +                            nsPresContext* aPresContext,
   1.232 +                            mozilla::WidgetEvent* aEvent);
   1.233 +nsresult
   1.234 +NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
   1.235 +                 mozilla::dom::EventTarget* aOwner,
   1.236 +                 nsPresContext* aPresContext,
   1.237 +                 mozilla::WidgetGUIEvent* aEvent);
   1.238 +nsresult
   1.239 +NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
   1.240 +                    mozilla::dom::EventTarget* aOwner,
   1.241 +                    nsPresContext* aPresContext,
   1.242 +                    mozilla::WidgetMouseEvent* aEvent);
   1.243 +nsresult
   1.244 +NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
   1.245 +                    mozilla::dom::EventTarget* aOwner,
   1.246 +                    nsPresContext* aPresContext,
   1.247 +                    mozilla::InternalFocusEvent* aEvent);
   1.248 +nsresult
   1.249 +NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
   1.250 +                          mozilla::dom::EventTarget* aOwner,
   1.251 +                          nsPresContext* aPresContext,
   1.252 +                          mozilla::WidgetMouseScrollEvent* aEvent);
   1.253 +nsresult
   1.254 +NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult,
   1.255 +                    mozilla::dom::EventTarget* aOwner,
   1.256 +                    nsPresContext* aPresContext,
   1.257 +                    mozilla::WidgetWheelEvent* aEvent);
   1.258 +nsresult
   1.259 +NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
   1.260 +                   mozilla::dom::EventTarget* aOwner,
   1.261 +                   nsPresContext* aPresContext,
   1.262 +                   mozilla::WidgetDragEvent* aEvent);
   1.263 +nsresult
   1.264 +NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult,
   1.265 +                        mozilla::dom::EventTarget* aOwner,
   1.266 +                        nsPresContext* aPresContext,
   1.267 +                        mozilla::InternalClipboardEvent* aEvent);
   1.268 +nsresult
   1.269 +NS_NewDOMInputEvent(nsIDOMEvent** aInstancePtrResult,
   1.270 +                    mozilla::dom::EventTarget* aOwner,
   1.271 +                    nsPresContext* aPresContext,
   1.272 +                    mozilla::InternalEditorInputEvent* aEvent);
   1.273 +nsresult
   1.274 +NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult,
   1.275 +                       mozilla::dom::EventTarget* aOwner,
   1.276 +                       nsPresContext* aPresContext,
   1.277 +                       mozilla::WidgetKeyboardEvent* aEvent);
   1.278 +nsresult
   1.279 +NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
   1.280 +                          mozilla::dom::EventTarget* aOwner,
   1.281 +                          nsPresContext* aPresContext,
   1.282 +                          mozilla::WidgetCompositionEvent* aEvent);
   1.283 +nsresult
   1.284 +NS_NewDOMMutationEvent(nsIDOMEvent** aResult,
   1.285 +                       mozilla::dom::EventTarget* aOwner,
   1.286 +                       nsPresContext* aPresContext,
   1.287 +                       mozilla::InternalMutationEvent* aEvent);
   1.288 +nsresult
   1.289 +NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult,
   1.290 +                           mozilla::dom::EventTarget* aOwner,
   1.291 +                           nsPresContext* aPresContext,
   1.292 +                           mozilla::WidgetEvent* aEvent);
   1.293 +nsresult
   1.294 +NS_NewDOMTextEvent(nsIDOMEvent** aResult,
   1.295 +                   mozilla::dom::EventTarget* aOwner,
   1.296 +                   nsPresContext* aPresContext,
   1.297 +                   mozilla::WidgetTextEvent* aEvent);
   1.298 +nsresult
   1.299 +NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult,
   1.300 +                           mozilla::dom::EventTarget* aOwner,
   1.301 +                           nsPresContext* aPresContext,
   1.302 +                           mozilla::WidgetEvent* aEvent);
   1.303 +nsresult
   1.304 +NS_NewDOMSVGEvent(nsIDOMEvent** aResult,
   1.305 +                  mozilla::dom::EventTarget* aOwner,
   1.306 +                  nsPresContext* aPresContext,
   1.307 +                  mozilla::WidgetEvent* aEvent);
   1.308 +nsresult
   1.309 +NS_NewDOMSVGZoomEvent(nsIDOMEvent** aResult,
   1.310 +                      mozilla::dom::EventTarget* aOwner,
   1.311 +                      nsPresContext* aPresContext,
   1.312 +                      mozilla::WidgetGUIEvent* aEvent);
   1.313 +nsresult
   1.314 +NS_NewDOMTimeEvent(nsIDOMEvent** aResult,
   1.315 +                   mozilla::dom::EventTarget* aOwner,
   1.316 +                   nsPresContext* aPresContext,
   1.317 +                   mozilla::WidgetEvent* aEvent);
   1.318 +nsresult
   1.319 +NS_NewDOMXULCommandEvent(nsIDOMEvent** aResult,
   1.320 +                         mozilla::dom::EventTarget* aOwner,
   1.321 +                         nsPresContext* aPresContext,
   1.322 +                         mozilla::WidgetInputEvent* aEvent);
   1.323 +nsresult
   1.324 +NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
   1.325 +                      mozilla::dom::EventTarget* aOwner,
   1.326 +                      nsPresContext* aPresContext,
   1.327 +                      mozilla::WidgetCommandEvent* aEvent);
   1.328 +nsresult
   1.329 +NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
   1.330 +                      mozilla::dom::EventTarget* aOwner,
   1.331 +                      nsPresContext* aPresContext,
   1.332 +                      mozilla::WidgetEvent* aEvent);
   1.333 +nsresult
   1.334 +NS_NewDOMProgressEvent(nsIDOMEvent** aInstancePtrResult,
   1.335 +                       mozilla::dom::EventTarget* aOwner,
   1.336 +                       nsPresContext* aPresContext,
   1.337 +                       mozilla::WidgetEvent* aEvent);
   1.338 +// This empties aInvalidateRequests.
   1.339 +nsresult
   1.340 +NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aResult,
   1.341 +                          mozilla::dom::EventTarget* aOwner,
   1.342 +                          nsPresContext* aPresContext,
   1.343 +                          mozilla::WidgetEvent* aEvent,
   1.344 +                          uint32_t aEventType = 0,
   1.345 +                          nsInvalidateRequestList* aInvalidateRequests = nullptr);
   1.346 +nsresult
   1.347 +NS_NewDOMSimpleGestureEvent(nsIDOMEvent** aInstancePtrResult,
   1.348 +                            mozilla::dom::EventTarget* aOwner,
   1.349 +                            nsPresContext* aPresContext,
   1.350 +                            mozilla::WidgetSimpleGestureEvent* aEvent);
   1.351 +nsresult
   1.352 +NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult,
   1.353 +                         mozilla::dom::EventTarget* aOwner,
   1.354 +                         nsPresContext* aPresContext,
   1.355 +                         mozilla::InternalScrollAreaEvent* aEvent);
   1.356 +nsresult
   1.357 +NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult,
   1.358 +                         mozilla::dom::EventTarget* aOwner,
   1.359 +                         nsPresContext* aPresContext,
   1.360 +                         mozilla::InternalTransitionEvent* aEvent);
   1.361 +nsresult
   1.362 +NS_NewDOMAnimationEvent(nsIDOMEvent** aInstancePtrResult,
   1.363 +                        mozilla::dom::EventTarget* aOwner,
   1.364 +                        nsPresContext* aPresContext,
   1.365 +                        mozilla::InternalAnimationEvent* aEvent);
   1.366 +nsresult
   1.367 +NS_NewDOMPointerEvent(nsIDOMEvent** aInstancePtrResult,
   1.368 +                      mozilla::dom::EventTarget* aOwner,
   1.369 +                      nsPresContext* aPresContext,
   1.370 +                      mozilla::WidgetPointerEvent* aEvent);
   1.371 +nsresult
   1.372 +NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
   1.373 +                    mozilla::dom::EventTarget* aOwner,
   1.374 +                    nsPresContext* aPresContext,
   1.375 +                    mozilla::WidgetTouchEvent* aEvent);
   1.376 +nsresult
   1.377 +NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
   1.378 +                          mozilla::dom::EventTarget* aOwner,
   1.379 +                          nsPresContext* aPresContext,
   1.380 +                          mozilla::WidgetEvent* aEvent);
   1.381 +nsresult
   1.382 +NS_NewDOMMozApplicationEvent(nsIDOMEvent** aInstancePtrResult,
   1.383 +                             mozilla::dom::EventTarget* aOwner,
   1.384 +                             nsPresContext* aPresContext,
   1.385 +                             mozilla::WidgetEvent* aEvent);
   1.386 +%}

mercurial