| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 TypeFirst = Undefined, | 87 TypeFirst = Undefined, |
| 88 | 88 |
| 89 // WebPointerEvent | 89 // WebPointerEvent |
| 90 PointerDown, | 90 PointerDown, |
| 91 PointerTypeFirst = PointerDown, | 91 PointerTypeFirst = PointerDown, |
| 92 PointerUp, | 92 PointerUp, |
| 93 PointerMove, | 93 PointerMove, |
| 94 PointerCancel, | 94 PointerCancel, |
| 95 PointerTypeLast = PointerCancel, | 95 PointerTypeLast = PointerCancel, |
| 96 | 96 |
| 97 // WebMouseEvent | |
| 98 MouseDown, | |
| 99 MouseTypeFirst = MouseDown, | |
| 100 MouseUp, | |
| 101 MouseMove, | |
| 102 MouseEnter, | |
| 103 MouseLeave, | |
| 104 MouseTypeLast = MouseLeave, | |
| 105 | |
| 106 // WebMouseWheelEvent | |
| 107 MouseWheel, | |
| 108 | |
| 109 // WebKeyboardEvent | 97 // WebKeyboardEvent |
| 110 RawKeyDown, | 98 RawKeyDown, |
| 111 KeyboardTypeFirst = RawKeyDown, | 99 KeyboardTypeFirst = RawKeyDown, |
| 112 KeyDown, | 100 KeyDown, |
| 113 KeyUp, | 101 KeyUp, |
| 114 Char, | 102 Char, |
| 115 KeyboardTypeLast = Char, | 103 KeyboardTypeLast = Char, |
| 116 | 104 |
| 117 // WebGestureEvent | 105 // WebGestureEvent |
| 118 GestureScrollBegin, | 106 GestureScrollBegin, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 double timeStampSeconds; // Seconds since epoch. | 175 double timeStampSeconds; // Seconds since epoch. |
| 188 unsigned size; // The size of this structure, for serialization. | 176 unsigned size; // The size of this structure, for serialization. |
| 189 Type type; | 177 Type type; |
| 190 int modifiers; | 178 int modifiers; |
| 191 | 179 |
| 192 static bool isPointerEventType(int type) | 180 static bool isPointerEventType(int type) |
| 193 { | 181 { |
| 194 return PointerTypeFirst <= type && type <= PointerTypeLast; | 182 return PointerTypeFirst <= type && type <= PointerTypeLast; |
| 195 } | 183 } |
| 196 | 184 |
| 197 // Returns true if the WebInputEvent |type| is a mouse event. | |
| 198 static bool isMouseEventType(int type) | |
| 199 { | |
| 200 return MouseTypeFirst <= type && type <= MouseTypeLast; | |
| 201 } | |
| 202 | |
| 203 // Returns true if the WebInputEvent |type| is a keyboard event. | 185 // Returns true if the WebInputEvent |type| is a keyboard event. |
| 204 static bool isKeyboardEventType(int type) | 186 static bool isKeyboardEventType(int type) |
| 205 { | 187 { |
| 206 return KeyboardTypeFirst <= type && type <= KeyboardTypeLast; | 188 return KeyboardTypeFirst <= type && type <= KeyboardTypeLast; |
| 207 } | 189 } |
| 208 | 190 |
| 209 // Returns true if the WebInputEvent |type| is a touch event. | 191 // Returns true if the WebInputEvent |type| is a touch event. |
| 210 static bool isTouchEventType(int type) | 192 static bool isTouchEventType(int type) |
| 211 { | 193 { |
| 212 return TouchTypeFirst <= type && type <= TouchTypeLast; | 194 return TouchTypeFirst <= type && type <= TouchTypeLast; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 304 } |
| 323 | 305 |
| 324 // Sets keyIdentifier based on the value of windowsKeyCode. This is | 306 // Sets keyIdentifier based on the value of windowsKeyCode. This is |
| 325 // handy for generating synthetic keyboard events. | 307 // handy for generating synthetic keyboard events. |
| 326 BLINK_EXPORT void setKeyIdentifierFromWindowsKeyCode(); | 308 BLINK_EXPORT void setKeyIdentifierFromWindowsKeyCode(); |
| 327 | 309 |
| 328 static int windowsKeyCodeWithoutLocation(int keycode); | 310 static int windowsKeyCodeWithoutLocation(int keycode); |
| 329 static int locationModifiersFromWindowsKeyCode(int keycode); | 311 static int locationModifiersFromWindowsKeyCode(int keycode); |
| 330 }; | 312 }; |
| 331 | 313 |
| 332 // WebMouseEvent -------------------------------------------------------------- | |
| 333 | |
| 334 class WebMouseEvent : public WebInputEvent { | |
| 335 public: | |
| 336 enum Button { | |
| 337 ButtonNone = -1, | |
| 338 ButtonLeft, | |
| 339 ButtonMiddle, | |
| 340 ButtonRight | |
| 341 }; | |
| 342 | |
| 343 Button button; | |
| 344 int x; | |
| 345 int y; | |
| 346 int windowX; | |
| 347 int windowY; | |
| 348 int globalX; | |
| 349 int globalY; | |
| 350 int movementX; | |
| 351 int movementY; | |
| 352 int clickCount; | |
| 353 | |
| 354 WebMouseEvent() | |
| 355 : WebInputEvent(sizeof(WebMouseEvent)) | |
| 356 , button(ButtonNone) | |
| 357 , x(0) | |
| 358 , y(0) | |
| 359 , windowX(0) | |
| 360 , windowY(0) | |
| 361 , globalX(0) | |
| 362 , globalY(0) | |
| 363 , movementX(0) | |
| 364 , movementY(0) | |
| 365 , clickCount(0) | |
| 366 { | |
| 367 } | |
| 368 | |
| 369 protected: | |
| 370 explicit WebMouseEvent(unsigned sizeParam) | |
| 371 : WebInputEvent(sizeParam) | |
| 372 , button(ButtonNone) | |
| 373 , x(0) | |
| 374 , y(0) | |
| 375 , windowX(0) | |
| 376 , windowY(0) | |
| 377 , globalX(0) | |
| 378 , globalY(0) | |
| 379 , movementX(0) | |
| 380 , movementY(0) | |
| 381 , clickCount(0) | |
| 382 { | |
| 383 } | |
| 384 }; | |
| 385 | |
| 386 // WebMouseWheelEvent --------------------------------------------------------- | |
| 387 | |
| 388 class WebMouseWheelEvent : public WebMouseEvent { | |
| 389 public: | |
| 390 enum Phase { | |
| 391 PhaseNone = 0, | |
| 392 PhaseBegan = 1 << 0, | |
| 393 PhaseStationary = 1 << 1, | |
| 394 PhaseChanged = 1 << 2, | |
| 395 PhaseEnded = 1 << 3, | |
| 396 PhaseCancelled = 1 << 4, | |
| 397 PhaseMayBegin = 1 << 5, | |
| 398 }; | |
| 399 | |
| 400 float deltaX; | |
| 401 float deltaY; | |
| 402 float wheelTicksX; | |
| 403 float wheelTicksY; | |
| 404 | |
| 405 float accelerationRatioX; | |
| 406 float accelerationRatioY; | |
| 407 | |
| 408 // See comment at the top of the file for why an int is used here. | |
| 409 int scrollByPage; | |
| 410 | |
| 411 // See comment at the top of the file for why an int is used here. | |
| 412 int hasPreciseScrollingDeltas; | |
| 413 Phase phase; | |
| 414 Phase momentumPhase; | |
| 415 | |
| 416 // See comment at the top of the file for why an int is used here. | |
| 417 // Rubberbanding is an OSX visual effect. When a user scrolls the content | |
| 418 // area with a track pad, and the content area is already at its limit in | |
| 419 // the direction being scrolled, the entire content area is allowed to | |
| 420 // scroll slightly off screen, revealing a grey background. When the user | |
| 421 // lets go, the content area snaps back into place. Blink is responsible | |
| 422 // for this rubberbanding effect, but the embedder may wish to disable | |
| 423 // rubber banding in the left or right direction, if the scroll should have | |
| 424 // an alternate effect. The common case is that a scroll in the left or | |
| 425 // right directions causes a back or forwards navigation, respectively. | |
| 426 // | |
| 427 // These flags prevent rubber banding from starting in a given direction, | |
| 428 // but have no effect on an ongoing rubber banding. A rubber banding that | |
| 429 // started in the vertical direction is allowed to continue in the right | |
| 430 // direction, even if canRubberbandRight is 0. | |
| 431 int canRubberbandLeft; | |
| 432 int canRubberbandRight; | |
| 433 | |
| 434 WebMouseWheelEvent() | |
| 435 : WebMouseEvent(sizeof(WebMouseWheelEvent)) | |
| 436 , deltaX(0.0f) | |
| 437 , deltaY(0.0f) | |
| 438 , wheelTicksX(0.0f) | |
| 439 , wheelTicksY(0.0f) | |
| 440 , accelerationRatioX(1.0f) | |
| 441 , accelerationRatioY(1.0f) | |
| 442 , scrollByPage(false) | |
| 443 , hasPreciseScrollingDeltas(false) | |
| 444 , phase(PhaseNone) | |
| 445 , momentumPhase(PhaseNone) | |
| 446 , canRubberbandLeft(true) | |
| 447 , canRubberbandRight(true) | |
| 448 { | |
| 449 } | |
| 450 }; | |
| 451 | |
| 452 // WebGestureEvent -------------------------------------------------------------
- | 314 // WebGestureEvent -------------------------------------------------------------
- |
| 453 | 315 |
| 454 class WebGestureEvent : public WebInputEvent { | 316 class WebGestureEvent : public WebInputEvent { |
| 455 public: | 317 public: |
| 456 int x; | 318 int x; |
| 457 int y; | 319 int y; |
| 458 int globalX; | 320 int globalX; |
| 459 int globalY; | 321 int globalY; |
| 460 WebGestureDevice sourceDevice; | 322 WebGestureDevice sourceDevice; |
| 461 | 323 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 , cancelable(true) | 418 , cancelable(true) |
| 557 { | 419 { |
| 558 } | 420 } |
| 559 }; | 421 }; |
| 560 | 422 |
| 561 #pragma pack(pop) | 423 #pragma pack(pop) |
| 562 | 424 |
| 563 } // namespace blink | 425 } // namespace blink |
| 564 | 426 |
| 565 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBINPUTEVENT_H_ | 427 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBINPUTEVENT_H_ |
| OLD | NEW |