OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebInputEvent_h | 31 // TODO(dtapuska): This is a temporarily placeholder file |
32 #define WebInputEvent_h | 32 // while crbug.com/625684 is fixed. |
33 | 33 #include "../platform/WebInputEvent.h" |
34 #include "../platform/WebCommon.h" | |
35 #include "../platform/WebGestureDevice.h" | |
36 #include "../platform/WebPointerProperties.h" | |
37 #include "../platform/WebRect.h" | |
38 #include "WebTouchPoint.h" | |
39 | |
40 #include <string.h> | |
41 | |
42 namespace blink { | |
43 | |
44 // The classes defined in this file are intended to be used with | |
45 // WebWidget's handleInputEvent method. These event types are cross- | |
46 // platform and correspond closely to WebCore's Platform*Event classes. | |
47 // | |
48 // WARNING! These classes must remain PODs (plain old data). They are | |
49 // intended to be "serializable" by copying their raw bytes, so they must | |
50 // not contain any non-bit-copyable member variables! | |
51 // | |
52 // Furthermore, the class members need to be packed so they are aligned | |
53 // properly and don't have paddings/gaps, otherwise memory check tools | |
54 // like Valgrind will complain about uninitialized memory usage when | |
55 // transferring these classes over the wire. | |
56 | |
57 #pragma pack(push, 4) | |
58 | |
59 // WebInputEvent -------------------------------------------------------------- | |
60 | |
61 class WebInputEvent { | |
62 public: | |
63 // When we use an input method (or an input method editor), we receive | |
64 // two events for a keypress. The former event is a keydown, which | |
65 // provides a keycode, and the latter is a textinput, which provides | |
66 // a character processed by an input method. (The mapping from a | |
67 // keycode to a character code is not trivial for non-English | |
68 // keyboards.) | |
69 // To support input methods, Safari sends keydown events to WebKit for | |
70 // filtering. WebKit sends filtered keydown events back to Safari, | |
71 // which sends them to input methods. | |
72 // Unfortunately, it is hard to apply this design to Chrome because of | |
73 // our multiprocess architecture. An input method is running in a | |
74 // browser process. On the other hand, WebKit is running in a renderer | |
75 // process. So, this design results in increasing IPC messages. | |
76 // To support input methods without increasing IPC messages, Chrome | |
77 // handles keyboard events in a browser process and send asynchronous | |
78 // input events (to be translated to DOM events) to a renderer | |
79 // process. | |
80 // This design is mostly the same as the one of Windows and Mac Carbon. | |
81 // So, for what it's worth, our Linux and Mac front-ends emulate our | |
82 // Windows front-end. To emulate our Windows front-end, we can share | |
83 // our back-end code among Windows, Linux, and Mac. | |
84 // TODO(hbono): Issue 18064: remove the KeyDown type since it isn't | |
85 // used in Chrome any longer. | |
86 | |
87 // A Java counterpart will be generated for this enum. | |
88 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.blink_public.web | |
89 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: WebInputEventType | |
90 enum Type { | |
91 Undefined = -1, | |
92 TypeFirst = Undefined, | |
93 | |
94 // WebMouseEvent | |
95 MouseDown, | |
96 MouseTypeFirst = MouseDown, | |
97 MouseUp, | |
98 MouseMove, | |
99 MouseEnter, | |
100 MouseLeave, | |
101 ContextMenu, | |
102 MouseTypeLast = ContextMenu, | |
103 | |
104 // WebMouseWheelEvent | |
105 MouseWheel, | |
106 | |
107 // WebKeyboardEvent | |
108 RawKeyDown, | |
109 KeyboardTypeFirst = RawKeyDown, | |
110 KeyDown, | |
111 KeyUp, | |
112 Char, | |
113 KeyboardTypeLast = Char, | |
114 | |
115 // WebGestureEvent | |
116 GestureScrollBegin, | |
117 GestureTypeFirst = GestureScrollBegin, | |
118 GestureScrollEnd, | |
119 GestureScrollUpdate, | |
120 GestureFlingStart, | |
121 GestureFlingCancel, | |
122 GestureShowPress, | |
123 GestureTap, | |
124 GestureTapUnconfirmed, | |
125 GestureTapDown, | |
126 GestureTapCancel, | |
127 GestureDoubleTap, | |
128 GestureTwoFingerTap, | |
129 GestureLongPress, | |
130 GestureLongTap, | |
131 GesturePinchBegin, | |
132 GesturePinchEnd, | |
133 GesturePinchUpdate, | |
134 GestureTypeLast = GesturePinchUpdate, | |
135 | |
136 // WebTouchEvent | |
137 TouchStart, | |
138 TouchTypeFirst = TouchStart, | |
139 TouchMove, | |
140 TouchEnd, | |
141 TouchCancel, | |
142 TouchScrollStarted, | |
143 TouchTypeLast = TouchScrollStarted, | |
144 | |
145 TypeLast = TouchTypeLast | |
146 }; | |
147 | |
148 // The modifier constants cannot change their values since pepper | |
149 // does a 1-1 mapping of its values; see | |
150 // content/renderer/pepper/event_conversion.cc | |
151 // | |
152 // A Java counterpart will be generated for this enum. | |
153 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.blink_public.web | |
154 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: WebInputEventModifier | |
155 enum Modifiers { | |
156 // modifiers for all events: | |
157 ShiftKey = 1 << 0, | |
158 ControlKey = 1 << 1, | |
159 AltKey = 1 << 2, | |
160 MetaKey = 1 << 3, | |
161 | |
162 // modifiers for keyboard events: | |
163 IsKeyPad = 1 << 4, | |
164 IsAutoRepeat = 1 << 5, | |
165 | |
166 // modifiers for mouse events: | |
167 LeftButtonDown = 1 << 6, | |
168 MiddleButtonDown = 1 << 7, | |
169 RightButtonDown = 1 << 8, | |
170 | |
171 // Toggle modifers for all events. | |
172 CapsLockOn = 1 << 9, | |
173 NumLockOn = 1 << 10, | |
174 | |
175 IsLeft = 1 << 11, | |
176 IsRight = 1 << 12, | |
177 | |
178 // Indicates that an event was generated on the touch screen while | |
179 // touch accessibility is enabled, so the event should be handled | |
180 // by accessibility code first before normal input event processing. | |
181 IsTouchAccessibility = 1 << 13, | |
182 | |
183 IsComposing = 1 << 14, | |
184 | |
185 AltGrKey = 1 << 15, | |
186 FnKey = 1 << 16, | |
187 SymbolKey = 1 << 17, | |
188 | |
189 ScrollLockOn = 1 << 18, | |
190 }; | |
191 | |
192 // Indicates whether the browser needs to block on the ACK result for | |
193 // this event, and if not why note (for metrics/diagnostics purposes). | |
194 // These values are direct mappings of the values in PlatformEvent | |
195 // so the values can be cast between the enumerations. static_asserts | |
196 // checking this are in web/WebInputEventConversion.cpp. | |
197 enum DispatchType { | |
198 // Event can be canceled. | |
199 Blocking, | |
200 // Event can not be canceled. | |
201 EventNonBlocking, | |
202 // All listeners are passive; not cancelable. | |
203 ListenersNonBlockingPassive, | |
204 // This value represents a state which would have normally blocking | |
205 // but was forced to be non-blocking; not cancelable. | |
206 ListenersForcedNonBlockingPassive, | |
207 }; | |
208 | |
209 // The rail mode for a wheel event specifies the axis on which scrolling is | |
210 // expected to stick. If this axis is set to Free, then scrolling is not | |
211 // stuck to any axis. | |
212 enum RailsMode { | |
213 RailsModeFree = 0, | |
214 RailsModeHorizontal = 1, | |
215 RailsModeVertical = 2, | |
216 }; | |
217 | |
218 static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey; | |
219 | |
220 double timeStampSeconds; // Seconds since platform start with microsecond re
solution. | |
221 unsigned size; // The size of this structure, for serialization. | |
222 Type type; | |
223 int modifiers; | |
224 | |
225 // Returns true if the WebInputEvent |type| is a mouse event. | |
226 static bool isMouseEventType(int type) | |
227 { | |
228 return MouseTypeFirst <= type && type <= MouseTypeLast; | |
229 } | |
230 | |
231 // Returns true if the WebInputEvent |type| is a keyboard event. | |
232 static bool isKeyboardEventType(int type) | |
233 { | |
234 return KeyboardTypeFirst <= type && type <= KeyboardTypeLast; | |
235 } | |
236 | |
237 // Returns true if the WebInputEvent |type| is a touch event. | |
238 static bool isTouchEventType(int type) | |
239 { | |
240 return TouchTypeFirst <= type && type <= TouchTypeLast; | |
241 } | |
242 | |
243 // Returns true if the WebInputEvent is a gesture event. | |
244 static bool isGestureEventType(int type) | |
245 { | |
246 return GestureTypeFirst <= type && type <= GestureTypeLast; | |
247 } | |
248 | |
249 protected: | |
250 explicit WebInputEvent(unsigned sizeParam) | |
251 { | |
252 memset(this, 0, sizeParam); | |
253 timeStampSeconds = 0.0; | |
254 size = sizeParam; | |
255 type = Undefined; | |
256 modifiers = 0; | |
257 } | |
258 }; | |
259 | |
260 // WebKeyboardEvent ----------------------------------------------------------- | |
261 | |
262 class WebKeyboardEvent : public WebInputEvent { | |
263 public: | |
264 // Caps on string lengths so we can make them static arrays and keep | |
265 // them PODs. | |
266 static const size_t textLengthCap = 4; | |
267 | |
268 // |windowsKeyCode| is the Windows key code associated with this key | |
269 // event. Sometimes it's direct from the event (i.e. on Windows), | |
270 // sometimes it's via a mapping function. If you want a list, see | |
271 // WebCore/platform/chromium/KeyboardCodes* . Note that this should | |
272 // ALWAYS store the non-locational version of a keycode as this is | |
273 // what is returned by the Windows API. For example, it should | |
274 // store VK_SHIFT instead of VK_RSHIFT. The location information | |
275 // should be stored in |modifiers|. | |
276 int windowsKeyCode; | |
277 | |
278 // The actual key code genenerated by the platform. The DOM spec runs | |
279 // on Windows-equivalent codes (thus |windowsKeyCode| above) but it | |
280 // doesn't hurt to have this one around. | |
281 int nativeKeyCode; | |
282 | |
283 // The DOM code enum of the key pressed as passed by the embedder. DOM | |
284 // code enum are defined in ui/events/keycodes/dom4/keycode_converter_data.h
. | |
285 int domCode; | |
286 | |
287 // The DOM key enum of the key pressed as passed by the embedder. DOM | |
288 // key enum are defined in ui/events/keycodes/dom3/dom_key_data.h | |
289 int domKey; | |
290 | |
291 // This identifies whether this event was tagged by the system as being | |
292 // a "system key" event (see | |
293 // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for | |
294 // details). Other platforms don't have this concept, but it's just | |
295 // easier to leave it always false than ifdef. | |
296 bool isSystemKey; | |
297 | |
298 // Whether the event forms part of a browser-handled keyboard shortcut. | |
299 // This can be used to conditionally suppress Char events after a | |
300 // shortcut-triggering RawKeyDown goes unhandled. | |
301 bool isBrowserShortcut; | |
302 | |
303 // |text| is the text generated by this keystroke. |unmodifiedText| is | |
304 // |text|, but unmodified by an concurrently-held modifiers (except | |
305 // shift). This is useful for working out shortcut keys. Linux and | |
306 // Windows guarantee one character per event. The Mac does not, but in | |
307 // reality that's all it ever gives. We're generous, and cap it a bit | |
308 // longer. | |
309 WebUChar text[textLengthCap]; | |
310 WebUChar unmodifiedText[textLengthCap]; | |
311 | |
312 WebKeyboardEvent() | |
313 : WebInputEvent(sizeof(WebKeyboardEvent)) | |
314 , windowsKeyCode(0) | |
315 , nativeKeyCode(0) | |
316 , isSystemKey(false) | |
317 , isBrowserShortcut(false) | |
318 { | |
319 memset(&text, 0, sizeof(text)); | |
320 memset(&unmodifiedText, 0, sizeof(unmodifiedText)); | |
321 } | |
322 }; | |
323 | |
324 // WebMouseEvent -------------------------------------------------------------- | |
325 | |
326 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { | |
327 public: | |
328 // Renderer coordinates. Similar to viewport coordinates but without | |
329 // DevTools emulation transform or overscroll applied. i.e. the coordinates | |
330 // in Chromium's RenderView bounds. | |
331 int x; | |
332 int y; | |
333 | |
334 // DEPRECATED (crbug.com/507787) | |
335 int windowX; | |
336 int windowY; | |
337 | |
338 // Screen coordinate | |
339 int globalX; | |
340 int globalY; | |
341 | |
342 int movementX; | |
343 int movementY; | |
344 int clickCount; | |
345 | |
346 WebMouseEvent() | |
347 : WebInputEvent(sizeof(WebMouseEvent)) | |
348 , WebPointerProperties() | |
349 , x(0) | |
350 , y(0) | |
351 , windowX(0) | |
352 , windowY(0) | |
353 , globalX(0) | |
354 , globalY(0) | |
355 , movementX(0) | |
356 , movementY(0) | |
357 , clickCount(0) | |
358 { | |
359 } | |
360 | |
361 protected: | |
362 explicit WebMouseEvent(unsigned sizeParam) | |
363 : WebInputEvent(sizeParam) | |
364 , WebPointerProperties() | |
365 , x(0) | |
366 , y(0) | |
367 , windowX(0) | |
368 , windowY(0) | |
369 , globalX(0) | |
370 , globalY(0) | |
371 , movementX(0) | |
372 , movementY(0) | |
373 , clickCount(0) | |
374 { | |
375 } | |
376 }; | |
377 | |
378 // WebMouseWheelEvent --------------------------------------------------------- | |
379 | |
380 class WebMouseWheelEvent : public WebMouseEvent { | |
381 public: | |
382 enum Phase { | |
383 PhaseNone = 0, | |
384 PhaseBegan = 1 << 0, | |
385 PhaseStationary = 1 << 1, | |
386 PhaseChanged = 1 << 2, | |
387 PhaseEnded = 1 << 3, | |
388 PhaseCancelled = 1 << 4, | |
389 PhaseMayBegin = 1 << 5, | |
390 }; | |
391 | |
392 float deltaX; | |
393 float deltaY; | |
394 float wheelTicksX; | |
395 float wheelTicksY; | |
396 | |
397 float accelerationRatioX; | |
398 float accelerationRatioY; | |
399 | |
400 // This field exists to allow BrowserPlugin to mark MouseWheel events as | |
401 // 'resent' to handle the case where an event is not consumed when first | |
402 // encountered; it should be handled differently by the plugin when it is | |
403 // sent for thesecond time. No code within Blink touches this, other than to | |
404 // plumb it through event conversions. | |
405 int resendingPluginId; | |
406 | |
407 Phase phase; | |
408 Phase momentumPhase; | |
409 | |
410 // Rubberbanding is an OSX visual effect. When a user scrolls the content | |
411 // area with a track pad, and the content area is already at its limit in | |
412 // the direction being scrolled, the entire content area is allowed to | |
413 // scroll slightly off screen, revealing a grey background. When the user | |
414 // lets go, the content area snaps back into place. Blink is responsible | |
415 // for this rubberbanding effect, but the embedder may wish to disable | |
416 // rubber banding in the left or right direction, if the scroll should have | |
417 // an alternate effect. The common case is that a scroll in the left or | |
418 // right directions causes a back or forwards navigation, respectively. | |
419 // | |
420 // These flags prevent rubber banding from starting in a given direction, | |
421 // but have no effect on an ongoing rubber banding. A rubber banding that | |
422 // started in the vertical direction is allowed to continue in the right | |
423 // direction, even if canRubberbandRight is 0. | |
424 bool canRubberbandLeft; | |
425 bool canRubberbandRight; | |
426 | |
427 bool scrollByPage; | |
428 bool hasPreciseScrollingDeltas; | |
429 | |
430 RailsMode railsMode; | |
431 | |
432 // Whether the event is blocking, non-blocking, all event | |
433 // listeners were passive or was forced to be non-blocking. | |
434 DispatchType dispatchType; | |
435 | |
436 WebMouseWheelEvent() | |
437 : WebMouseEvent(sizeof(WebMouseWheelEvent)) | |
438 , deltaX(0.0f) | |
439 , deltaY(0.0f) | |
440 , wheelTicksX(0.0f) | |
441 , wheelTicksY(0.0f) | |
442 , accelerationRatioX(1.0f) | |
443 , accelerationRatioY(1.0f) | |
444 , resendingPluginId(-1) | |
445 , phase(PhaseNone) | |
446 , momentumPhase(PhaseNone) | |
447 , canRubberbandLeft(true) | |
448 , canRubberbandRight(true) | |
449 , scrollByPage(false) | |
450 , hasPreciseScrollingDeltas(false) | |
451 , railsMode(RailsModeFree) | |
452 , dispatchType(Blocking) | |
453 { | |
454 } | |
455 }; | |
456 | |
457 // WebGestureEvent -------------------------------------------------------------
- | |
458 | |
459 class WebGestureEvent : public WebInputEvent { | |
460 public: | |
461 enum ScrollUnits { | |
462 PrecisePixels = 0, // generated by high precision devices. | |
463 Pixels, // large pixel jump duration; should animate to delta. | |
464 Page // page (visible viewport) based scrolling. | |
465 }; | |
466 | |
467 enum InertialPhaseState { | |
468 UnknownMomentumPhase = 0, // No phase information. | |
469 NonMomentumPhase, // Regular scrolling phase. | |
470 MomentumPhase, // Momentum phase. | |
471 }; | |
472 | |
473 int x; | |
474 int y; | |
475 int globalX; | |
476 int globalY; | |
477 WebGestureDevice sourceDevice; | |
478 | |
479 // If the WebGestureEvent has sourceDevice=WebGestureDeviceTouchscreen, this | |
480 // field contains the unique identifier for the touch event that released | |
481 // this event at TouchDispositionGestureFilter. If the WebGestureEvents was | |
482 // not released through a touch event (e.g. timer-released gesture events or | |
483 // gesture events with sourceDevice!=WebGestureDeviceTouchscreen), the field | |
484 // contains 0. See crbug.com/618738. | |
485 uint32_t uniqueTouchEventId; | |
486 | |
487 // This field exists to allow BrowserPlugin to mark GestureScroll events as | |
488 // 'resent' to handle the case where an event is not consumed when first | |
489 // encountered; it should be handled differently by the plugin when it is | |
490 // sent for thesecond time. No code within Blink touches this, other than to | |
491 // plumb it through event conversions. | |
492 int resendingPluginId; | |
493 | |
494 union { | |
495 // Tap information must be set for GestureTap, GestureTapUnconfirmed, | |
496 // and GestureDoubleTap events. | |
497 struct { | |
498 int tapCount; | |
499 float width; | |
500 float height; | |
501 } tap; | |
502 | |
503 struct { | |
504 float width; | |
505 float height; | |
506 } tapDown; | |
507 | |
508 struct { | |
509 float width; | |
510 float height; | |
511 } showPress; | |
512 | |
513 struct { | |
514 float width; | |
515 float height; | |
516 } longPress; | |
517 | |
518 struct { | |
519 float firstFingerWidth; | |
520 float firstFingerHeight; | |
521 } twoFingerTap; | |
522 | |
523 struct { | |
524 // Initial motion that triggered the scroll. | |
525 // May be redundant with deltaX/deltaY in the first scrollUpdate. | |
526 float deltaXHint; | |
527 float deltaYHint; | |
528 // Default initialized to ScrollUnits::PrecisePixels. | |
529 ScrollUnits deltaHintUnits; | |
530 // If true, this event will skip hit testing to find a scroll | |
531 // target and instead just scroll the viewport. | |
532 bool targetViewport; | |
533 // The state of inertial phase scrolling. OSX has unique phases for
normal and | |
534 // momentum scroll events. Should always be UnknownMomentumPhase for
touch based | |
535 // input as it generates GestureFlingStart instead. | |
536 InertialPhaseState inertialPhase; | |
537 // True if this event was synthesized in order to force a hit test;
avoiding scroll | |
538 // latching behavior until crbug.com/526463 is fully implemented. | |
539 bool synthetic; | |
540 } scrollBegin; | |
541 | |
542 struct { | |
543 float deltaX; | |
544 float deltaY; | |
545 float velocityX; | |
546 float velocityY; | |
547 // Whether any previous GestureScrollUpdate in the current scroll | |
548 // sequence was suppressed (e.g., the causal touchmove was | |
549 // preventDefault'ed). This bit is particularly useful for | |
550 // determining whether the observed scroll update sequence captures | |
551 // the entirety of the generative motion. | |
552 bool previousUpdateInSequencePrevented; | |
553 bool preventPropagation; | |
554 InertialPhaseState inertialPhase; | |
555 // Default initialized to ScrollUnits::PrecisePixels. | |
556 ScrollUnits deltaUnits; | |
557 } scrollUpdate; | |
558 | |
559 struct { | |
560 // The original delta units the scrollBegin and scrollUpdates | |
561 // were sent as. | |
562 ScrollUnits deltaUnits; | |
563 // The state of inertial phase scrolling. OSX has unique phases for
normal and | |
564 // momentum scroll events. Should always be UnknownMomentumPhase for
touch based | |
565 // input as it generates GestureFlingStart instead. | |
566 InertialPhaseState inertialPhase; | |
567 // True if this event was synthesized in order to generate the prope
r | |
568 // GSB/GSU/GSE matching sequences. This is a temporary so that a fut
ure | |
569 // GSB will generate a hit test so latching behavior is avoided | |
570 // until crbug.com/526463 is fully implemented. | |
571 bool synthetic; | |
572 } scrollEnd; | |
573 | |
574 struct { | |
575 float velocityX; | |
576 float velocityY; | |
577 // If true, this event will skip hit testing to find a scroll | |
578 // target and instead just scroll the viewport. | |
579 bool targetViewport; | |
580 } flingStart; | |
581 | |
582 struct { | |
583 // If set to true, don't treat flingCancel | |
584 // as a part of fling boost events sequence. | |
585 bool preventBoosting; | |
586 } flingCancel; | |
587 | |
588 struct { | |
589 bool zoomDisabled; | |
590 float scale; | |
591 } pinchUpdate; | |
592 } data; | |
593 | |
594 WebGestureEvent() | |
595 : WebInputEvent(sizeof(WebGestureEvent)) | |
596 , x(0) | |
597 , y(0) | |
598 , globalX(0) | |
599 , globalY(0) | |
600 , sourceDevice(WebGestureDeviceUninitialized) | |
601 , resendingPluginId(-1) | |
602 { | |
603 memset(&data, 0, sizeof(data)); | |
604 } | |
605 }; | |
606 | |
607 // WebTouchEvent -------------------------------------------------------------- | |
608 | |
609 // TODO(e_hakkinen): Replace with WebPointerEvent. crbug.com/508283 | |
610 class WebTouchEvent : public WebInputEvent { | |
611 public: | |
612 // Maximum number of simultaneous touches supported on | |
613 // Ash/Aura. | |
614 enum { touchesLengthCap = 16 }; | |
615 | |
616 unsigned touchesLength; | |
617 // List of all touches, regardless of state. | |
618 WebTouchPoint touches[touchesLengthCap]; | |
619 | |
620 // Whether the event is blocking, non-blocking, all event | |
621 // listeners were passive or was forced to be non-blocking. | |
622 DispatchType dispatchType; | |
623 | |
624 // For a single touch, this is true after the touch-point has moved beyond | |
625 // the platform slop region. For a multitouch, this is true after any | |
626 // touch-point has moved (by whatever amount). | |
627 bool movedBeyondSlopRegion; | |
628 | |
629 // Whether there was an active fling animation when the event was | |
630 // dispatched. | |
631 bool dispatchedDuringFling; | |
632 | |
633 // A unique identifier for the touch event. Valid ids start at one and | |
634 // increase monotonically. Zero means an unknown id. | |
635 uint32_t uniqueTouchEventId; | |
636 | |
637 WebTouchEvent() | |
638 : WebInputEvent(sizeof(WebTouchEvent)) | |
639 , touchesLength(0) | |
640 , dispatchType(Blocking) | |
641 , movedBeyondSlopRegion(false) | |
642 , dispatchedDuringFling(false) | |
643 , uniqueTouchEventId(0) | |
644 { | |
645 } | |
646 }; | |
647 | |
648 #pragma pack(pop) | |
649 | |
650 } // namespace blink | |
651 | |
652 #endif | |
OLD | NEW |