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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 { | 427 { |
428 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, PlatformMo
useEvent::RealOrIndistinguishable, 0); | 428 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, 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 PlatformEvent::NoModifiers); | 436 PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); |
437 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, true, -1
/* null plugin id */); | 437 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, true, -1
/* null plugin id */); |
438 // FIXME: GestureEvent does not preserve velocityX, velocityY, | 438 // FIXME: GestureEvent does not preserve velocityX, velocityY, |
439 // or preventPropagation. 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_TRUE(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 EXPECT_EQ(WebGestureDeviceTouchscreen, webGestureBuilder.sourceDevice); |
456 } | 457 } |
457 | 458 |
458 { | 459 { |
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<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(); | 461 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
461 touchList->append(touch); | 462 touchList->append(touch); |
462 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
PlatformEvent::NoModifiers, false, false); | 463 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
PlatformEvent::NoModifiers, false, false); |
463 | 464 |
464 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 465 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
465 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 466 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 970 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
970 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 971 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
971 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); | 972 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); |
972 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 973 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
973 EXPECT_FALSE(platformWheelBuilder.canScroll()); | 974 EXPECT_FALSE(platformWheelBuilder.canScroll()); |
974 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); | 975 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); |
975 } | 976 } |
976 } | 977 } |
977 | 978 |
978 } // namespace blink | 979 } // namespace blink |
OLD | NEW |