Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp

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

Powered by Google App Engine
This is Rietveld 408576698