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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 webViewImpl->updateAllLifecyclePhases(); | 128 webViewImpl->updateAllLifecyclePhases(); |
129 | 129 |
130 webViewImpl->setPageScaleFactor(2); | 130 webViewImpl->setPageScaleFactor(2); |
131 | 131 |
132 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 132 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
133 | 133 |
134 { | 134 { |
135 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, | 135 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
136 WebInputEvent::NoModifiers, | 136 WebInputEvent::NoModifiers, |
137 WebInputEvent::TimeStampForTesting); | 137 WebInputEvent::TimeStampForTesting); |
138 webMouseEvent.x = 10; | 138 webMouseEvent.position.x = 10; |
139 webMouseEvent.y = 10; | 139 webMouseEvent.position.y = 10; |
140 webMouseEvent.globalX = 10; | 140 webMouseEvent.screenPosition.x = 10; |
141 webMouseEvent.globalY = 10; | 141 webMouseEvent.screenPosition.y = 10; |
142 webMouseEvent.movementX = 10; | 142 webMouseEvent.movementX = 10; |
143 webMouseEvent.movementY = 10; | 143 webMouseEvent.movementY = 10; |
144 | 144 |
145 WebMouseEvent transformedEvent = | 145 WebMouseEvent transformedEvent = |
146 TransformWebMouseEvent(view, webMouseEvent); | 146 TransformWebMouseEvent(view, webMouseEvent); |
147 IntPoint position = flooredIntPoint(transformedEvent.positionInRootFrame()); | 147 IntPoint position = flooredIntPoint(transformedEvent.positionInRootFrame()); |
148 EXPECT_EQ(5, position.x()); | 148 EXPECT_EQ(5, position.x()); |
149 EXPECT_EQ(5, position.y()); | 149 EXPECT_EQ(5, position.y()); |
150 EXPECT_EQ(10, transformedEvent.globalX); | 150 EXPECT_EQ(10, transformedEvent.screenPosition.x); |
151 EXPECT_EQ(10, transformedEvent.globalY); | 151 EXPECT_EQ(10, transformedEvent.screenPosition.y); |
152 | 152 |
153 IntPoint movement = flooredIntPoint(transformedEvent.movementInRootFrame()); | 153 IntPoint movement = flooredIntPoint(transformedEvent.movementInRootFrame()); |
154 EXPECT_EQ(5, movement.x()); | 154 EXPECT_EQ(5, movement.x()); |
155 EXPECT_EQ(5, movement.y()); | 155 EXPECT_EQ(5, movement.y()); |
156 } | 156 } |
157 | 157 |
158 { | 158 { |
159 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, | 159 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, |
160 WebInputEvent::NoModifiers, | 160 WebInputEvent::NoModifiers, |
161 WebInputEvent::TimeStampForTesting); | 161 WebInputEvent::TimeStampForTesting); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 webViewImpl->setPageScaleFactor(2); | 358 webViewImpl->setPageScaleFactor(2); |
359 webViewImpl->mainFrameImpl()->setInputEventsTransformForEmulation( | 359 webViewImpl->mainFrameImpl()->setInputEventsTransformForEmulation( |
360 IntSize(10, 20), 1.5); | 360 IntSize(10, 20), 1.5); |
361 | 361 |
362 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 362 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
363 | 363 |
364 { | 364 { |
365 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, | 365 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
366 WebInputEvent::NoModifiers, | 366 WebInputEvent::NoModifiers, |
367 WebInputEvent::TimeStampForTesting); | 367 WebInputEvent::TimeStampForTesting); |
368 webMouseEvent.x = 100; | 368 webMouseEvent.position.x = 100; |
369 webMouseEvent.y = 110; | 369 webMouseEvent.position.y = 110; |
370 webMouseEvent.globalX = 100; | 370 webMouseEvent.screenPosition.x = 100; |
371 webMouseEvent.globalY = 110; | 371 webMouseEvent.screenPosition.y = 110; |
372 webMouseEvent.movementX = 60; | 372 webMouseEvent.movementX = 60; |
373 webMouseEvent.movementY = 60; | 373 webMouseEvent.movementY = 60; |
374 | 374 |
375 WebMouseEvent transformedEvent = | 375 WebMouseEvent transformedEvent = |
376 TransformWebMouseEvent(view, webMouseEvent); | 376 TransformWebMouseEvent(view, webMouseEvent); |
377 FloatPoint position = transformedEvent.positionInRootFrame(); | 377 FloatPoint position = transformedEvent.positionInRootFrame(); |
378 | 378 |
379 EXPECT_FLOAT_EQ(30, position.x()); | 379 EXPECT_FLOAT_EQ(30, position.x()); |
380 EXPECT_FLOAT_EQ(30, position.y()); | 380 EXPECT_FLOAT_EQ(30, position.y()); |
381 EXPECT_EQ(100, transformedEvent.globalX); | 381 EXPECT_EQ(100, transformedEvent.screenPosition.x); |
382 EXPECT_EQ(110, transformedEvent.globalY); | 382 EXPECT_EQ(110, transformedEvent.screenPosition.y); |
383 | 383 |
384 IntPoint movement = flooredIntPoint(transformedEvent.movementInRootFrame()); | 384 IntPoint movement = flooredIntPoint(transformedEvent.movementInRootFrame()); |
385 EXPECT_EQ(20, movement.x()); | 385 EXPECT_EQ(20, movement.x()); |
386 EXPECT_EQ(20, movement.y()); | 386 EXPECT_EQ(20, movement.y()); |
387 } | 387 } |
388 | 388 |
389 { | 389 { |
390 WebMouseEvent webMouseEvent1(WebInputEvent::MouseMove, | 390 WebMouseEvent webMouseEvent1(WebInputEvent::MouseMove, |
391 WebInputEvent::NoModifiers, | 391 WebInputEvent::NoModifiers, |
392 WebInputEvent::TimeStampForTesting); | 392 WebInputEvent::TimeStampForTesting); |
393 webMouseEvent1.x = 100; | 393 webMouseEvent1.position.x = 100; |
394 webMouseEvent1.y = 110; | 394 webMouseEvent1.position.y = 110; |
395 webMouseEvent1.globalX = 100; | 395 webMouseEvent1.screenPosition.x = 100; |
396 webMouseEvent1.globalY = 110; | 396 webMouseEvent1.screenPosition.y = 110; |
397 webMouseEvent1.movementX = 60; | 397 webMouseEvent1.movementX = 60; |
398 webMouseEvent1.movementY = 60; | 398 webMouseEvent1.movementY = 60; |
399 | 399 |
400 WebMouseEvent webMouseEvent2 = webMouseEvent1; | 400 WebMouseEvent webMouseEvent2 = webMouseEvent1; |
401 webMouseEvent2.y = 140; | 401 webMouseEvent2.position.y = 140; |
402 webMouseEvent2.globalY = 140; | 402 webMouseEvent2.screenPosition.y = 140; |
403 webMouseEvent2.movementY = 30; | 403 webMouseEvent2.movementY = 30; |
404 | 404 |
405 std::vector<const WebInputEvent*> events; | 405 std::vector<const WebInputEvent*> events; |
406 events.push_back(&webMouseEvent1); | 406 events.push_back(&webMouseEvent1); |
407 events.push_back(&webMouseEvent2); | 407 events.push_back(&webMouseEvent2); |
408 | 408 |
409 Vector<WebMouseEvent> coalescedevents = | 409 Vector<WebMouseEvent> coalescedevents = |
410 TransformWebMouseEventVector(view, events); | 410 TransformWebMouseEventVector(view, events); |
411 EXPECT_EQ(events.size(), coalescedevents.size()); | 411 EXPECT_EQ(events.size(), coalescedevents.size()); |
412 | 412 |
413 FloatPoint position = coalescedevents[0].positionInRootFrame(); | 413 FloatPoint position = coalescedevents[0].positionInRootFrame(); |
414 EXPECT_FLOAT_EQ(30, position.x()); | 414 EXPECT_FLOAT_EQ(30, position.x()); |
415 EXPECT_FLOAT_EQ(30, position.y()); | 415 EXPECT_FLOAT_EQ(30, position.y()); |
416 EXPECT_EQ(100, coalescedevents[0].globalX); | 416 EXPECT_EQ(100, coalescedevents[0].screenPosition.x); |
417 EXPECT_EQ(110, coalescedevents[0].globalY); | 417 EXPECT_EQ(110, coalescedevents[0].screenPosition.y); |
418 | 418 |
419 IntPoint movement = | 419 IntPoint movement = |
420 flooredIntPoint(coalescedevents[0].movementInRootFrame()); | 420 flooredIntPoint(coalescedevents[0].movementInRootFrame()); |
421 EXPECT_EQ(20, movement.x()); | 421 EXPECT_EQ(20, movement.x()); |
422 EXPECT_EQ(20, movement.y()); | 422 EXPECT_EQ(20, movement.y()); |
423 | 423 |
424 position = coalescedevents[1].positionInRootFrame(); | 424 position = coalescedevents[1].positionInRootFrame(); |
425 EXPECT_FLOAT_EQ(30, position.x()); | 425 EXPECT_FLOAT_EQ(30, position.x()); |
426 EXPECT_FLOAT_EQ(40, position.y()); | 426 EXPECT_FLOAT_EQ(40, position.y()); |
427 EXPECT_EQ(100, coalescedevents[1].globalX); | 427 EXPECT_EQ(100, coalescedevents[1].screenPosition.x); |
428 EXPECT_EQ(140, coalescedevents[1].globalY); | 428 EXPECT_EQ(140, coalescedevents[1].screenPosition.y); |
429 | 429 |
430 movement = flooredIntPoint(coalescedevents[1].movementInRootFrame()); | 430 movement = flooredIntPoint(coalescedevents[1].movementInRootFrame()); |
431 EXPECT_EQ(20, movement.x()); | 431 EXPECT_EQ(20, movement.x()); |
432 EXPECT_EQ(10, movement.y()); | 432 EXPECT_EQ(10, movement.y()); |
433 } | 433 } |
434 | 434 |
435 { | 435 { |
436 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, | 436 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, |
437 WebInputEvent::NoModifiers, | 437 WebInputEvent::NoModifiers, |
438 WebInputEvent::TimeStampForTesting); | 438 WebInputEvent::TimeStampForTesting); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 672 |
673 IntPoint visualOffset(35, 60); | 673 IntPoint visualOffset(35, 60); |
674 webViewImpl->page()->visualViewport().setLocation(visualOffset); | 674 webViewImpl->page()->visualViewport().setLocation(visualOffset); |
675 | 675 |
676 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 676 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
677 | 677 |
678 { | 678 { |
679 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, | 679 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
680 WebInputEvent::NoModifiers, | 680 WebInputEvent::NoModifiers, |
681 WebInputEvent::TimeStampForTesting); | 681 WebInputEvent::TimeStampForTesting); |
682 webMouseEvent.x = 10; | 682 webMouseEvent.position.x = 10; |
683 webMouseEvent.y = 10; | 683 webMouseEvent.position.y = 10; |
684 webMouseEvent.globalX = 10; | 684 webMouseEvent.screenPosition.x = 10; |
685 webMouseEvent.globalY = 10; | 685 webMouseEvent.screenPosition.y = 10; |
686 | 686 |
687 WebMouseEvent transformedMouseEvent = | 687 WebMouseEvent transformedMouseEvent = |
688 TransformWebMouseEvent(view, webMouseEvent); | 688 TransformWebMouseEvent(view, webMouseEvent); |
689 IntPoint position = | 689 IntPoint position = |
690 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); | 690 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); |
691 EXPECT_EQ(5 + visualOffset.x(), position.x()); | 691 EXPECT_EQ(5 + visualOffset.x(), position.x()); |
692 EXPECT_EQ(5 + visualOffset.y(), position.y()); | 692 EXPECT_EQ(5 + visualOffset.y(), position.y()); |
693 EXPECT_EQ(10, transformedMouseEvent.globalX); | 693 EXPECT_EQ(10, transformedMouseEvent.screenPosition.x); |
694 EXPECT_EQ(10, transformedMouseEvent.globalY); | 694 EXPECT_EQ(10, transformedMouseEvent.screenPosition.y); |
695 } | 695 } |
696 | 696 |
697 { | 697 { |
698 WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel, | 698 WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel, |
699 WebInputEvent::NoModifiers, | 699 WebInputEvent::NoModifiers, |
700 WebInputEvent::TimeStampForTesting); | 700 WebInputEvent::TimeStampForTesting); |
701 webMouseWheelEvent.x = 10; | 701 webMouseWheelEvent.position.x = 10; |
702 webMouseWheelEvent.y = 10; | 702 webMouseWheelEvent.position.y = 10; |
703 webMouseWheelEvent.globalX = 10; | 703 webMouseWheelEvent.screenPosition.x = 10; |
704 webMouseWheelEvent.globalY = 10; | 704 webMouseWheelEvent.screenPosition.y = 10; |
705 | 705 |
706 WebMouseWheelEvent scaledMouseWheelEvent = | 706 WebMouseWheelEvent scaledMouseWheelEvent = |
707 TransformWebMouseWheelEvent(view, webMouseWheelEvent); | 707 TransformWebMouseWheelEvent(view, webMouseWheelEvent); |
708 IntPoint position = | 708 IntPoint position = |
709 flooredIntPoint(scaledMouseWheelEvent.positionInRootFrame()); | 709 flooredIntPoint(scaledMouseWheelEvent.positionInRootFrame()); |
710 EXPECT_EQ(5 + visualOffset.x(), position.x()); | 710 EXPECT_EQ(5 + visualOffset.x(), position.x()); |
711 EXPECT_EQ(5 + visualOffset.y(), position.y()); | 711 EXPECT_EQ(5 + visualOffset.y(), position.y()); |
712 EXPECT_EQ(10, scaledMouseWheelEvent.globalX); | 712 EXPECT_EQ(10, scaledMouseWheelEvent.screenPosition.x); |
713 EXPECT_EQ(10, scaledMouseWheelEvent.globalY); | 713 EXPECT_EQ(10, scaledMouseWheelEvent.screenPosition.y); |
714 } | 714 } |
715 | 715 |
716 { | 716 { |
717 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, | 717 WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate, |
718 WebInputEvent::NoModifiers, | 718 WebInputEvent::NoModifiers, |
719 WebInputEvent::TimeStampForTesting); | 719 WebInputEvent::TimeStampForTesting); |
720 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 720 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
721 webGestureEvent.x = 10; | 721 webGestureEvent.x = 10; |
722 webGestureEvent.y = 10; | 722 webGestureEvent.y = 10; |
723 webGestureEvent.globalX = 10; | 723 webGestureEvent.globalX = 10; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 777 |
778 FloatSize elasticOverscroll(10, -20); | 778 FloatSize elasticOverscroll(10, -20); |
779 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 779 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
780 elasticOverscroll, 1.0f, 0.0f); | 780 elasticOverscroll, 1.0f, 0.0f); |
781 | 781 |
782 // Just elastic overscroll. | 782 // Just elastic overscroll. |
783 { | 783 { |
784 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, | 784 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
785 WebInputEvent::NoModifiers, | 785 WebInputEvent::NoModifiers, |
786 WebInputEvent::TimeStampForTesting); | 786 WebInputEvent::TimeStampForTesting); |
787 webMouseEvent.x = 10; | 787 webMouseEvent.position.x = 10; |
788 webMouseEvent.y = 50; | 788 webMouseEvent.position.y = 50; |
789 webMouseEvent.globalX = 10; | 789 webMouseEvent.screenPosition.x = 10; |
790 webMouseEvent.globalY = 50; | 790 webMouseEvent.screenPosition.y = 50; |
791 | 791 |
792 WebMouseEvent transformedMouseEvent = | 792 WebMouseEvent transformedMouseEvent = |
793 TransformWebMouseEvent(view, webMouseEvent); | 793 TransformWebMouseEvent(view, webMouseEvent); |
794 IntPoint position = | 794 IntPoint position = |
795 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); | 795 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); |
796 | 796 |
797 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), position.x()); | 797 EXPECT_EQ(webMouseEvent.position.x + elasticOverscroll.width(), |
798 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), position.y()); | 798 position.x()); |
799 EXPECT_EQ(webMouseEvent.globalX, transformedMouseEvent.globalX); | 799 EXPECT_EQ(webMouseEvent.position.y + elasticOverscroll.height(), |
800 EXPECT_EQ(webMouseEvent.globalY, transformedMouseEvent.globalY); | 800 position.y()); |
| 801 EXPECT_EQ(webMouseEvent.screenPosition.x, |
| 802 transformedMouseEvent.screenPosition.x); |
| 803 EXPECT_EQ(webMouseEvent.screenPosition.y, |
| 804 transformedMouseEvent.screenPosition.y); |
801 } | 805 } |
802 | 806 |
803 // Elastic overscroll and pinch-zoom (this doesn't actually ever happen, | 807 // Elastic overscroll and pinch-zoom (this doesn't actually ever happen, |
804 // but ensure that if it were to, the overscroll would be applied after the | 808 // but ensure that if it were to, the overscroll would be applied after the |
805 // pinch-zoom). | 809 // pinch-zoom). |
806 float pageScale = 2; | 810 float pageScale = 2; |
807 webViewImpl->setPageScaleFactor(pageScale); | 811 webViewImpl->setPageScaleFactor(pageScale); |
808 IntPoint visualOffset(35, 60); | 812 IntPoint visualOffset(35, 60); |
809 webViewImpl->page()->visualViewport().setLocation(visualOffset); | 813 webViewImpl->page()->visualViewport().setLocation(visualOffset); |
810 { | 814 { |
811 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, | 815 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
812 WebInputEvent::NoModifiers, | 816 WebInputEvent::NoModifiers, |
813 WebInputEvent::TimeStampForTesting); | 817 WebInputEvent::TimeStampForTesting); |
814 webMouseEvent.x = 10; | 818 webMouseEvent.position.x = 10; |
815 webMouseEvent.y = 10; | 819 webMouseEvent.position.y = 10; |
816 webMouseEvent.globalX = 10; | 820 webMouseEvent.screenPosition.x = 10; |
817 webMouseEvent.globalY = 10; | 821 webMouseEvent.screenPosition.y = 10; |
818 | 822 |
819 WebMouseEvent transformedMouseEvent = | 823 WebMouseEvent transformedMouseEvent = |
820 TransformWebMouseEvent(view, webMouseEvent); | 824 TransformWebMouseEvent(view, webMouseEvent); |
821 IntPoint position = | 825 IntPoint position = |
822 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); | 826 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); |
823 | 827 |
824 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + | 828 EXPECT_EQ(webMouseEvent.position.x / pageScale + visualOffset.x() + |
825 elasticOverscroll.width(), | 829 elasticOverscroll.width(), |
826 position.x()); | 830 position.x()); |
827 EXPECT_EQ(webMouseEvent.y / pageScale + visualOffset.y() + | 831 EXPECT_EQ(webMouseEvent.position.y / pageScale + visualOffset.y() + |
828 elasticOverscroll.height(), | 832 elasticOverscroll.height(), |
829 position.y()); | 833 position.y()); |
830 EXPECT_EQ(webMouseEvent.globalX, transformedMouseEvent.globalX); | 834 EXPECT_EQ(webMouseEvent.screenPosition.x, |
831 EXPECT_EQ(webMouseEvent.globalY, transformedMouseEvent.globalY); | 835 transformedMouseEvent.screenPosition.x); |
| 836 EXPECT_EQ(webMouseEvent.screenPosition.y, |
| 837 transformedMouseEvent.screenPosition.y); |
832 } | 838 } |
833 } | 839 } |
834 | 840 |
835 // Page reload/navigation should not reset elastic overscroll. | 841 // Page reload/navigation should not reset elastic overscroll. |
836 TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) { | 842 TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) { |
837 const std::string baseURL("http://www.test6.com/"); | 843 const std::string baseURL("http://www.test6.com/"); |
838 const std::string fileName("fixed_layout.html"); | 844 const std::string fileName("fixed_layout.html"); |
839 | 845 |
840 registerMockedURL(baseURL, fileName); | 846 registerMockedURL(baseURL, fileName); |
841 FrameTestHelpers::WebViewHelper webViewHelper; | 847 FrameTestHelpers::WebViewHelper webViewHelper; |
842 WebViewImpl* webViewImpl = | 848 WebViewImpl* webViewImpl = |
843 webViewHelper.initializeAndLoad(baseURL + fileName, true); | 849 webViewHelper.initializeAndLoad(baseURL + fileName, true); |
844 int pageWidth = 640; | 850 int pageWidth = 640; |
845 int pageHeight = 480; | 851 int pageHeight = 480; |
846 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 852 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
847 webViewImpl->updateAllLifecyclePhases(); | 853 webViewImpl->updateAllLifecyclePhases(); |
848 | 854 |
849 FloatSize elasticOverscroll(10, -20); | 855 FloatSize elasticOverscroll(10, -20); |
850 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 856 webViewImpl->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
851 elasticOverscroll, 1.0f, 0.0f); | 857 elasticOverscroll, 1.0f, 0.0f); |
852 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); | 858 FrameTestHelpers::reloadFrame(webViewHelper.webView()->mainFrame()); |
853 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 859 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
854 | 860 |
855 // Just elastic overscroll. | 861 // Just elastic overscroll. |
856 { | 862 { |
857 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, | 863 WebMouseEvent webMouseEvent(WebInputEvent::MouseMove, |
858 WebInputEvent::NoModifiers, | 864 WebInputEvent::NoModifiers, |
859 WebInputEvent::TimeStampForTesting); | 865 WebInputEvent::TimeStampForTesting); |
860 webMouseEvent.x = 10; | 866 webMouseEvent.position.x = 10; |
861 webMouseEvent.y = 50; | 867 webMouseEvent.position.y = 50; |
862 webMouseEvent.globalX = 10; | 868 webMouseEvent.screenPosition.x = 10; |
863 webMouseEvent.globalY = 50; | 869 webMouseEvent.screenPosition.y = 50; |
864 | 870 |
865 WebMouseEvent transformedMouseEvent = | 871 WebMouseEvent transformedMouseEvent = |
866 TransformWebMouseEvent(view, webMouseEvent); | 872 TransformWebMouseEvent(view, webMouseEvent); |
867 IntPoint position = | 873 IntPoint position = |
868 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); | 874 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); |
869 | 875 |
870 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), position.x()); | 876 EXPECT_EQ(webMouseEvent.position.x + elasticOverscroll.width(), |
871 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), position.y()); | 877 position.x()); |
872 EXPECT_EQ(webMouseEvent.globalX, transformedMouseEvent.globalX); | 878 EXPECT_EQ(webMouseEvent.position.y + elasticOverscroll.height(), |
873 EXPECT_EQ(webMouseEvent.globalY, transformedMouseEvent.globalY); | 879 position.y()); |
| 880 EXPECT_EQ(webMouseEvent.screenPosition.x, |
| 881 transformedMouseEvent.screenPosition.x); |
| 882 EXPECT_EQ(webMouseEvent.screenPosition.y, |
| 883 transformedMouseEvent.screenPosition.y); |
874 } | 884 } |
875 } | 885 } |
876 | 886 |
877 } // namespace blink | 887 } // namespace blink |
OLD | NEW |