Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / MouseEvent.webidl
blob979c05ca4961d199fa1ca10cf569e1111c915f9c
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/.
5  *
6  * For more information on this interface please see
7  * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
8  * https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
9  *
10  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
11  * liability, trademark and document use rules apply.
12  */
14 interface nsIScreen;
16 [Exposed=Window]
17 interface MouseEvent : UIEvent {
18   constructor(DOMString typeArg,
19               optional MouseEventInit mouseEventInitDict = {});
21   [NeedsCallerType]
22   readonly attribute long           screenX;
23   [NeedsCallerType]
24   readonly attribute long           screenY;
26   [ChromeOnly]
27   readonly attribute nsIScreen?     screen;
29   readonly attribute long           pageX;
30   readonly attribute long           pageY;
31   readonly attribute long           clientX;
32   readonly attribute long           clientY;
33   [BinaryName="clientX"]
34   readonly attribute long           x;
35   [BinaryName="clientY"]
36   readonly attribute long           y;
37   readonly attribute long           offsetX;
38   readonly attribute long           offsetY;
39   readonly attribute boolean        ctrlKey;
40   readonly attribute boolean        shiftKey;
41   readonly attribute boolean        altKey;
42   readonly attribute boolean        metaKey;
43   readonly attribute short          button;
44   readonly attribute unsigned short buttons;
45   readonly attribute EventTarget?   relatedTarget;
47   // Pointer Lock
48   readonly attribute long           movementX;
49   readonly attribute long           movementY;
51   // Deprecated in DOM Level 3:
52   [Deprecated="InitMouseEvent"]
53   undefined initMouseEvent(DOMString typeArg,
54                          optional boolean canBubbleArg = false,
55                          optional boolean cancelableArg = false,
56                          optional Window? viewArg = null,
57                          optional long detailArg = 0,
58                          optional long screenXArg = 0,
59                          optional long screenYArg = 0,
60                          optional long clientXArg = 0,
61                          optional long clientYArg = 0,
62                          optional boolean ctrlKeyArg = false,
63                          optional boolean altKeyArg = false,
64                          optional boolean shiftKeyArg = false,
65                          optional boolean metaKeyArg = false,
66                          optional short buttonArg = 0,
67                          optional EventTarget? relatedTargetArg = null);
68   // Introduced in DOM Level 3:
69   boolean                           getModifierState(DOMString keyArg);
72 // Suggested initMouseEvent replacement initializer:
73 dictionary MouseEventInit : EventModifierInit {
74   // Attributes for MouseEvent:
75   long           screenX       = 0;
76   long           screenY       = 0;
77   long           clientX       = 0;
78   long           clientY       = 0;
79   short          button        = 0;
80   // Note: "buttons" was not previously initializable through initMouseEvent!
81   unsigned short buttons       = 0;
82   EventTarget?   relatedTarget = null;
84   // Pointer Lock
85   long           movementX = 0;
86   long           movementY = 0;
89 // Mozilla extensions
90 partial interface MouseEvent
92   // Finger or touch pressure event value
93   // ranges between 0.0 and 1.0
94   // TODO: Remove mozPressure. (bug 1534199)
95   [Deprecated="MouseEvent_MozPressure"]
96   readonly attribute float mozPressure;
98   const unsigned short    MOZ_SOURCE_UNKNOWN    = 0;
99   const unsigned short    MOZ_SOURCE_MOUSE      = 1;
100   const unsigned short    MOZ_SOURCE_PEN        = 2;
101   const unsigned short    MOZ_SOURCE_ERASER     = 3;
102   const unsigned short    MOZ_SOURCE_CURSOR     = 4;
103   const unsigned short    MOZ_SOURCE_TOUCH      = 5;
104   const unsigned short    MOZ_SOURCE_KEYBOARD   = 6;
106   [ChromeOnly]
107   readonly attribute unsigned short inputSource;
109   [Deprecated="MozInputSource", BinaryName="inputSource"]
110   readonly attribute unsigned short mozInputSource;
112   // TODO: Remove initNSMouseEvent. (bug 1165213)
113   [Deprecated="InitNSMouseEvent"]
114   undefined initNSMouseEvent(DOMString typeArg,
115                              optional boolean canBubbleArg = false,
116                              optional boolean cancelableArg = false,
117                              optional Window? viewArg = null,
118                              optional long detailArg = 0,
119                              optional long screenXArg = 0,
120                              optional long screenYArg = 0,
121                              optional long clientXArg = 0,
122                              optional long clientYArg = 0,
123                              optional boolean ctrlKeyArg = false,
124                              optional boolean altKeyArg = false,
125                              optional boolean shiftKeyArg = false,
126                              optional boolean metaKeyArg = false,
127                              optional short buttonArg = 0,
128                              optional EventTarget? relatedTargetArg = null,
129                              optional float pressure = 0,
130                              optional unsigned short inputSourceArg = 0);
132   /**
133    * preventClickEvent() prevents the following "click", "auxclick" and
134    * "dblclick" events of "mousedown" and "mouseup" events.
135    */
136   [ChromeOnly]
137   undefined preventClickEvent();
139   /**
140    * Returns true if the following "click", "auxclick" and "dblclick"
141    * events of "mousedown" and "mouseup" events are prevented.
142    */
143   [ChromeOnly]
144   boolean clickEventPrevented();