| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 webViewImpl->setPageScaleFactor(2); | 317 webViewImpl->setPageScaleFactor(2); |
| 318 | 318 |
| 319 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 319 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 320 Document* document = | 320 Document* document = |
| 321 toLocalFrame(webViewImpl->page()->mainFrame())->document(); | 321 toLocalFrame(webViewImpl->page()->mainFrame())->document(); |
| 322 LocalDOMWindow* domWindow = document->domWindow(); | 322 LocalDOMWindow* domWindow = document->domWindow(); |
| 323 LayoutViewItem documentLayoutView = document->layoutViewItem(); | 323 LayoutViewItem documentLayoutView = document->layoutViewItem(); |
| 324 | 324 |
| 325 { | 325 { |
| 326 WebMouseEvent webMouseEvent; | 326 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
| 327 webMouseEvent.type = WebInputEvent::MouseMove; | 327 WebInputEvent::NoModifiers, |
| 328 WebInputEvent::TimeStampForTesting); |
| 328 webMouseEvent.x = 10; | 329 webMouseEvent.x = 10; |
| 329 webMouseEvent.y = 10; | 330 webMouseEvent.y = 10; |
| 330 webMouseEvent.windowX = 10; | 331 webMouseEvent.windowX = 10; |
| 331 webMouseEvent.windowY = 10; | 332 webMouseEvent.windowY = 10; |
| 332 webMouseEvent.globalX = 10; | 333 webMouseEvent.globalX = 10; |
| 333 webMouseEvent.globalY = 10; | 334 webMouseEvent.globalY = 10; |
| 334 webMouseEvent.movementX = 10; | 335 webMouseEvent.movementX = 10; |
| 335 webMouseEvent.movementY = 10; | 336 webMouseEvent.movementY = 10; |
| 336 | 337 |
| 337 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 338 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
| 338 EXPECT_EQ(5, platformMouseBuilder.position().x()); | 339 EXPECT_EQ(5, platformMouseBuilder.position().x()); |
| 339 EXPECT_EQ(5, platformMouseBuilder.position().y()); | 340 EXPECT_EQ(5, platformMouseBuilder.position().y()); |
| 340 EXPECT_EQ(10, platformMouseBuilder.globalPosition().x()); | 341 EXPECT_EQ(10, platformMouseBuilder.globalPosition().x()); |
| 341 EXPECT_EQ(10, platformMouseBuilder.globalPosition().y()); | 342 EXPECT_EQ(10, platformMouseBuilder.globalPosition().y()); |
| 342 EXPECT_EQ(5, platformMouseBuilder.movementDelta().x()); | 343 EXPECT_EQ(5, platformMouseBuilder.movementDelta().x()); |
| 343 EXPECT_EQ(5, platformMouseBuilder.movementDelta().y()); | 344 EXPECT_EQ(5, platformMouseBuilder.movementDelta().y()); |
| 344 } | 345 } |
| 345 | 346 |
| 346 { | 347 { |
| 347 WebGestureEvent webGestureEvent; | 348 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, |
| 348 webGestureEvent.type = WebInputEvent::GestureScrollUpdate; | 349 WebInputEvent::NoModifiers, |
| 350 WebInputEvent::TimeStampForTesting); |
| 349 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 351 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 350 webGestureEvent.x = 10; | 352 webGestureEvent.x = 10; |
| 351 webGestureEvent.y = 12; | 353 webGestureEvent.y = 12; |
| 352 webGestureEvent.globalX = 20; | 354 webGestureEvent.globalX = 20; |
| 353 webGestureEvent.globalY = 22; | 355 webGestureEvent.globalY = 22; |
| 354 webGestureEvent.data.scrollUpdate.deltaX = 30; | 356 webGestureEvent.data.scrollUpdate.deltaX = 30; |
| 355 webGestureEvent.data.scrollUpdate.deltaY = 32; | 357 webGestureEvent.data.scrollUpdate.deltaY = 32; |
| 356 webGestureEvent.data.scrollUpdate.velocityX = 40; | 358 webGestureEvent.data.scrollUpdate.velocityX = 40; |
| 357 webGestureEvent.data.scrollUpdate.velocityY = 42; | 359 webGestureEvent.data.scrollUpdate.velocityY = 42; |
| 358 webGestureEvent.data.scrollUpdate.inertialPhase = | 360 webGestureEvent.data.scrollUpdate.inertialPhase = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 369 // TODO: The velocity values may need to be scaled to page scale in | 371 // TODO: The velocity values may need to be scaled to page scale in |
| 370 // order to remain consist with delta values. | 372 // order to remain consist with delta values. |
| 371 EXPECT_EQ(40, platformGestureBuilder.velocityX()); | 373 EXPECT_EQ(40, platformGestureBuilder.velocityX()); |
| 372 EXPECT_EQ(42, platformGestureBuilder.velocityY()); | 374 EXPECT_EQ(42, platformGestureBuilder.velocityY()); |
| 373 EXPECT_EQ(ScrollInertialPhaseMomentum, | 375 EXPECT_EQ(ScrollInertialPhaseMomentum, |
| 374 platformGestureBuilder.inertialPhase()); | 376 platformGestureBuilder.inertialPhase()); |
| 375 EXPECT_TRUE(platformGestureBuilder.preventPropagation()); | 377 EXPECT_TRUE(platformGestureBuilder.preventPropagation()); |
| 376 } | 378 } |
| 377 | 379 |
| 378 { | 380 { |
| 379 WebGestureEvent webGestureEvent; | 381 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollEnd, |
| 380 webGestureEvent.type = WebInputEvent::GestureScrollEnd; | 382 WebInputEvent::NoModifiers, |
| 383 WebInputEvent::TimeStampForTesting); |
| 381 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 384 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 382 webGestureEvent.x = 10; | 385 webGestureEvent.x = 10; |
| 383 webGestureEvent.y = 12; | 386 webGestureEvent.y = 12; |
| 384 webGestureEvent.globalX = 20; | 387 webGestureEvent.globalX = 20; |
| 385 webGestureEvent.globalY = 22; | 388 webGestureEvent.globalY = 22; |
| 386 | 389 |
| 387 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 390 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 388 EXPECT_EQ(5, platformGestureBuilder.position().x()); | 391 EXPECT_EQ(5, platformGestureBuilder.position().x()); |
| 389 EXPECT_EQ(6, platformGestureBuilder.position().y()); | 392 EXPECT_EQ(6, platformGestureBuilder.position().y()); |
| 390 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x()); | 393 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x()); |
| 391 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y()); | 394 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y()); |
| 392 EXPECT_EQ(ScrollInertialPhaseUnknown, | 395 EXPECT_EQ(ScrollInertialPhaseUnknown, |
| 393 platformGestureBuilder.inertialPhase()); | 396 platformGestureBuilder.inertialPhase()); |
| 394 } | 397 } |
| 395 | 398 |
| 396 { | 399 { |
| 397 WebGestureEvent webGestureEvent; | 400 WebGestureEvent webGestureEvent(WebInputEvent::GestureTap, |
| 398 webGestureEvent.type = WebInputEvent::GestureTap; | 401 WebInputEvent::NoModifiers, |
| 402 WebInputEvent::TimeStampForTesting); |
| 399 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 403 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 400 webGestureEvent.data.tap.width = 10; | 404 webGestureEvent.data.tap.width = 10; |
| 401 webGestureEvent.data.tap.height = 10; | 405 webGestureEvent.data.tap.height = 10; |
| 402 | 406 |
| 403 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 407 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 404 EXPECT_EQ(5, platformGestureBuilder.area().width()); | 408 EXPECT_EQ(5, platformGestureBuilder.area().width()); |
| 405 EXPECT_EQ(5, platformGestureBuilder.area().height()); | 409 EXPECT_EQ(5, platformGestureBuilder.area().height()); |
| 406 } | 410 } |
| 407 | 411 |
| 408 { | 412 { |
| 409 WebGestureEvent webGestureEvent; | 413 WebGestureEvent webGestureEvent(WebInputEvent::GestureTapUnconfirmed, |
| 410 webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed; | 414 WebInputEvent::NoModifiers, |
| 415 WebInputEvent::TimeStampForTesting); |
| 411 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 416 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 412 webGestureEvent.data.tap.width = 10; | 417 webGestureEvent.data.tap.width = 10; |
| 413 webGestureEvent.data.tap.height = 10; | 418 webGestureEvent.data.tap.height = 10; |
| 414 | 419 |
| 415 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 420 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 416 EXPECT_EQ(5, platformGestureBuilder.area().width()); | 421 EXPECT_EQ(5, platformGestureBuilder.area().width()); |
| 417 EXPECT_EQ(5, platformGestureBuilder.area().height()); | 422 EXPECT_EQ(5, platformGestureBuilder.area().height()); |
| 418 } | 423 } |
| 419 | 424 |
| 420 { | 425 { |
| 421 WebGestureEvent webGestureEvent; | 426 WebGestureEvent webGestureEvent(WebInputEvent::GestureTapDown, |
| 422 webGestureEvent.type = WebInputEvent::GestureTapDown; | 427 WebInputEvent::NoModifiers, |
| 428 WebInputEvent::TimeStampForTesting); |
| 423 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 429 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 424 webGestureEvent.data.tapDown.width = 10; | 430 webGestureEvent.data.tapDown.width = 10; |
| 425 webGestureEvent.data.tapDown.height = 10; | 431 webGestureEvent.data.tapDown.height = 10; |
| 426 | 432 |
| 427 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 433 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 428 EXPECT_EQ(5, platformGestureBuilder.area().width()); | 434 EXPECT_EQ(5, platformGestureBuilder.area().width()); |
| 429 EXPECT_EQ(5, platformGestureBuilder.area().height()); | 435 EXPECT_EQ(5, platformGestureBuilder.area().height()); |
| 430 } | 436 } |
| 431 | 437 |
| 432 { | 438 { |
| 433 WebGestureEvent webGestureEvent; | 439 WebGestureEvent webGestureEvent(WebInputEvent::GestureShowPress, |
| 434 webGestureEvent.type = WebInputEvent::GestureShowPress; | 440 WebInputEvent::NoModifiers, |
| 441 WebInputEvent::TimeStampForTesting); |
| 435 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 442 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 436 webGestureEvent.data.showPress.width = 10; | 443 webGestureEvent.data.showPress.width = 10; |
| 437 webGestureEvent.data.showPress.height = 10; | 444 webGestureEvent.data.showPress.height = 10; |
| 438 | 445 |
| 439 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 446 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 440 EXPECT_EQ(5, platformGestureBuilder.area().width()); | 447 EXPECT_EQ(5, platformGestureBuilder.area().width()); |
| 441 EXPECT_EQ(5, platformGestureBuilder.area().height()); | 448 EXPECT_EQ(5, platformGestureBuilder.area().height()); |
| 442 } | 449 } |
| 443 | 450 |
| 444 { | 451 { |
| 445 WebGestureEvent webGestureEvent; | 452 WebGestureEvent webGestureEvent(WebInputEvent::GestureLongPress, |
| 446 webGestureEvent.type = WebInputEvent::GestureLongPress; | 453 WebInputEvent::NoModifiers, |
| 454 WebInputEvent::TimeStampForTesting); |
| 447 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 455 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 448 webGestureEvent.data.longPress.width = 10; | 456 webGestureEvent.data.longPress.width = 10; |
| 449 webGestureEvent.data.longPress.height = 10; | 457 webGestureEvent.data.longPress.height = 10; |
| 450 | 458 |
| 451 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 459 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 452 EXPECT_EQ(5, platformGestureBuilder.area().width()); | 460 EXPECT_EQ(5, platformGestureBuilder.area().width()); |
| 453 EXPECT_EQ(5, platformGestureBuilder.area().height()); | 461 EXPECT_EQ(5, platformGestureBuilder.area().height()); |
| 454 } | 462 } |
| 455 | 463 |
| 456 { | 464 { |
| 457 WebGestureEvent webGestureEvent; | 465 WebGestureEvent webGestureEvent(WebInputEvent::GestureTwoFingerTap, |
| 458 webGestureEvent.type = WebInputEvent::GestureTwoFingerTap; | 466 WebInputEvent::NoModifiers, |
| 467 WebInputEvent::TimeStampForTesting); |
| 459 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 468 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 460 webGestureEvent.data.twoFingerTap.firstFingerWidth = 10; | 469 webGestureEvent.data.twoFingerTap.firstFingerWidth = 10; |
| 461 webGestureEvent.data.twoFingerTap.firstFingerHeight = 10; | 470 webGestureEvent.data.twoFingerTap.firstFingerHeight = 10; |
| 462 | 471 |
| 463 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 472 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 464 EXPECT_EQ(5, platformGestureBuilder.area().width()); | 473 EXPECT_EQ(5, platformGestureBuilder.area().width()); |
| 465 EXPECT_EQ(5, platformGestureBuilder.area().height()); | 474 EXPECT_EQ(5, platformGestureBuilder.area().height()); |
| 466 } | 475 } |
| 467 | 476 |
| 468 { | 477 { |
| 469 WebTouchEvent webTouchEvent; | 478 WebTouchEvent webTouchEvent(WebInputEvent::TouchMove, |
| 470 webTouchEvent.type = WebInputEvent::TouchMove; | 479 WebInputEvent::NoModifiers, |
| 480 WebInputEvent::TimeStampForTesting); |
| 471 webTouchEvent.touchesLength = 1; | 481 webTouchEvent.touchesLength = 1; |
| 472 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 482 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
| 473 webTouchEvent.touches[0].screenPosition.x = 10.6f; | 483 webTouchEvent.touches[0].screenPosition.x = 10.6f; |
| 474 webTouchEvent.touches[0].screenPosition.y = 10.4f; | 484 webTouchEvent.touches[0].screenPosition.y = 10.4f; |
| 475 webTouchEvent.touches[0].position.x = 10.6f; | 485 webTouchEvent.touches[0].position.x = 10.6f; |
| 476 webTouchEvent.touches[0].position.y = 10.4f; | 486 webTouchEvent.touches[0].position.y = 10.4f; |
| 477 webTouchEvent.touches[0].radiusX = 10.6f; | 487 webTouchEvent.touches[0].radiusX = 10.6f; |
| 478 webTouchEvent.touches[0].radiusY = 10.4f; | 488 webTouchEvent.touches[0].radiusY = 10.4f; |
| 479 | 489 |
| 480 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); | 490 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 609 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
| 600 webViewImpl->updateAllLifecyclePhases(); | 610 webViewImpl->updateAllLifecyclePhases(); |
| 601 | 611 |
| 602 webViewImpl->setPageScaleFactor(2); | 612 webViewImpl->setPageScaleFactor(2); |
| 603 webViewImpl->mainFrameImpl()->setInputEventsTransformForEmulation( | 613 webViewImpl->mainFrameImpl()->setInputEventsTransformForEmulation( |
| 604 IntSize(10, 20), 1.5); | 614 IntSize(10, 20), 1.5); |
| 605 | 615 |
| 606 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 616 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 607 | 617 |
| 608 { | 618 { |
| 609 WebMouseEvent webMouseEvent; | 619 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
| 610 webMouseEvent.type = WebInputEvent::MouseMove; | 620 WebInputEvent::NoModifiers, |
| 621 WebInputEvent::TimeStampForTesting); |
| 611 webMouseEvent.x = 100; | 622 webMouseEvent.x = 100; |
| 612 webMouseEvent.y = 110; | 623 webMouseEvent.y = 110; |
| 613 webMouseEvent.windowX = 100; | 624 webMouseEvent.windowX = 100; |
| 614 webMouseEvent.windowY = 110; | 625 webMouseEvent.windowY = 110; |
| 615 webMouseEvent.globalX = 100; | 626 webMouseEvent.globalX = 100; |
| 616 webMouseEvent.globalY = 110; | 627 webMouseEvent.globalY = 110; |
| 617 webMouseEvent.movementX = 60; | 628 webMouseEvent.movementX = 60; |
| 618 webMouseEvent.movementY = 60; | 629 webMouseEvent.movementY = 60; |
| 619 | 630 |
| 620 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 631 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
| 621 EXPECT_EQ(30, platformMouseBuilder.position().x()); | 632 EXPECT_EQ(30, platformMouseBuilder.position().x()); |
| 622 EXPECT_EQ(30, platformMouseBuilder.position().y()); | 633 EXPECT_EQ(30, platformMouseBuilder.position().y()); |
| 623 EXPECT_EQ(100, platformMouseBuilder.globalPosition().x()); | 634 EXPECT_EQ(100, platformMouseBuilder.globalPosition().x()); |
| 624 EXPECT_EQ(110, platformMouseBuilder.globalPosition().y()); | 635 EXPECT_EQ(110, platformMouseBuilder.globalPosition().y()); |
| 625 EXPECT_EQ(20, platformMouseBuilder.movementDelta().x()); | 636 EXPECT_EQ(20, platformMouseBuilder.movementDelta().x()); |
| 626 EXPECT_EQ(20, platformMouseBuilder.movementDelta().y()); | 637 EXPECT_EQ(20, platformMouseBuilder.movementDelta().y()); |
| 627 } | 638 } |
| 628 | 639 |
| 629 { | 640 { |
| 630 WebMouseEvent webMouseEvent1; | 641 WebMouseEvent webMouseEvent1(WebInputEvent::MouseMove, |
| 631 webMouseEvent1.type = WebInputEvent::MouseMove; | 642 WebInputEvent::NoModifiers, |
| 643 WebInputEvent::TimeStampForTesting); |
| 632 webMouseEvent1.x = 100; | 644 webMouseEvent1.x = 100; |
| 633 webMouseEvent1.y = 110; | 645 webMouseEvent1.y = 110; |
| 634 webMouseEvent1.windowX = 100; | 646 webMouseEvent1.windowX = 100; |
| 635 webMouseEvent1.windowY = 110; | 647 webMouseEvent1.windowY = 110; |
| 636 webMouseEvent1.globalX = 100; | 648 webMouseEvent1.globalX = 100; |
| 637 webMouseEvent1.globalY = 110; | 649 webMouseEvent1.globalY = 110; |
| 638 webMouseEvent1.movementX = 60; | 650 webMouseEvent1.movementX = 60; |
| 639 webMouseEvent1.movementY = 60; | 651 webMouseEvent1.movementY = 60; |
| 640 | 652 |
| 641 WebMouseEvent webMouseEvent2 = webMouseEvent1; | 653 WebMouseEvent webMouseEvent2 = webMouseEvent1; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 661 | 673 |
| 662 EXPECT_EQ(30, coalescedevents[1].position().x()); | 674 EXPECT_EQ(30, coalescedevents[1].position().x()); |
| 663 EXPECT_EQ(40, coalescedevents[1].position().y()); | 675 EXPECT_EQ(40, coalescedevents[1].position().y()); |
| 664 EXPECT_EQ(100, coalescedevents[1].globalPosition().x()); | 676 EXPECT_EQ(100, coalescedevents[1].globalPosition().x()); |
| 665 EXPECT_EQ(140, coalescedevents[1].globalPosition().y()); | 677 EXPECT_EQ(140, coalescedevents[1].globalPosition().y()); |
| 666 EXPECT_EQ(20, coalescedevents[1].movementDelta().x()); | 678 EXPECT_EQ(20, coalescedevents[1].movementDelta().x()); |
| 667 EXPECT_EQ(10, coalescedevents[1].movementDelta().y()); | 679 EXPECT_EQ(10, coalescedevents[1].movementDelta().y()); |
| 668 } | 680 } |
| 669 | 681 |
| 670 { | 682 { |
| 671 WebGestureEvent webGestureEvent; | 683 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, |
| 672 webGestureEvent.type = WebInputEvent::GestureScrollUpdate; | 684 WebInputEvent::NoModifiers, |
| 685 WebInputEvent::TimeStampForTesting); |
| 673 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 686 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 674 webGestureEvent.x = 100; | 687 webGestureEvent.x = 100; |
| 675 webGestureEvent.y = 110; | 688 webGestureEvent.y = 110; |
| 676 webGestureEvent.globalX = 100; | 689 webGestureEvent.globalX = 100; |
| 677 webGestureEvent.globalY = 110; | 690 webGestureEvent.globalY = 110; |
| 678 webGestureEvent.data.scrollUpdate.deltaX = 60; | 691 webGestureEvent.data.scrollUpdate.deltaX = 60; |
| 679 webGestureEvent.data.scrollUpdate.deltaY = 60; | 692 webGestureEvent.data.scrollUpdate.deltaY = 60; |
| 680 | 693 |
| 681 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 694 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 682 EXPECT_EQ(30, platformGestureBuilder.position().x()); | 695 EXPECT_EQ(30, platformGestureBuilder.position().x()); |
| 683 EXPECT_EQ(30, platformGestureBuilder.position().y()); | 696 EXPECT_EQ(30, platformGestureBuilder.position().y()); |
| 684 EXPECT_EQ(100, platformGestureBuilder.globalPosition().x()); | 697 EXPECT_EQ(100, platformGestureBuilder.globalPosition().x()); |
| 685 EXPECT_EQ(110, platformGestureBuilder.globalPosition().y()); | 698 EXPECT_EQ(110, platformGestureBuilder.globalPosition().y()); |
| 686 EXPECT_EQ(20, platformGestureBuilder.deltaX()); | 699 EXPECT_EQ(20, platformGestureBuilder.deltaX()); |
| 687 EXPECT_EQ(20, platformGestureBuilder.deltaY()); | 700 EXPECT_EQ(20, platformGestureBuilder.deltaY()); |
| 688 } | 701 } |
| 689 | 702 |
| 690 { | 703 { |
| 691 WebGestureEvent webGestureEvent; | 704 WebGestureEvent webGestureEvent(WebInputEvent::GestureTap, |
| 692 webGestureEvent.type = WebInputEvent::GestureTap; | 705 WebInputEvent::NoModifiers, |
| 706 WebInputEvent::TimeStampForTesting); |
| 693 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 707 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 694 webGestureEvent.data.tap.width = 30; | 708 webGestureEvent.data.tap.width = 30; |
| 695 webGestureEvent.data.tap.height = 30; | 709 webGestureEvent.data.tap.height = 30; |
| 696 | 710 |
| 697 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 711 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 698 EXPECT_EQ(10, platformGestureBuilder.area().width()); | 712 EXPECT_EQ(10, platformGestureBuilder.area().width()); |
| 699 EXPECT_EQ(10, platformGestureBuilder.area().height()); | 713 EXPECT_EQ(10, platformGestureBuilder.area().height()); |
| 700 } | 714 } |
| 701 | 715 |
| 702 { | 716 { |
| 703 WebGestureEvent webGestureEvent; | 717 WebGestureEvent webGestureEvent(WebInputEvent::GestureTapUnconfirmed, |
| 704 webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed; | 718 WebInputEvent::NoModifiers, |
| 719 WebInputEvent::TimeStampForTesting); |
| 705 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 720 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 706 webGestureEvent.data.tap.width = 30; | 721 webGestureEvent.data.tap.width = 30; |
| 707 webGestureEvent.data.tap.height = 30; | 722 webGestureEvent.data.tap.height = 30; |
| 708 | 723 |
| 709 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 724 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 710 EXPECT_EQ(10, platformGestureBuilder.area().width()); | 725 EXPECT_EQ(10, platformGestureBuilder.area().width()); |
| 711 EXPECT_EQ(10, platformGestureBuilder.area().height()); | 726 EXPECT_EQ(10, platformGestureBuilder.area().height()); |
| 712 } | 727 } |
| 713 | 728 |
| 714 { | 729 { |
| 715 WebGestureEvent webGestureEvent; | 730 WebGestureEvent webGestureEvent(WebInputEvent::GestureTapDown, |
| 716 webGestureEvent.type = WebInputEvent::GestureTapDown; | 731 WebInputEvent::NoModifiers, |
| 732 WebInputEvent::TimeStampForTesting); |
| 717 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 733 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 718 webGestureEvent.data.tapDown.width = 30; | 734 webGestureEvent.data.tapDown.width = 30; |
| 719 webGestureEvent.data.tapDown.height = 30; | 735 webGestureEvent.data.tapDown.height = 30; |
| 720 | 736 |
| 721 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 737 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 722 EXPECT_EQ(10, platformGestureBuilder.area().width()); | 738 EXPECT_EQ(10, platformGestureBuilder.area().width()); |
| 723 EXPECT_EQ(10, platformGestureBuilder.area().height()); | 739 EXPECT_EQ(10, platformGestureBuilder.area().height()); |
| 724 } | 740 } |
| 725 | 741 |
| 726 { | 742 { |
| 727 WebGestureEvent webGestureEvent; | 743 WebGestureEvent webGestureEvent(WebInputEvent::GestureShowPress, |
| 728 webGestureEvent.type = WebInputEvent::GestureShowPress; | 744 WebInputEvent::NoModifiers, |
| 745 WebInputEvent::TimeStampForTesting); |
| 729 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 746 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 730 webGestureEvent.data.showPress.width = 30; | 747 webGestureEvent.data.showPress.width = 30; |
| 731 webGestureEvent.data.showPress.height = 30; | 748 webGestureEvent.data.showPress.height = 30; |
| 732 | 749 |
| 733 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 750 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 734 EXPECT_EQ(10, platformGestureBuilder.area().width()); | 751 EXPECT_EQ(10, platformGestureBuilder.area().width()); |
| 735 EXPECT_EQ(10, platformGestureBuilder.area().height()); | 752 EXPECT_EQ(10, platformGestureBuilder.area().height()); |
| 736 } | 753 } |
| 737 | 754 |
| 738 { | 755 { |
| 739 WebGestureEvent webGestureEvent; | 756 WebGestureEvent webGestureEvent(WebInputEvent::GestureLongPress, |
| 740 webGestureEvent.type = WebInputEvent::GestureLongPress; | 757 WebInputEvent::NoModifiers, |
| 758 WebInputEvent::TimeStampForTesting); |
| 741 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 759 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 742 webGestureEvent.data.longPress.width = 30; | 760 webGestureEvent.data.longPress.width = 30; |
| 743 webGestureEvent.data.longPress.height = 30; | 761 webGestureEvent.data.longPress.height = 30; |
| 744 | 762 |
| 745 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 763 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 746 EXPECT_EQ(10, platformGestureBuilder.area().width()); | 764 EXPECT_EQ(10, platformGestureBuilder.area().width()); |
| 747 EXPECT_EQ(10, platformGestureBuilder.area().height()); | 765 EXPECT_EQ(10, platformGestureBuilder.area().height()); |
| 748 } | 766 } |
| 749 | 767 |
| 750 { | 768 { |
| 751 WebGestureEvent webGestureEvent; | 769 WebGestureEvent webGestureEvent(WebInputEvent::GestureTwoFingerTap, |
| 752 webGestureEvent.type = WebInputEvent::GestureTwoFingerTap; | 770 WebInputEvent::NoModifiers, |
| 771 WebInputEvent::TimeStampForTesting); |
| 753 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 772 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 754 webGestureEvent.data.twoFingerTap.firstFingerWidth = 30; | 773 webGestureEvent.data.twoFingerTap.firstFingerWidth = 30; |
| 755 webGestureEvent.data.twoFingerTap.firstFingerHeight = 30; | 774 webGestureEvent.data.twoFingerTap.firstFingerHeight = 30; |
| 756 | 775 |
| 757 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 776 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 758 EXPECT_EQ(10, platformGestureBuilder.area().width()); | 777 EXPECT_EQ(10, platformGestureBuilder.area().width()); |
| 759 EXPECT_EQ(10, platformGestureBuilder.area().height()); | 778 EXPECT_EQ(10, platformGestureBuilder.area().height()); |
| 760 } | 779 } |
| 761 | 780 |
| 762 { | 781 { |
| 763 WebTouchEvent webTouchEvent; | 782 WebTouchEvent webTouchEvent(WebInputEvent::TouchMove, |
| 764 webTouchEvent.type = WebInputEvent::TouchMove; | 783 WebInputEvent::NoModifiers, |
| 784 WebInputEvent::TimeStampForTesting); |
| 765 webTouchEvent.touchesLength = 1; | 785 webTouchEvent.touchesLength = 1; |
| 766 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 786 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
| 767 webTouchEvent.touches[0].screenPosition.x = 100; | 787 webTouchEvent.touches[0].screenPosition.x = 100; |
| 768 webTouchEvent.touches[0].screenPosition.y = 110; | 788 webTouchEvent.touches[0].screenPosition.y = 110; |
| 769 webTouchEvent.touches[0].position.x = 100; | 789 webTouchEvent.touches[0].position.x = 100; |
| 770 webTouchEvent.touches[0].position.y = 110; | 790 webTouchEvent.touches[0].position.y = 110; |
| 771 webTouchEvent.touches[0].radiusX = 30; | 791 webTouchEvent.touches[0].radiusX = 30; |
| 772 webTouchEvent.touches[0].radiusY = 30; | 792 webTouchEvent.touches[0].radiusY = 30; |
| 773 | 793 |
| 774 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); | 794 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); |
| 775 EXPECT_FLOAT_EQ(100, platformTouchBuilder.touchPoints()[0].screenPos().x()); | 795 EXPECT_FLOAT_EQ(100, platformTouchBuilder.touchPoints()[0].screenPos().x()); |
| 776 EXPECT_FLOAT_EQ(110, platformTouchBuilder.touchPoints()[0].screenPos().y()); | 796 EXPECT_FLOAT_EQ(110, platformTouchBuilder.touchPoints()[0].screenPos().y()); |
| 777 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().x()); | 797 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().x()); |
| 778 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().y()); | 798 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().y()); |
| 779 EXPECT_FLOAT_EQ(10, platformTouchBuilder.touchPoints()[0].radius().width()); | 799 EXPECT_FLOAT_EQ(10, platformTouchBuilder.touchPoints()[0].radius().width()); |
| 780 EXPECT_FLOAT_EQ(10, | 800 EXPECT_FLOAT_EQ(10, |
| 781 platformTouchBuilder.touchPoints()[0].radius().height()); | 801 platformTouchBuilder.touchPoints()[0].radius().height()); |
| 782 } | 802 } |
| 783 | 803 |
| 784 { | 804 { |
| 785 WebTouchEvent webTouchEvent1; | 805 WebTouchEvent webTouchEvent1(WebInputEvent::TouchMove, |
| 786 webTouchEvent1.type = WebInputEvent::TouchMove; | 806 WebInputEvent::NoModifiers, |
| 807 WebInputEvent::TimeStampForTesting); |
| 787 webTouchEvent1.touchesLength = 1; | 808 webTouchEvent1.touchesLength = 1; |
| 788 webTouchEvent1.touches[0].state = WebTouchPoint::StateMoved; | 809 webTouchEvent1.touches[0].state = WebTouchPoint::StateMoved; |
| 789 webTouchEvent1.touches[0].screenPosition.x = 100; | 810 webTouchEvent1.touches[0].screenPosition.x = 100; |
| 790 webTouchEvent1.touches[0].screenPosition.y = 110; | 811 webTouchEvent1.touches[0].screenPosition.y = 110; |
| 791 webTouchEvent1.touches[0].position.x = 100; | 812 webTouchEvent1.touches[0].position.x = 100; |
| 792 webTouchEvent1.touches[0].position.y = 110; | 813 webTouchEvent1.touches[0].position.y = 110; |
| 793 webTouchEvent1.touches[0].radiusX = 30; | 814 webTouchEvent1.touches[0].radiusX = 30; |
| 794 webTouchEvent1.touches[0].radiusY = 30; | 815 webTouchEvent1.touches[0].radiusY = 30; |
| 795 | 816 |
| 796 WebTouchEvent webTouchEvent2 = webTouchEvent1; | 817 WebTouchEvent webTouchEvent2 = webTouchEvent1; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 858 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
| 838 webViewImpl->updateAllLifecyclePhases(); | 859 webViewImpl->updateAllLifecyclePhases(); |
| 839 | 860 |
| 840 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 861 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 841 Document* document = | 862 Document* document = |
| 842 toLocalFrame(webViewImpl->page()->mainFrame())->document(); | 863 toLocalFrame(webViewImpl->page()->mainFrame())->document(); |
| 843 LocalDOMWindow* domWindow = document->domWindow(); | 864 LocalDOMWindow* domWindow = document->domWindow(); |
| 844 LayoutViewItem documentLayoutView = document->layoutViewItem(); | 865 LayoutViewItem documentLayoutView = document->layoutViewItem(); |
| 845 | 866 |
| 846 { | 867 { |
| 847 WebGestureEvent webGestureEvent; | 868 WebGestureEvent webGestureEvent(WebInputEvent::GestureTap, |
| 848 webGestureEvent.type = WebInputEvent::GestureTap; | 869 WebInputEvent::NoModifiers, |
| 870 WebInputEvent::TimeStampForTesting); |
| 849 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 871 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 850 webGestureEvent.x = 10; | 872 webGestureEvent.x = 10; |
| 851 webGestureEvent.y = 10; | 873 webGestureEvent.y = 10; |
| 852 webGestureEvent.globalX = 10; | 874 webGestureEvent.globalX = 10; |
| 853 webGestureEvent.globalY = 10; | 875 webGestureEvent.globalY = 10; |
| 854 webGestureEvent.data.tap.tapCount = 1; | 876 webGestureEvent.data.tap.tapCount = 1; |
| 855 webGestureEvent.data.tap.width = 10; | 877 webGestureEvent.data.tap.width = 10; |
| 856 webGestureEvent.data.tap.height = 10; | 878 webGestureEvent.data.tap.height = 10; |
| 857 | 879 |
| 858 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 880 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 webViewImpl->updateAllLifecyclePhases(); | 914 webViewImpl->updateAllLifecyclePhases(); |
| 893 | 915 |
| 894 webViewImpl->setPageScaleFactor(2); | 916 webViewImpl->setPageScaleFactor(2); |
| 895 | 917 |
| 896 IntPoint visualOffset(35, 60); | 918 IntPoint visualOffset(35, 60); |
| 897 webViewImpl->page()->frameHost().visualViewport().setLocation(visualOffset); | 919 webViewImpl->page()->frameHost().visualViewport().setLocation(visualOffset); |
| 898 | 920 |
| 899 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 921 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 900 | 922 |
| 901 { | 923 { |
| 902 WebMouseEvent webMouseEvent; | 924 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
| 903 webMouseEvent.type = WebInputEvent::MouseMove; | 925 WebInputEvent::NoModifiers, |
| 926 WebInputEvent::TimeStampForTesting); |
| 904 webMouseEvent.x = 10; | 927 webMouseEvent.x = 10; |
| 905 webMouseEvent.y = 10; | 928 webMouseEvent.y = 10; |
| 906 webMouseEvent.windowX = 10; | 929 webMouseEvent.windowX = 10; |
| 907 webMouseEvent.windowY = 10; | 930 webMouseEvent.windowY = 10; |
| 908 webMouseEvent.globalX = 10; | 931 webMouseEvent.globalX = 10; |
| 909 webMouseEvent.globalY = 10; | 932 webMouseEvent.globalY = 10; |
| 910 | 933 |
| 911 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 934 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
| 912 EXPECT_EQ(5 + visualOffset.x(), platformMouseBuilder.position().x()); | 935 EXPECT_EQ(5 + visualOffset.x(), platformMouseBuilder.position().x()); |
| 913 EXPECT_EQ(5 + visualOffset.y(), platformMouseBuilder.position().y()); | 936 EXPECT_EQ(5 + visualOffset.y(), platformMouseBuilder.position().y()); |
| 914 EXPECT_EQ(10, platformMouseBuilder.globalPosition().x()); | 937 EXPECT_EQ(10, platformMouseBuilder.globalPosition().x()); |
| 915 EXPECT_EQ(10, platformMouseBuilder.globalPosition().y()); | 938 EXPECT_EQ(10, platformMouseBuilder.globalPosition().y()); |
| 916 } | 939 } |
| 917 | 940 |
| 918 { | 941 { |
| 919 WebMouseWheelEvent webMouseWheelEvent; | 942 WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel, |
| 920 webMouseWheelEvent.type = WebInputEvent::MouseWheel; | 943 WebInputEvent::NoModifiers, |
| 944 WebInputEvent::TimeStampForTesting); |
| 921 webMouseWheelEvent.x = 10; | 945 webMouseWheelEvent.x = 10; |
| 922 webMouseWheelEvent.y = 10; | 946 webMouseWheelEvent.y = 10; |
| 923 webMouseWheelEvent.windowX = 10; | 947 webMouseWheelEvent.windowX = 10; |
| 924 webMouseWheelEvent.windowY = 10; | 948 webMouseWheelEvent.windowY = 10; |
| 925 webMouseWheelEvent.globalX = 10; | 949 webMouseWheelEvent.globalX = 10; |
| 926 webMouseWheelEvent.globalY = 10; | 950 webMouseWheelEvent.globalY = 10; |
| 927 | 951 |
| 928 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); | 952 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); |
| 929 EXPECT_EQ(5 + visualOffset.x(), platformWheelBuilder.position().x()); | 953 EXPECT_EQ(5 + visualOffset.x(), platformWheelBuilder.position().x()); |
| 930 EXPECT_EQ(5 + visualOffset.y(), platformWheelBuilder.position().y()); | 954 EXPECT_EQ(5 + visualOffset.y(), platformWheelBuilder.position().y()); |
| 931 EXPECT_EQ(10, platformWheelBuilder.globalPosition().x()); | 955 EXPECT_EQ(10, platformWheelBuilder.globalPosition().x()); |
| 932 EXPECT_EQ(10, platformWheelBuilder.globalPosition().y()); | 956 EXPECT_EQ(10, platformWheelBuilder.globalPosition().y()); |
| 933 } | 957 } |
| 934 | 958 |
| 935 { | 959 { |
| 936 WebGestureEvent webGestureEvent; | 960 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, |
| 937 webGestureEvent.type = WebInputEvent::GestureScrollUpdate; | 961 WebInputEvent::NoModifiers, |
| 962 WebInputEvent::TimeStampForTesting); |
| 938 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 963 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 939 webGestureEvent.x = 10; | 964 webGestureEvent.x = 10; |
| 940 webGestureEvent.y = 10; | 965 webGestureEvent.y = 10; |
| 941 webGestureEvent.globalX = 10; | 966 webGestureEvent.globalX = 10; |
| 942 webGestureEvent.globalY = 10; | 967 webGestureEvent.globalY = 10; |
| 943 | 968 |
| 944 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 969 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 945 EXPECT_EQ(5 + visualOffset.x(), platformGestureBuilder.position().x()); | 970 EXPECT_EQ(5 + visualOffset.x(), platformGestureBuilder.position().x()); |
| 946 EXPECT_EQ(5 + visualOffset.y(), platformGestureBuilder.position().y()); | 971 EXPECT_EQ(5 + visualOffset.y(), platformGestureBuilder.position().y()); |
| 947 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); | 972 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
| 948 EXPECT_EQ(10, platformGestureBuilder.globalPosition().y()); | 973 EXPECT_EQ(10, platformGestureBuilder.globalPosition().y()); |
| 949 } | 974 } |
| 950 | 975 |
| 951 { | 976 { |
| 952 WebTouchEvent webTouchEvent; | 977 WebTouchEvent webTouchEvent(WebInputEvent::TouchMove, |
| 953 webTouchEvent.type = WebInputEvent::TouchMove; | 978 WebInputEvent::NoModifiers, |
| 979 WebInputEvent::TimeStampForTesting); |
| 954 webTouchEvent.touchesLength = 1; | 980 webTouchEvent.touchesLength = 1; |
| 955 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 981 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
| 956 webTouchEvent.touches[0].screenPosition.x = 10.6f; | 982 webTouchEvent.touches[0].screenPosition.x = 10.6f; |
| 957 webTouchEvent.touches[0].screenPosition.y = 10.4f; | 983 webTouchEvent.touches[0].screenPosition.y = 10.4f; |
| 958 webTouchEvent.touches[0].position.x = 10.6f; | 984 webTouchEvent.touches[0].position.x = 10.6f; |
| 959 webTouchEvent.touches[0].position.y = 10.4f; | 985 webTouchEvent.touches[0].position.y = 10.4f; |
| 960 | 986 |
| 961 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); | 987 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); |
| 962 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); | 988 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); |
| 963 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); | 989 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 991 webViewImpl->updateAllLifecyclePhases(); | 1017 webViewImpl->updateAllLifecyclePhases(); |
| 992 | 1018 |
| 993 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 1019 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 994 | 1020 |
| 995 FloatSize elasticOverscroll(10, -20); | 1021 FloatSize elasticOverscroll(10, -20); |
| 996 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 1022 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
| 997 elasticOverscroll, 1.0f, 0.0f); | 1023 elasticOverscroll, 1.0f, 0.0f); |
| 998 | 1024 |
| 999 // Just elastic overscroll. | 1025 // Just elastic overscroll. |
| 1000 { | 1026 { |
| 1001 WebMouseEvent webMouseEvent; | 1027 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
| 1002 webMouseEvent.type = WebInputEvent::MouseMove; | 1028 WebInputEvent::NoModifiers, |
| 1029 WebInputEvent::TimeStampForTesting); |
| 1003 webMouseEvent.x = 10; | 1030 webMouseEvent.x = 10; |
| 1004 webMouseEvent.y = 50; | 1031 webMouseEvent.y = 50; |
| 1005 webMouseEvent.windowX = 10; | 1032 webMouseEvent.windowX = 10; |
| 1006 webMouseEvent.windowY = 50; | 1033 webMouseEvent.windowY = 50; |
| 1007 webMouseEvent.globalX = 10; | 1034 webMouseEvent.globalX = 10; |
| 1008 webMouseEvent.globalY = 50; | 1035 webMouseEvent.globalY = 50; |
| 1009 | 1036 |
| 1010 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 1037 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
| 1011 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), | 1038 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), |
| 1012 platformMouseBuilder.position().x()); | 1039 platformMouseBuilder.position().x()); |
| 1013 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), | 1040 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), |
| 1014 platformMouseBuilder.position().y()); | 1041 platformMouseBuilder.position().y()); |
| 1015 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x()); | 1042 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x()); |
| 1016 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y()); | 1043 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y()); |
| 1017 } | 1044 } |
| 1018 | 1045 |
| 1019 // Elastic overscroll and pinch-zoom (this doesn't actually ever happen, | 1046 // Elastic overscroll and pinch-zoom (this doesn't actually ever happen, |
| 1020 // but ensure that if it were to, the overscroll would be applied after the | 1047 // but ensure that if it were to, the overscroll would be applied after the |
| 1021 // pinch-zoom). | 1048 // pinch-zoom). |
| 1022 float pageScale = 2; | 1049 float pageScale = 2; |
| 1023 webViewImpl->setPageScaleFactor(pageScale); | 1050 webViewImpl->setPageScaleFactor(pageScale); |
| 1024 IntPoint visualOffset(35, 60); | 1051 IntPoint visualOffset(35, 60); |
| 1025 webViewImpl->page()->frameHost().visualViewport().setLocation(visualOffset); | 1052 webViewImpl->page()->frameHost().visualViewport().setLocation(visualOffset); |
| 1026 { | 1053 { |
| 1027 WebMouseEvent webMouseEvent; | 1054 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
| 1028 webMouseEvent.type = WebInputEvent::MouseMove; | 1055 WebInputEvent::NoModifiers, |
| 1056 WebInputEvent::TimeStampForTesting); |
| 1029 webMouseEvent.x = 10; | 1057 webMouseEvent.x = 10; |
| 1030 webMouseEvent.y = 10; | 1058 webMouseEvent.y = 10; |
| 1031 webMouseEvent.windowX = 10; | 1059 webMouseEvent.windowX = 10; |
| 1032 webMouseEvent.windowY = 10; | 1060 webMouseEvent.windowY = 10; |
| 1033 webMouseEvent.globalX = 10; | 1061 webMouseEvent.globalX = 10; |
| 1034 webMouseEvent.globalY = 10; | 1062 webMouseEvent.globalY = 10; |
| 1035 | 1063 |
| 1036 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 1064 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
| 1037 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + | 1065 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + |
| 1038 elasticOverscroll.width(), | 1066 elasticOverscroll.width(), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1062 webViewImpl->updateAllLifecyclePhases(); | 1090 webViewImpl->updateAllLifecyclePhases(); |
| 1063 | 1091 |
| 1064 FloatSize elasticOverscroll(10, -20); | 1092 FloatSize elasticOverscroll(10, -20); |
| 1065 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 1093 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
| 1066 elasticOverscroll, 1.0f, 0.0f); | 1094 elasticOverscroll, 1.0f, 0.0f); |
| 1067 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); | 1095 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); |
| 1068 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 1096 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 1069 | 1097 |
| 1070 // Just elastic overscroll. | 1098 // Just elastic overscroll. |
| 1071 { | 1099 { |
| 1072 WebMouseEvent webMouseEvent; | 1100 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
| 1073 webMouseEvent.type = WebInputEvent::MouseMove; | 1101 WebInputEvent::NoModifiers, |
| 1102 WebInputEvent::TimeStampForTesting); |
| 1074 webMouseEvent.x = 10; | 1103 webMouseEvent.x = 10; |
| 1075 webMouseEvent.y = 50; | 1104 webMouseEvent.y = 50; |
| 1076 webMouseEvent.windowX = 10; | 1105 webMouseEvent.windowX = 10; |
| 1077 webMouseEvent.windowY = 50; | 1106 webMouseEvent.windowY = 50; |
| 1078 webMouseEvent.globalX = 10; | 1107 webMouseEvent.globalX = 10; |
| 1079 webMouseEvent.globalY = 50; | 1108 webMouseEvent.globalY = 50; |
| 1080 | 1109 |
| 1081 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 1110 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
| 1082 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), | 1111 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), |
| 1083 platformMouseBuilder.position().x()); | 1112 platformMouseBuilder.position().x()); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 WebViewImpl* webViewImpl = | 1197 WebViewImpl* webViewImpl = |
| 1169 webViewHelper.initializeAndLoad(baseURL + fileName, true); | 1198 webViewHelper.initializeAndLoad(baseURL + fileName, true); |
| 1170 int pageWidth = 640; | 1199 int pageWidth = 640; |
| 1171 int pageHeight = 480; | 1200 int pageHeight = 480; |
| 1172 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 1201 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
| 1173 webViewImpl->updateAllLifecyclePhases(); | 1202 webViewImpl->updateAllLifecyclePhases(); |
| 1174 | 1203 |
| 1175 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 1204 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 1176 | 1205 |
| 1177 { | 1206 { |
| 1178 WebMouseWheelEvent webMouseWheelEvent; | 1207 WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel, |
| 1179 webMouseWheelEvent.type = WebInputEvent::MouseWheel; | 1208 WebInputEvent::ControlKey, |
| 1209 WebInputEvent::TimeStampForTesting); |
| 1180 webMouseWheelEvent.x = 0; | 1210 webMouseWheelEvent.x = 0; |
| 1181 webMouseWheelEvent.y = 5; | 1211 webMouseWheelEvent.y = 5; |
| 1182 webMouseWheelEvent.deltaX = 10; | 1212 webMouseWheelEvent.deltaX = 10; |
| 1183 webMouseWheelEvent.deltaY = 15; | 1213 webMouseWheelEvent.deltaY = 15; |
| 1184 webMouseWheelEvent.modifiers = WebInputEvent::ControlKey; | |
| 1185 webMouseWheelEvent.hasPreciseScrollingDeltas = true; | 1214 webMouseWheelEvent.hasPreciseScrollingDeltas = true; |
| 1186 webMouseWheelEvent.railsMode = WebInputEvent::RailsModeHorizontal; | 1215 webMouseWheelEvent.railsMode = WebInputEvent::RailsModeHorizontal; |
| 1187 webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseBegan; | 1216 webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseBegan; |
| 1188 webMouseWheelEvent.momentumPhase = WebMouseWheelEvent::PhaseChanged; | 1217 webMouseWheelEvent.momentumPhase = WebMouseWheelEvent::PhaseChanged; |
| 1189 | 1218 |
| 1190 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); | 1219 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); |
| 1191 EXPECT_EQ(0, platformWheelBuilder.position().x()); | 1220 EXPECT_EQ(0, platformWheelBuilder.position().x()); |
| 1192 EXPECT_EQ(5, platformWheelBuilder.position().y()); | 1221 EXPECT_EQ(5, platformWheelBuilder.position().y()); |
| 1193 EXPECT_EQ(10, platformWheelBuilder.deltaX()); | 1222 EXPECT_EQ(10, platformWheelBuilder.deltaX()); |
| 1194 EXPECT_EQ(15, platformWheelBuilder.deltaY()); | 1223 EXPECT_EQ(15, platformWheelBuilder.deltaY()); |
| 1195 EXPECT_EQ(PlatformEvent::CtrlKey, platformWheelBuilder.getModifiers()); | 1224 EXPECT_EQ(PlatformEvent::CtrlKey, platformWheelBuilder.getModifiers()); |
| 1196 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 1225 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
| 1197 EXPECT_EQ(platformWheelBuilder.getRailsMode(), | 1226 EXPECT_EQ(platformWheelBuilder.getRailsMode(), |
| 1198 PlatformEvent::RailsModeHorizontal); | 1227 PlatformEvent::RailsModeHorizontal); |
| 1199 #if OS(MACOSX) | 1228 #if OS(MACOSX) |
| 1200 EXPECT_EQ(PlatformWheelEventPhaseBegan, platformWheelBuilder.phase()); | 1229 EXPECT_EQ(PlatformWheelEventPhaseBegan, platformWheelBuilder.phase()); |
| 1201 EXPECT_EQ(PlatformWheelEventPhaseChanged, | 1230 EXPECT_EQ(PlatformWheelEventPhaseChanged, |
| 1202 platformWheelBuilder.momentumPhase()); | 1231 platformWheelBuilder.momentumPhase()); |
| 1203 #endif | 1232 #endif |
| 1204 } | 1233 } |
| 1205 | 1234 |
| 1206 { | 1235 { |
| 1207 WebMouseWheelEvent webMouseWheelEvent; | 1236 WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel, |
| 1208 webMouseWheelEvent.type = WebInputEvent::MouseWheel; | 1237 WebInputEvent::ShiftKey, |
| 1238 WebInputEvent::TimeStampForTesting); |
| 1209 webMouseWheelEvent.x = 5; | 1239 webMouseWheelEvent.x = 5; |
| 1210 webMouseWheelEvent.y = 0; | 1240 webMouseWheelEvent.y = 0; |
| 1211 webMouseWheelEvent.deltaX = 15; | 1241 webMouseWheelEvent.deltaX = 15; |
| 1212 webMouseWheelEvent.deltaY = 10; | 1242 webMouseWheelEvent.deltaY = 10; |
| 1213 webMouseWheelEvent.modifiers = WebInputEvent::ShiftKey; | |
| 1214 webMouseWheelEvent.hasPreciseScrollingDeltas = false; | 1243 webMouseWheelEvent.hasPreciseScrollingDeltas = false; |
| 1215 webMouseWheelEvent.railsMode = WebInputEvent::RailsModeFree; | 1244 webMouseWheelEvent.railsMode = WebInputEvent::RailsModeFree; |
| 1216 webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseNone; | 1245 webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseNone; |
| 1217 webMouseWheelEvent.momentumPhase = WebMouseWheelEvent::PhaseNone; | 1246 webMouseWheelEvent.momentumPhase = WebMouseWheelEvent::PhaseNone; |
| 1218 | 1247 |
| 1219 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); | 1248 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); |
| 1220 EXPECT_EQ(5, platformWheelBuilder.position().x()); | 1249 EXPECT_EQ(5, platformWheelBuilder.position().x()); |
| 1221 EXPECT_EQ(0, platformWheelBuilder.position().y()); | 1250 EXPECT_EQ(0, platformWheelBuilder.position().y()); |
| 1222 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 1251 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
| 1223 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 1252 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
| 1224 EXPECT_EQ(PlatformEvent::ShiftKey, platformWheelBuilder.getModifiers()); | 1253 EXPECT_EQ(PlatformEvent::ShiftKey, platformWheelBuilder.getModifiers()); |
| 1225 EXPECT_FALSE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 1254 EXPECT_FALSE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
| 1226 EXPECT_EQ(platformWheelBuilder.getRailsMode(), | 1255 EXPECT_EQ(platformWheelBuilder.getRailsMode(), |
| 1227 PlatformEvent::RailsModeFree); | 1256 PlatformEvent::RailsModeFree); |
| 1228 #if OS(MACOSX) | 1257 #if OS(MACOSX) |
| 1229 EXPECT_EQ(PlatformWheelEventPhaseNone, platformWheelBuilder.phase()); | 1258 EXPECT_EQ(PlatformWheelEventPhaseNone, platformWheelBuilder.phase()); |
| 1230 EXPECT_EQ(PlatformWheelEventPhaseNone, | 1259 EXPECT_EQ(PlatformWheelEventPhaseNone, |
| 1231 platformWheelBuilder.momentumPhase()); | 1260 platformWheelBuilder.momentumPhase()); |
| 1232 #endif | 1261 #endif |
| 1233 } | 1262 } |
| 1234 | 1263 |
| 1235 { | 1264 { |
| 1236 WebMouseWheelEvent webMouseWheelEvent; | 1265 WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel, |
| 1237 webMouseWheelEvent.type = WebInputEvent::MouseWheel; | 1266 WebInputEvent::AltKey, |
| 1267 WebInputEvent::TimeStampForTesting); |
| 1238 webMouseWheelEvent.x = 5; | 1268 webMouseWheelEvent.x = 5; |
| 1239 webMouseWheelEvent.y = 0; | 1269 webMouseWheelEvent.y = 0; |
| 1240 webMouseWheelEvent.deltaX = 15; | 1270 webMouseWheelEvent.deltaX = 15; |
| 1241 webMouseWheelEvent.deltaY = 10; | 1271 webMouseWheelEvent.deltaY = 10; |
| 1242 webMouseWheelEvent.modifiers = WebInputEvent::AltKey; | |
| 1243 webMouseWheelEvent.hasPreciseScrollingDeltas = true; | 1272 webMouseWheelEvent.hasPreciseScrollingDeltas = true; |
| 1244 webMouseWheelEvent.railsMode = WebInputEvent::RailsModeVertical; | 1273 webMouseWheelEvent.railsMode = WebInputEvent::RailsModeVertical; |
| 1245 webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseNone; | 1274 webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseNone; |
| 1246 webMouseWheelEvent.momentumPhase = WebMouseWheelEvent::PhaseNone; | 1275 webMouseWheelEvent.momentumPhase = WebMouseWheelEvent::PhaseNone; |
| 1247 | 1276 |
| 1248 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); | 1277 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent); |
| 1249 EXPECT_EQ(5, platformWheelBuilder.position().x()); | 1278 EXPECT_EQ(5, platformWheelBuilder.position().x()); |
| 1250 EXPECT_EQ(0, platformWheelBuilder.position().y()); | 1279 EXPECT_EQ(0, platformWheelBuilder.position().y()); |
| 1251 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 1280 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
| 1252 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 1281 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1273 WebViewImpl* webViewImpl = | 1302 WebViewImpl* webViewImpl = |
| 1274 webViewHelper.initializeAndLoad(baseURL + fileName, true); | 1303 webViewHelper.initializeAndLoad(baseURL + fileName, true); |
| 1275 int pageWidth = 640; | 1304 int pageWidth = 640; |
| 1276 int pageHeight = 480; | 1305 int pageHeight = 480; |
| 1277 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 1306 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
| 1278 webViewImpl->updateAllLifecyclePhases(); | 1307 webViewImpl->updateAllLifecyclePhases(); |
| 1279 | 1308 |
| 1280 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 1309 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 1281 | 1310 |
| 1282 { | 1311 { |
| 1283 WebGestureEvent webGestureEvent; | 1312 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollBegin, |
| 1284 webGestureEvent.type = WebInputEvent::GestureScrollBegin; | 1313 WebInputEvent::NoModifiers, |
| 1314 WebInputEvent::TimeStampForTesting); |
| 1285 webGestureEvent.x = 0; | 1315 webGestureEvent.x = 0; |
| 1286 webGestureEvent.y = 5; | 1316 webGestureEvent.y = 5; |
| 1287 webGestureEvent.globalX = 10; | 1317 webGestureEvent.globalX = 10; |
| 1288 webGestureEvent.globalY = 15; | 1318 webGestureEvent.globalY = 15; |
| 1289 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; | 1319 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 1290 webGestureEvent.resendingPluginId = 2; | 1320 webGestureEvent.resendingPluginId = 2; |
| 1291 webGestureEvent.data.scrollBegin.inertialPhase = | 1321 webGestureEvent.data.scrollBegin.inertialPhase = |
| 1292 WebGestureEvent::MomentumPhase; | 1322 WebGestureEvent::MomentumPhase; |
| 1293 webGestureEvent.data.scrollBegin.synthetic = true; | 1323 webGestureEvent.data.scrollBegin.synthetic = true; |
| 1294 webGestureEvent.data.scrollBegin.deltaXHint = 100; | 1324 webGestureEvent.data.scrollBegin.deltaXHint = 100; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1307 platformGestureBuilder.inertialPhase()); | 1337 platformGestureBuilder.inertialPhase()); |
| 1308 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1338 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
| 1309 EXPECT_EQ(100, platformGestureBuilder.deltaX()); | 1339 EXPECT_EQ(100, platformGestureBuilder.deltaX()); |
| 1310 EXPECT_EQ(10, platformGestureBuilder.deltaY()); | 1340 EXPECT_EQ(10, platformGestureBuilder.deltaY()); |
| 1311 EXPECT_EQ(ScrollGranularity::ScrollByPixel, | 1341 EXPECT_EQ(ScrollGranularity::ScrollByPixel, |
| 1312 platformGestureBuilder.deltaUnits()); | 1342 platformGestureBuilder.deltaUnits()); |
| 1313 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); | 1343 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); |
| 1314 } | 1344 } |
| 1315 | 1345 |
| 1316 { | 1346 { |
| 1317 WebGestureEvent webGestureEvent; | 1347 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollEnd, |
| 1318 webGestureEvent.type = WebInputEvent::GestureScrollEnd; | 1348 WebInputEvent::NoModifiers, |
| 1349 WebInputEvent::TimeStampForTesting); |
| 1319 webGestureEvent.x = 0; | 1350 webGestureEvent.x = 0; |
| 1320 webGestureEvent.y = 5; | 1351 webGestureEvent.y = 5; |
| 1321 webGestureEvent.globalX = 10; | 1352 webGestureEvent.globalX = 10; |
| 1322 webGestureEvent.globalY = 15; | 1353 webGestureEvent.globalY = 15; |
| 1323 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; | 1354 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 1324 webGestureEvent.resendingPluginId = 2; | 1355 webGestureEvent.resendingPluginId = 2; |
| 1325 webGestureEvent.data.scrollEnd.inertialPhase = | 1356 webGestureEvent.data.scrollEnd.inertialPhase = |
| 1326 WebGestureEvent::NonMomentumPhase; | 1357 WebGestureEvent::NonMomentumPhase; |
| 1327 webGestureEvent.data.scrollEnd.synthetic = true; | 1358 webGestureEvent.data.scrollEnd.synthetic = true; |
| 1328 webGestureEvent.data.scrollEnd.deltaUnits = WebGestureEvent::Page; | 1359 webGestureEvent.data.scrollEnd.deltaUnits = WebGestureEvent::Page; |
| 1329 webGestureEvent.uniqueTouchEventId = 12345U; | 1360 webGestureEvent.uniqueTouchEventId = 12345U; |
| 1330 | 1361 |
| 1331 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); | 1362 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent); |
| 1332 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()); | 1363 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()); |
| 1333 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); | 1364 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); |
| 1334 EXPECT_EQ(0, platformGestureBuilder.position().x()); | 1365 EXPECT_EQ(0, platformGestureBuilder.position().x()); |
| 1335 EXPECT_EQ(5, platformGestureBuilder.position().y()); | 1366 EXPECT_EQ(5, platformGestureBuilder.position().y()); |
| 1336 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); | 1367 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
| 1337 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); | 1368 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
| 1338 EXPECT_EQ(ScrollInertialPhaseNonMomentum, | 1369 EXPECT_EQ(ScrollInertialPhaseNonMomentum, |
| 1339 platformGestureBuilder.inertialPhase()); | 1370 platformGestureBuilder.inertialPhase()); |
| 1340 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1371 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
| 1341 EXPECT_EQ(ScrollGranularity::ScrollByPage, | 1372 EXPECT_EQ(ScrollGranularity::ScrollByPage, |
| 1342 platformGestureBuilder.deltaUnits()); | 1373 platformGestureBuilder.deltaUnits()); |
| 1343 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); | 1374 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); |
| 1344 } | 1375 } |
| 1345 } | 1376 } |
| 1346 | 1377 |
| 1347 } // namespace blink | 1378 } // namespace blink |
| OLD | NEW |