Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
7 #include "nsIDOMMouseEvent.idl"
9 /**
10 * The nsIDOMSimpleGestureEvent interface is the datatype for all
11 * Mozilla-specific simple gesture events in the Document Object Model.
12 *
13 * The following events are generated:
14 *
15 * MozSwipeGestureStart - Generated when the user starts a horizontal
16 * swipe across the input device. This event not only acts as a signal,
17 * but also asks two questions: Should a swipe really be started, and
18 * in which directions should the user be able to swipe? The first
19 * question is answered by event listeners by calling or not calling
20 * preventDefault() on the event. Since a swipe swallows all scroll
21 * events, the default action of the swipe start event is *not* to
22 * start a swipe. Call preventDefault() if you want a swipe to be
23 * started.
24 * The second question (swipe-able directions) is answered in the
25 * allowedDirections field.
26 * If this event has preventDefault() called on it (and thus starts
27 * a swipe), it guarantees a future MozSwipeGestureEnd event that
28 * will signal the end of a swipe animation.
29 *
30 * MozSwipeGestureUpdate - Generated periodically while the user is
31 * continuing a horizontal swipe gesture. The "delta" value represents
32 * the current absolute gesture amount. This event may even be sent
33 * after a MozSwipeGesture event fired in order to allow for fluid
34 * completion of a swipe animation. The direction value is meaningless
35 * on swipe update events.
36 *
37 * MozSwipeGestureEnd - Generated when the swipe animation is completed.
38 *
39 * MozSwipeGesture - Generated when the user releases a swipe across
40 * across the input device. This event signals that the actual swipe
41 * operation is complete, even though the animation might not be finished
42 * yet. This event can be sent without accompanying start / update / end
43 * events, and it can also be handled on its own if the consumer doesn't
44 * want to handle swipe animation events.
45 * Only the direction value has any significance, the delta value is
46 * meaningless.
47 *
48 * MozMagnifyGestureStart - Generated when the user begins the magnify
49 * ("pinch") gesture. The "delta" value represents the initial
50 * movement.
51 *
52 * MozMagnifyGestureUpdate - Generated periodically while the user is
53 * continuing the magnify ("pinch") gesture. The "delta" value
54 * represents the movement since the last MozMagnifyGestureStart or
55 * MozMagnifyGestureUpdate event.
56 *
57 * MozMagnifyGesture - Generated when the user has completed the
58 * magnify ("pinch") gesture. If you only want to receive a single
59 * event when the magnify gesture is complete, you only need to hook
60 * this event and can safely ignore the MozMagnifyGestureStart and the
61 * MozMagnifyGestureUpdate events. The "delta" value is the cumulative
62 * amount represented by the user's gesture.
63 *
64 * MozRotateGestureStart - Generated when the user begins the rotation
65 * gesture. The "delta" value represents the initial rotation.
66 *
67 * MozRotateGestureUpdate - Generated periodically while the user is
68 * continuing the rotation gesture. The "delta" value represents the
69 * rotation since the last MozRotateGestureStart or
70 * MozRotateGestureUpdate event.
71 *
72 * MozRotateGesture - Generated when the user has completed the
73 * rotation gesture. If you only want to receive a single event when
74 * the rotation gesture is complete, you only need to hook this event
75 * and can safely ignore the MozRotateGestureStart and the
76 * MozRotateGestureUpdate events. The "delta" value is the cumulative
77 * amount of rotation represented by the user's gesture.
78 *
79 * MozTapGesture - Generated when the user executes a two finger
80 * tap gesture on the input device. Client coordinates contain the
81 * center point of the tap.
82 * (XXX On OS X, only Lion (10.7) and up)
83 *
84 * MozPressTapGesture - Generated when the user executes a press
85 * and tap two finger gesture (first finger down, second finger down,
86 * second finger up, first finger up) on the input device.
87 * Client coordinates contain the center pivot point of the action.
88 * (XXX Not implemented on Mac)
89 *
90 * MozEdgeUIGesture - Generated when the user swipes the display to
91 * invoke edge ui.
92 * (XXX Win8 only)
93 *
94 * Default behavior:
95 *
96 * Some operating systems support default behaviors for gesture events
97 * when they are not handled by the application. Consumers should
98 * use event.preventDefault() to prevent default behavior when
99 * consuming events.
100 */
102 [scriptable, builtinclass, uuid(d78656ab-9d68-4f03-83f9-7c7bee071aa7)]
103 interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
104 {
105 /* Swipe direction constants */
106 const unsigned long DIRECTION_UP = 1;
107 const unsigned long DIRECTION_DOWN = 2;
108 const unsigned long DIRECTION_LEFT = 4;
109 const unsigned long DIRECTION_RIGHT = 8;
111 /* Rotational direction constants */
112 const unsigned long ROTATION_COUNTERCLOCKWISE = 1;
113 const unsigned long ROTATION_CLOCKWISE = 2;
115 /* Read-write value for swipe events.
116 *
117 * Reports the directions that can be swiped to; multiple directions
118 * should be OR'ed together.
119 *
120 * The allowedDirections field is designed to be set on SwipeGestureStart
121 * events by event listeners. Its value after event dispatch determines
122 * the behavior of the swipe animation that is about to begin.
123 * Specifically, if the user swipes in a direction that can't be swiped
124 * to, the animation will have a bounce effect.
125 * Future SwipeGestureUpdate, SwipeGesture and SwipeGestureEnd events
126 * will carry the allowDirections value that was set on the SwipeStart
127 * event. Changing this field on non-SwipeGestureStart events doesn't
128 * have any effect.
129 */
130 attribute unsigned long allowedDirections;
132 /* Direction of a gesture. Diagonals are indicated by OR'ing the
133 * applicable constants together.
134 *
135 * Swipes gestures may occur in any direction.
136 *
137 * Magnify gestures do not have a direction.
138 *
139 * Rotation gestures will be either ROTATION_COUNTERCLOCKWISE or
140 * ROTATION_CLOCKWISE.
141 */
142 readonly attribute unsigned long direction;
144 /* Delta value for magnify, rotate and swipe gestures.
145 *
146 * For rotation, the value is in degrees and is positive for
147 * clockwise rotation and negative for counterclockwise
148 * rotation.
149 *
150 * For magnification, the value will be positive for a "zoom in"
151 * (i.e, increased magnification) and negative for a "zoom out"
152 * (i.e., decreased magnification). The particular units
153 * represented by the "delta" are currently implementation specific.
154 *
155 * XXX - The units for measuring magnification are currently
156 * unspecified because the units used by Mac OS X are currently
157 * undocumented. The values are typically in the range of 0.0 to
158 * 100.0, but it is only safe currently to rely on the delta being
159 * positive or negative.
160 *
161 * For swipe start, update and end events, the value is a fraction
162 * of one "page". If the resulting swipe will have DIRECTION_LEFT, the
163 * delta value will be positive; for DIRECTION_RIGHT, delta is negative.
164 * If this seems backwards to you, look at it this way: If the current
165 * page is pushed to the right during the animation (positive delta),
166 * the page left to the current page will be visible after the swipe
167 * (DIRECTION_LEFT).
168 *
169 * Units on Windows represent the difference between the initial
170 * and current/final width between the two touch points on the input
171 * device and are measured in pixels.
172 */
173 readonly attribute double delta;
175 /* Click count value for taps. */
176 readonly attribute unsigned long clickCount;
178 void initSimpleGestureEvent(in DOMString typeArg,
179 in boolean canBubbleArg,
180 in boolean cancelableArg,
181 in nsIDOMWindow viewArg,
182 in long detailArg,
183 in long screenXArg,
184 in long screenYArg,
185 in long clientXArg,
186 in long clientYArg,
187 in boolean ctrlKeyArg,
188 in boolean altKeyArg,
189 in boolean shiftKeyArg,
190 in boolean metaKeyArg,
191 in unsigned short buttonArg,
192 in nsIDOMEventTarget relatedTargetArg,
193 in unsigned long allowedDirectionsArg,
194 in unsigned long directionArg,
195 in double deltaArg,
196 in unsigned long clickCount);
197 };