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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 { | 427 { |
428 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10) , NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, PlatformMo useEvent::RealOrIndistinguishable, 0); | 428 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10) , NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, PlatformMo useEvent::RealOrIndistinguishable, 0); |
429 RefPtrWillBeRawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventType Names::mousemove, domWindow, platformMouseEvent, 0, document); | 429 RefPtrWillBeRawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventType Names::mousemove, domWindow, platformMouseEvent, 0, document); |
430 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve nt); | 430 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve nt); |
431 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); | 431 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); |
432 } | 432 } |
433 | 433 |
434 { | 434 { |
435 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, | 435 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, |
436 false, false, false, false); | 436 false, false, false, false); |
437 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, true); | 437 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, 0, true) ; |
tdresser
2015/09/15 13:13:08
-1
wjmaclean
2015/09/15 15:02:48
Done.
| |
438 // FIXME: GestureEvent does not preserve velocityX, velocityY, | 438 // FIXME: GestureEvent does not preserve velocityX, velocityY, |
439 // preventPropagation, or inertial. It also fails to scale | 439 // or preventPropagation. It also fails to scale |
440 // coordinates (x, y, deltaX, deltaY) to the page scale. This | 440 // coordinates (x, y, deltaX, deltaY) to the page scale. This |
441 // may lead to unexpected bugs if a PlatformGestureEvent is | 441 // may lead to unexpected bugs if a PlatformGestureEvent is |
442 // transformed into WebGestureEvent and back. | 442 // transformed into WebGestureEvent and back. |
443 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(dom Window, platformGestureEvent); | 443 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(dom Window, platformGestureEvent); |
444 WebGestureEventBuilder webGestureBuilder(documentLayoutView, *gestureEve nt); | 444 WebGestureEventBuilder webGestureBuilder(documentLayoutView, *gestureEve nt); |
445 | 445 |
446 EXPECT_EQ(10, webGestureBuilder.x); | 446 EXPECT_EQ(10, webGestureBuilder.x); |
447 EXPECT_EQ(12, webGestureBuilder.y); | 447 EXPECT_EQ(12, webGestureBuilder.y); |
448 EXPECT_EQ(20, webGestureBuilder.globalX); | 448 EXPECT_EQ(20, webGestureBuilder.globalX); |
449 EXPECT_EQ(22, webGestureBuilder.globalY); | 449 EXPECT_EQ(22, webGestureBuilder.globalY); |
450 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); | 450 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); |
451 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); | 451 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); |
452 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); | 452 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); |
453 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); | 453 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); |
454 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.inertial); | 454 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial); |
455 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); | 455 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); |
456 } | 456 } |
457 | 457 |
458 { | 458 { |
459 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl ->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0, 0); | 459 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl ->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0, 0); |
460 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 460 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
461 touchList->append(touch); | 461 touchList->append(touch); |
462 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, false, false, false, false, false, false); | 462 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, false, false, false, false, false, false); |
463 | 463 |
464 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 464 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
867 FrameTestHelpers::WebViewHelper webViewHelper; | 867 FrameTestHelpers::WebViewHelper webViewHelper; |
868 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); | 868 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); |
869 int pageWidth = 640; | 869 int pageWidth = 640; |
870 int pageHeight = 480; | 870 int pageHeight = 480; |
871 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 871 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
872 webViewImpl->layout(); | 872 webViewImpl->layout(); |
873 | 873 |
874 RefPtrWillBeRawPtr<Document> document = toLocalFrame(webViewImpl->page()->ma inFrame())->document(); | 874 RefPtrWillBeRawPtr<Document> document = toLocalFrame(webViewImpl->page()->ma inFrame())->document(); |
875 RefPtrWillBeRawPtr<WheelEvent> event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 10), | 875 RefPtrWillBeRawPtr<WheelEvent> event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 10), |
876 WheelEvent::DOM_DELTA_PAGE, document.get()->domWindow(), IntPoint(2, 6) , IntPoint(10, 30), | 876 WheelEvent::DOM_DELTA_PAGE, document.get()->domWindow(), IntPoint(2, 6) , IntPoint(10, 30), |
877 true, false, false, false, 0, true, true, Event::RailsModeHorizontal); | 877 true, false, false, false, 0, true, 0, true, Event::RailsModeHorizontal) ; |
tdresser
2015/09/15 13:13:08
-1
wjmaclean
2015/09/15 15:02:48
Done.
| |
878 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page()->ma inFrame())->view(), document.get()->layoutView(), *event); | 878 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page()->ma inFrame())->view(), document.get()->layoutView(), *event); |
879 EXPECT_EQ(1, webMouseWheel.wheelTicksX); | 879 EXPECT_EQ(1, webMouseWheel.wheelTicksX); |
880 EXPECT_EQ(3, webMouseWheel.wheelTicksY); | 880 EXPECT_EQ(3, webMouseWheel.wheelTicksY); |
881 EXPECT_EQ(5, webMouseWheel.deltaX); | 881 EXPECT_EQ(5, webMouseWheel.deltaX); |
882 EXPECT_EQ(10, webMouseWheel.deltaY); | 882 EXPECT_EQ(10, webMouseWheel.deltaY); |
883 EXPECT_EQ(2, webMouseWheel.globalX); | 883 EXPECT_EQ(2, webMouseWheel.globalX); |
884 EXPECT_EQ(6, webMouseWheel.globalY); | 884 EXPECT_EQ(6, webMouseWheel.globalY); |
885 EXPECT_EQ(10, webMouseWheel.windowX); | 885 EXPECT_EQ(10, webMouseWheel.windowX); |
886 EXPECT_EQ(30, webMouseWheel.windowY); | 886 EXPECT_EQ(30, webMouseWheel.windowY); |
887 EXPECT_TRUE(webMouseWheel.scrollByPage); | 887 EXPECT_TRUE(webMouseWheel.scrollByPage); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 969 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
970 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 970 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
971 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); | 971 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); |
972 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 972 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
973 EXPECT_FALSE(platformWheelBuilder.canScroll()); | 973 EXPECT_FALSE(platformWheelBuilder.canScroll()); |
974 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert ical); | 974 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert ical); |
975 } | 975 } |
976 } | 976 } |
977 | 977 |
978 } // namespace blink | 978 } // namespace blink |
OLD | NEW |