| 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 14 matching lines...) Expand all Loading... |
| 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 #ifndef WebInputEvent_h |
| 32 #define WebInputEvent_h | 32 #define WebInputEvent_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebGestureDevice.h" | |
| 36 #include "WebPointerProperties.h" | 35 #include "WebPointerProperties.h" |
| 37 #include "WebRect.h" | 36 #include "WebRect.h" |
| 38 #include "WebTouchPoint.h" | 37 #include "WebTouchPoint.h" |
| 39 | 38 |
| 40 #include <string.h> | 39 #include <string.h> |
| 41 | 40 |
| 42 namespace blink { | 41 namespace blink { |
| 43 | 42 |
| 44 // The classes defined in this file are intended to be used with | 43 // The classes defined in this file are intended to be used with |
| 45 // WebWidget's handleInputEvent method. These event types are cross- | 44 // WebWidget's handleInputEvent method. These event types are cross- |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // longer. | 325 // longer. |
| 327 WebUChar text[textLengthCap]; | 326 WebUChar text[textLengthCap]; |
| 328 WebUChar unmodifiedText[textLengthCap]; | 327 WebUChar unmodifiedText[textLengthCap]; |
| 329 | 328 |
| 330 WebKeyboardEvent() | 329 WebKeyboardEvent() |
| 331 : WebInputEvent(sizeof(WebKeyboardEvent)), | 330 : WebInputEvent(sizeof(WebKeyboardEvent)), |
| 332 windowsKeyCode(0), | 331 windowsKeyCode(0), |
| 333 nativeKeyCode(0), | 332 nativeKeyCode(0), |
| 334 isSystemKey(false), | 333 isSystemKey(false), |
| 335 isBrowserShortcut(false) { | 334 isBrowserShortcut(false) { |
| 336 memset(&text, 0, sizeof(text)); | |
| 337 memset(&unmodifiedText, 0, sizeof(unmodifiedText)); | |
| 338 } | 335 } |
| 339 | 336 |
| 340 // Please refer to bug http://b/issue?id=961192, which talks about Webkit | 337 // Please refer to bug http://b/issue?id=961192, which talks about Webkit |
| 341 // keyboard event handling changes. It also mentions the list of keys | 338 // keyboard event handling changes. It also mentions the list of keys |
| 342 // which don't have associated character events. | 339 // which don't have associated character events. |
| 343 bool isCharacterKey() const { | 340 bool isCharacterKey() const { |
| 344 // TODO(dtapuska): Determine if we can remove this method and just | 341 // TODO(dtapuska): Determine if we can remove this method and just |
| 345 // not actually generate events for these instead of filtering them out. | 342 // not actually generate events for these instead of filtering them out. |
| 346 switch (windowsKeyCode) { | 343 switch (windowsKeyCode) { |
| 347 case 0x08: // VK_BACK | 344 case 0x08: // VK_BACK |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 accelerationRatioY(1.0f), | 450 accelerationRatioY(1.0f), |
| 454 resendingPluginId(-1), | 451 resendingPluginId(-1), |
| 455 phase(PhaseNone), | 452 phase(PhaseNone), |
| 456 momentumPhase(PhaseNone), | 453 momentumPhase(PhaseNone), |
| 457 scrollByPage(false), | 454 scrollByPage(false), |
| 458 hasPreciseScrollingDeltas(false), | 455 hasPreciseScrollingDeltas(false), |
| 459 railsMode(RailsModeFree), | 456 railsMode(RailsModeFree), |
| 460 dispatchType(Blocking) {} | 457 dispatchType(Blocking) {} |
| 461 }; | 458 }; |
| 462 | 459 |
| 463 // WebGestureEvent --------------------------------------------------------- | |
| 464 | |
| 465 class WebGestureEvent : public WebInputEvent { | |
| 466 public: | |
| 467 enum ScrollUnits { | |
| 468 PrecisePixels = 0, // generated by high precision devices. | |
| 469 Pixels, // large pixel jump duration; should animate to delta. | |
| 470 Page // page (visible viewport) based scrolling. | |
| 471 }; | |
| 472 | |
| 473 enum InertialPhaseState { | |
| 474 UnknownMomentumPhase = 0, // No phase information. | |
| 475 NonMomentumPhase, // Regular scrolling phase. | |
| 476 MomentumPhase, // Momentum phase. | |
| 477 }; | |
| 478 | |
| 479 int x; | |
| 480 int y; | |
| 481 int globalX; | |
| 482 int globalY; | |
| 483 WebGestureDevice sourceDevice; | |
| 484 | |
| 485 // If the WebGestureEvent has sourceDevice=WebGestureDeviceTouchscreen, this | |
| 486 // field contains the unique identifier for the touch event that released | |
| 487 // this event at TouchDispositionGestureFilter. If the WebGestureEvents was | |
| 488 // not released through a touch event (e.g. timer-released gesture events or | |
| 489 // gesture events with sourceDevice!=WebGestureDeviceTouchscreen), the field | |
| 490 // contains 0. See crbug.com/618738. | |
| 491 uint32_t uniqueTouchEventId; | |
| 492 | |
| 493 // This field exists to allow BrowserPlugin to mark GestureScroll events as | |
| 494 // 'resent' to handle the case where an event is not consumed when first | |
| 495 // encountered; it should be handled differently by the plugin when it is | |
| 496 // sent for thesecond time. No code within Blink touches this, other than to | |
| 497 // plumb it through event conversions. | |
| 498 int resendingPluginId; | |
| 499 | |
| 500 union { | |
| 501 // Tap information must be set for GestureTap, GestureTapUnconfirmed, | |
| 502 // and GestureDoubleTap events. | |
| 503 struct { | |
| 504 int tapCount; | |
| 505 float width; | |
| 506 float height; | |
| 507 } tap; | |
| 508 | |
| 509 struct { | |
| 510 float width; | |
| 511 float height; | |
| 512 } tapDown; | |
| 513 | |
| 514 struct { | |
| 515 float width; | |
| 516 float height; | |
| 517 } showPress; | |
| 518 | |
| 519 struct { | |
| 520 float width; | |
| 521 float height; | |
| 522 } longPress; | |
| 523 | |
| 524 struct { | |
| 525 float firstFingerWidth; | |
| 526 float firstFingerHeight; | |
| 527 } twoFingerTap; | |
| 528 | |
| 529 struct { | |
| 530 // Initial motion that triggered the scroll. | |
| 531 // May be redundant with deltaX/deltaY in the first scrollUpdate. | |
| 532 float deltaXHint; | |
| 533 float deltaYHint; | |
| 534 // Default initialized to ScrollUnits::PrecisePixels. | |
| 535 ScrollUnits deltaHintUnits; | |
| 536 // If true, this event will skip hit testing to find a scroll | |
| 537 // target and instead just scroll the viewport. | |
| 538 bool targetViewport; | |
| 539 // The state of inertial phase scrolling. OSX has unique phases for normal | |
| 540 // and momentum scroll events. Should always be UnknownMomentumPhase for | |
| 541 // touch based input as it generates GestureFlingStart instead. | |
| 542 InertialPhaseState inertialPhase; | |
| 543 // True if this event was synthesized in order to force a hit test; | |
| 544 // avoiding scroll latching behavior until crbug.com/526463 is fully | |
| 545 // implemented. | |
| 546 bool synthetic; | |
| 547 | |
| 548 // number of pointers down. | |
| 549 int pointerCount; | |
| 550 } scrollBegin; | |
| 551 | |
| 552 struct { | |
| 553 float deltaX; | |
| 554 float deltaY; | |
| 555 float velocityX; | |
| 556 float velocityY; | |
| 557 // Whether any previous GestureScrollUpdate in the current scroll | |
| 558 // sequence was suppressed (e.g., the causal touchmove was | |
| 559 // preventDefault'ed). This bit is particularly useful for | |
| 560 // determining whether the observed scroll update sequence captures | |
| 561 // the entirety of the generative motion. | |
| 562 bool previousUpdateInSequencePrevented; | |
| 563 bool preventPropagation; | |
| 564 InertialPhaseState inertialPhase; | |
| 565 // Default initialized to ScrollUnits::PrecisePixels. | |
| 566 ScrollUnits deltaUnits; | |
| 567 } scrollUpdate; | |
| 568 | |
| 569 struct { | |
| 570 // The original delta units the scrollBegin and scrollUpdates | |
| 571 // were sent as. | |
| 572 ScrollUnits deltaUnits; | |
| 573 // The state of inertial phase scrolling. OSX has unique phases for normal | |
| 574 // and momentum scroll events. Should always be UnknownMomentumPhase for | |
| 575 // touch based input as it generates GestureFlingStart instead. | |
| 576 InertialPhaseState inertialPhase; | |
| 577 // True if this event was synthesized in order to generate the proper | |
| 578 // GSB/GSU/GSE matching sequences. This is a temporary so that a future | |
| 579 // GSB will generate a hit test so latching behavior is avoided | |
| 580 // until crbug.com/526463 is fully implemented. | |
| 581 bool synthetic; | |
| 582 } scrollEnd; | |
| 583 | |
| 584 struct { | |
| 585 float velocityX; | |
| 586 float velocityY; | |
| 587 // If true, this event will skip hit testing to find a scroll | |
| 588 // target and instead just scroll the viewport. | |
| 589 bool targetViewport; | |
| 590 } flingStart; | |
| 591 | |
| 592 struct { | |
| 593 // If set to true, don't treat flingCancel | |
| 594 // as a part of fling boost events sequence. | |
| 595 bool preventBoosting; | |
| 596 } flingCancel; | |
| 597 | |
| 598 struct { | |
| 599 bool zoomDisabled; | |
| 600 float scale; | |
| 601 } pinchUpdate; | |
| 602 } data; | |
| 603 | |
| 604 WebGestureEvent() | |
| 605 : WebInputEvent(sizeof(WebGestureEvent)), | |
| 606 x(0), | |
| 607 y(0), | |
| 608 globalX(0), | |
| 609 globalY(0), | |
| 610 sourceDevice(WebGestureDeviceUninitialized), | |
| 611 resendingPluginId(-1) { | |
| 612 memset(&data, 0, sizeof(data)); | |
| 613 } | |
| 614 }; | |
| 615 | 460 |
| 616 // WebTouchEvent -------------------------------------------------------------- | 461 // WebTouchEvent -------------------------------------------------------------- |
| 617 | 462 |
| 618 // TODO(e_hakkinen): Replace with WebPointerEvent. crbug.com/508283 | 463 // TODO(e_hakkinen): Replace with WebPointerEvent. crbug.com/508283 |
| 619 class WebTouchEvent : public WebInputEvent { | 464 class WebTouchEvent : public WebInputEvent { |
| 620 public: | 465 public: |
| 621 // Maximum number of simultaneous touches supported on | 466 // Maximum number of simultaneous touches supported on |
| 622 // Ash/Aura. | 467 // Ash/Aura. |
| 623 enum { kTouchesLengthCap = 16 }; | 468 enum { kTouchesLengthCap = 16 }; |
| 624 | 469 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 650 movedBeyondSlopRegion(false), | 495 movedBeyondSlopRegion(false), |
| 651 touchStartOrFirstTouchMove(false), | 496 touchStartOrFirstTouchMove(false), |
| 652 uniqueTouchEventId(0) {} | 497 uniqueTouchEventId(0) {} |
| 653 }; | 498 }; |
| 654 | 499 |
| 655 #pragma pack(pop) | 500 #pragma pack(pop) |
| 656 | 501 |
| 657 } // namespace blink | 502 } // namespace blink |
| 658 | 503 |
| 659 #endif | 504 #endif |
| OLD | NEW |