dom/interfaces/events/nsIDOMEvent.idl

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial