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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // expected to stick. If this axis is set to Free, then scrolling is not | 221 // expected to stick. If this axis is set to Free, then scrolling is not |
222 // stuck to any axis. | 222 // stuck to any axis. |
223 enum RailsMode { | 223 enum RailsMode { |
224 RailsModeFree = 0, | 224 RailsModeFree = 0, |
225 RailsModeHorizontal = 1, | 225 RailsModeHorizontal = 1, |
226 RailsModeVertical = 2, | 226 RailsModeVertical = 2, |
227 }; | 227 }; |
228 | 228 |
229 static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey; | 229 static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey; |
230 | 230 |
231 double | 231 double timeStampSeconds; // Seconds since platform start with microsecond |
232 timeStampSeconds; // Seconds since platform start with microsecond resolu
tion. | 232 // resolution. |
233 unsigned size; // The size of this structure, for serialization. | 233 unsigned size; // The size of this structure, for serialization. |
234 Type type; | 234 Type type; |
235 int modifiers; | 235 int modifiers; |
236 | 236 |
237 // Returns true if the WebInputEvent |type| is a mouse event. | 237 // Returns true if the WebInputEvent |type| is a mouse event. |
238 static bool isMouseEventType(int type) { | 238 static bool isMouseEventType(int type) { |
239 return MouseTypeFirst <= type && type <= MouseTypeLast; | 239 return MouseTypeFirst <= type && type <= MouseTypeLast; |
240 } | 240 } |
241 | 241 |
242 // Returns true if the WebInputEvent |type| is a keyboard event. | 242 // Returns true if the WebInputEvent |type| is a keyboard event. |
243 static bool isKeyboardEventType(int type) { | 243 static bool isKeyboardEventType(int type) { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 accelerationRatioY(1.0f), | 456 accelerationRatioY(1.0f), |
457 resendingPluginId(-1), | 457 resendingPluginId(-1), |
458 phase(PhaseNone), | 458 phase(PhaseNone), |
459 momentumPhase(PhaseNone), | 459 momentumPhase(PhaseNone), |
460 scrollByPage(false), | 460 scrollByPage(false), |
461 hasPreciseScrollingDeltas(false), | 461 hasPreciseScrollingDeltas(false), |
462 railsMode(RailsModeFree), | 462 railsMode(RailsModeFree), |
463 dispatchType(Blocking) {} | 463 dispatchType(Blocking) {} |
464 }; | 464 }; |
465 | 465 |
466 // WebGestureEvent -------------------------------------------------------------
- | 466 // WebGestureEvent --------------------------------------------------------- |
467 | 467 |
468 class WebGestureEvent : public WebInputEvent { | 468 class WebGestureEvent : public WebInputEvent { |
469 public: | 469 public: |
470 enum ScrollUnits { | 470 enum ScrollUnits { |
471 PrecisePixels = 0, // generated by high precision devices. | 471 PrecisePixels = 0, // generated by high precision devices. |
472 Pixels, // large pixel jump duration; should animate to delta. | 472 Pixels, // large pixel jump duration; should animate to delta. |
473 Page // page (visible viewport) based scrolling. | 473 Page // page (visible viewport) based scrolling. |
474 }; | 474 }; |
475 | 475 |
476 enum InertialPhaseState { | 476 enum InertialPhaseState { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 struct { | 532 struct { |
533 // Initial motion that triggered the scroll. | 533 // Initial motion that triggered the scroll. |
534 // May be redundant with deltaX/deltaY in the first scrollUpdate. | 534 // May be redundant with deltaX/deltaY in the first scrollUpdate. |
535 float deltaXHint; | 535 float deltaXHint; |
536 float deltaYHint; | 536 float deltaYHint; |
537 // Default initialized to ScrollUnits::PrecisePixels. | 537 // Default initialized to ScrollUnits::PrecisePixels. |
538 ScrollUnits deltaHintUnits; | 538 ScrollUnits deltaHintUnits; |
539 // If true, this event will skip hit testing to find a scroll | 539 // If true, this event will skip hit testing to find a scroll |
540 // target and instead just scroll the viewport. | 540 // target and instead just scroll the viewport. |
541 bool targetViewport; | 541 bool targetViewport; |
542 // The state of inertial phase scrolling. OSX has unique phases for normal
and | 542 // The state of inertial phase scrolling. OSX has unique phases for normal |
543 // momentum scroll events. Should always be UnknownMomentumPhase for touch
based | 543 // and momentum scroll events. Should always be UnknownMomentumPhase for |
544 // input as it generates GestureFlingStart instead. | 544 // touch based input as it generates GestureFlingStart instead. |
545 InertialPhaseState inertialPhase; | 545 InertialPhaseState inertialPhase; |
546 // True if this event was synthesized in order to force a hit test; avoidi
ng scroll | 546 // True if this event was synthesized in order to force a hit test; |
547 // latching behavior until crbug.com/526463 is fully implemented. | 547 // avoiding scroll latching behavior until crbug.com/526463 is fully |
| 548 // implemented. |
548 bool synthetic; | 549 bool synthetic; |
549 | 550 |
550 // number of pointers down. | 551 // number of pointers down. |
551 int pointerCount; | 552 int pointerCount; |
552 } scrollBegin; | 553 } scrollBegin; |
553 | 554 |
554 struct { | 555 struct { |
555 float deltaX; | 556 float deltaX; |
556 float deltaY; | 557 float deltaY; |
557 float velocityX; | 558 float velocityX; |
558 float velocityY; | 559 float velocityY; |
559 // Whether any previous GestureScrollUpdate in the current scroll | 560 // Whether any previous GestureScrollUpdate in the current scroll |
560 // sequence was suppressed (e.g., the causal touchmove was | 561 // sequence was suppressed (e.g., the causal touchmove was |
561 // preventDefault'ed). This bit is particularly useful for | 562 // preventDefault'ed). This bit is particularly useful for |
562 // determining whether the observed scroll update sequence captures | 563 // determining whether the observed scroll update sequence captures |
563 // the entirety of the generative motion. | 564 // the entirety of the generative motion. |
564 bool previousUpdateInSequencePrevented; | 565 bool previousUpdateInSequencePrevented; |
565 bool preventPropagation; | 566 bool preventPropagation; |
566 InertialPhaseState inertialPhase; | 567 InertialPhaseState inertialPhase; |
567 // Default initialized to ScrollUnits::PrecisePixels. | 568 // Default initialized to ScrollUnits::PrecisePixels. |
568 ScrollUnits deltaUnits; | 569 ScrollUnits deltaUnits; |
569 } scrollUpdate; | 570 } scrollUpdate; |
570 | 571 |
571 struct { | 572 struct { |
572 // The original delta units the scrollBegin and scrollUpdates | 573 // The original delta units the scrollBegin and scrollUpdates |
573 // were sent as. | 574 // were sent as. |
574 ScrollUnits deltaUnits; | 575 ScrollUnits deltaUnits; |
575 // The state of inertial phase scrolling. OSX has unique phases for normal
and | 576 // The state of inertial phase scrolling. OSX has unique phases for normal |
576 // momentum scroll events. Should always be UnknownMomentumPhase for touch
based | 577 // and momentum scroll events. Should always be UnknownMomentumPhase for |
577 // input as it generates GestureFlingStart instead. | 578 // touch based input as it generates GestureFlingStart instead. |
578 InertialPhaseState inertialPhase; | 579 InertialPhaseState inertialPhase; |
579 // True if this event was synthesized in order to generate the proper | 580 // True if this event was synthesized in order to generate the proper |
580 // GSB/GSU/GSE matching sequences. This is a temporary so that a future | 581 // GSB/GSU/GSE matching sequences. This is a temporary so that a future |
581 // GSB will generate a hit test so latching behavior is avoided | 582 // GSB will generate a hit test so latching behavior is avoided |
582 // until crbug.com/526463 is fully implemented. | 583 // until crbug.com/526463 is fully implemented. |
583 bool synthetic; | 584 bool synthetic; |
584 } scrollEnd; | 585 } scrollEnd; |
585 | 586 |
586 struct { | 587 struct { |
587 float velocityX; | 588 float velocityX; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 635 |
635 // For a single touch, this is true after the touch-point has moved beyond | 636 // For a single touch, this is true after the touch-point has moved beyond |
636 // the platform slop region. For a multitouch, this is true after any | 637 // the platform slop region. For a multitouch, this is true after any |
637 // touch-point has moved (by whatever amount). | 638 // touch-point has moved (by whatever amount). |
638 bool movedBeyondSlopRegion; | 639 bool movedBeyondSlopRegion; |
639 | 640 |
640 // Whether there was an active fling animation when the event was | 641 // Whether there was an active fling animation when the event was |
641 // dispatched. | 642 // dispatched. |
642 bool dispatchedDuringFling; | 643 bool dispatchedDuringFling; |
643 | 644 |
644 // Whether this touch event is a touchstart or a first touchmove event per scr
oll. | 645 // Whether this touch event is a touchstart or a first touchmove event per |
| 646 // scroll. |
645 bool touchStartOrFirstTouchMove; | 647 bool touchStartOrFirstTouchMove; |
646 | 648 |
647 // A unique identifier for the touch event. Valid ids start at one and | 649 // A unique identifier for the touch event. Valid ids start at one and |
648 // increase monotonically. Zero means an unknown id. | 650 // increase monotonically. Zero means an unknown id. |
649 uint32_t uniqueTouchEventId; | 651 uint32_t uniqueTouchEventId; |
650 | 652 |
651 WebTouchEvent() | 653 WebTouchEvent() |
652 : WebInputEvent(sizeof(WebTouchEvent)), | 654 : WebInputEvent(sizeof(WebTouchEvent)), |
653 touchesLength(0), | 655 touchesLength(0), |
654 dispatchType(Blocking), | 656 dispatchType(Blocking), |
655 movedBeyondSlopRegion(false), | 657 movedBeyondSlopRegion(false), |
656 dispatchedDuringFling(false), | 658 dispatchedDuringFling(false), |
657 touchStartOrFirstTouchMove(false), | 659 touchStartOrFirstTouchMove(false), |
658 uniqueTouchEventId(0) {} | 660 uniqueTouchEventId(0) {} |
659 }; | 661 }; |
660 | 662 |
661 #pragma pack(pop) | 663 #pragma pack(pop) |
662 | 664 |
663 } // namespace blink | 665 } // namespace blink |
664 | 666 |
665 #endif | 667 #endif |
OLD | NEW |