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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 webGestureEvent.x = 10; | 262 webGestureEvent.x = 10; |
263 webGestureEvent.y = 12; | 263 webGestureEvent.y = 12; |
264 webGestureEvent.globalX = 20; | 264 webGestureEvent.globalX = 20; |
265 webGestureEvent.globalY = 22; | 265 webGestureEvent.globalY = 22; |
266 webGestureEvent.data.scrollUpdate.deltaX = 30; | 266 webGestureEvent.data.scrollUpdate.deltaX = 30; |
267 webGestureEvent.data.scrollUpdate.deltaY = 32; | 267 webGestureEvent.data.scrollUpdate.deltaY = 32; |
268 webGestureEvent.data.scrollUpdate.velocityX = 40; | 268 webGestureEvent.data.scrollUpdate.velocityX = 40; |
269 webGestureEvent.data.scrollUpdate.velocityY = 42; | 269 webGestureEvent.data.scrollUpdate.velocityY = 42; |
270 webGestureEvent.data.scrollUpdate.inertial = true; | 270 webGestureEvent.data.scrollUpdate.inertial = true; |
271 webGestureEvent.data.scrollUpdate.preventPropagation = true; | 271 webGestureEvent.data.scrollUpdate.preventPropagation = true; |
| 272 webGestureEvent.data.scrollUpdate.railsMode = WebInputEvent::RailsModeVe
rtical; |
272 | 273 |
273 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); | 274 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); |
274 EXPECT_EQ(5, platformGestureBuilder.position().x()); | 275 EXPECT_EQ(5, platformGestureBuilder.position().x()); |
275 EXPECT_EQ(6, platformGestureBuilder.position().y()); | 276 EXPECT_EQ(6, platformGestureBuilder.position().y()); |
276 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x()); | 277 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x()); |
277 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y()); | 278 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y()); |
278 EXPECT_EQ(15, platformGestureBuilder.deltaX()); | 279 EXPECT_EQ(15, platformGestureBuilder.deltaX()); |
279 EXPECT_EQ(16, platformGestureBuilder.deltaY()); | 280 EXPECT_EQ(16, platformGestureBuilder.deltaY()); |
280 // TODO: The velocity values may need to be scaled to page scale in | 281 // TODO: The velocity values may need to be scaled to page scale in |
281 // order to remain consist with delta values. | 282 // order to remain consist with delta values. |
282 EXPECT_EQ(40, platformGestureBuilder.velocityX()); | 283 EXPECT_EQ(40, platformGestureBuilder.velocityX()); |
283 EXPECT_EQ(42, platformGestureBuilder.velocityY()); | 284 EXPECT_EQ(42, platformGestureBuilder.velocityY()); |
284 EXPECT_TRUE(platformGestureBuilder.inertial()); | 285 EXPECT_TRUE(platformGestureBuilder.inertial()); |
285 EXPECT_TRUE(platformGestureBuilder.preventPropagation()); | 286 EXPECT_TRUE(platformGestureBuilder.preventPropagation()); |
| 287 EXPECT_EQ(PlatformEvent::RailsModeVertical, |
| 288 platformGestureBuilder.railsMode()); |
286 } | 289 } |
287 | 290 |
288 { | 291 { |
289 WebGestureEvent webGestureEvent; | 292 WebGestureEvent webGestureEvent; |
290 webGestureEvent.type = WebInputEvent::GestureScrollEnd; | 293 webGestureEvent.type = WebInputEvent::GestureScrollEnd; |
291 webGestureEvent.x = 10; | 294 webGestureEvent.x = 10; |
292 webGestureEvent.y = 12; | 295 webGestureEvent.y = 12; |
293 webGestureEvent.globalX = 20; | 296 webGestureEvent.globalX = 20; |
294 webGestureEvent.globalY = 22; | 297 webGestureEvent.globalY = 22; |
295 | 298 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 { | 416 { |
414 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, PlatformMo
useEvent::RealOrIndistinguishable, 0); | 417 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, PlatformMo
useEvent::RealOrIndistinguishable, 0); |
415 RefPtrWillBeRawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventType
Names::mousemove, domWindow, platformMouseEvent, 0, document); | 418 RefPtrWillBeRawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventType
Names::mousemove, domWindow, platformMouseEvent, 0, document); |
416 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); | 419 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); |
417 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); | 420 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); |
418 } | 421 } |
419 | 422 |
420 { | 423 { |
421 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, | 424 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, |
422 false, false, false, false); | 425 false, false, false, false); |
423 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, true); | 426 platformGestureEvent.setScrollGestureData( |
| 427 30, 32, 40, 42, true, true, PlatformEvent::RailsModeHorizontal); |
424 // FIXME: GestureEvent does not preserve velocityX, velocityY, | 428 // FIXME: GestureEvent does not preserve velocityX, velocityY, |
425 // preventPropagation, or inertial. It also fails to scale | 429 // preventPropagation, inertial, or railsMode. It also fails to scale |
426 // coordinates (x, y, deltaX, deltaY) to the page scale. This | 430 // coordinates (x, y, deltaX, deltaY) to the page scale. This |
427 // may lead to unexpected bugs if a PlatformGestureEvent is | 431 // may lead to unexpected bugs if a PlatformGestureEvent is |
428 // transformed into WebGestureEvent and back. | 432 // transformed into WebGestureEvent and back. |
429 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(dom
Window, platformGestureEvent); | 433 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(dom
Window, platformGestureEvent); |
430 WebGestureEventBuilder webGestureBuilder(view, documentLayoutView, *gest
ureEvent); | 434 WebGestureEventBuilder webGestureBuilder(view, documentLayoutView, *gest
ureEvent); |
431 | 435 |
432 EXPECT_EQ(10, webGestureBuilder.x); | 436 EXPECT_EQ(10, webGestureBuilder.x); |
433 EXPECT_EQ(12, webGestureBuilder.y); | 437 EXPECT_EQ(12, webGestureBuilder.y); |
434 EXPECT_EQ(20, webGestureBuilder.globalX); | 438 EXPECT_EQ(20, webGestureBuilder.globalX); |
435 EXPECT_EQ(22, webGestureBuilder.globalY); | 439 EXPECT_EQ(22, webGestureBuilder.globalY); |
436 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); | 440 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); |
437 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); | 441 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); |
438 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); | 442 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); |
439 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); | 443 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); |
440 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.inertial); | 444 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.inertial); |
441 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); | 445 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); |
| 446 EXPECT_EQ(WebInputEvent::RailsModeFree, |
| 447 webGestureBuilder.data.scrollUpdate.railsMode); |
442 } | 448 } |
443 | 449 |
444 { | 450 { |
445 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); | 451 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); |
446 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 452 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
447 touchList->append(touch); | 453 touchList->append(touch); |
448 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
false, false, false, false, false, false); | 454 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
false, false, false, false, false, false); |
449 | 455 |
450 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); | 456 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); |
451 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 457 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 923 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
918 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 924 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
919 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); | 925 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); |
920 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 926 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
921 EXPECT_FALSE(platformWheelBuilder.canScroll()); | 927 EXPECT_FALSE(platformWheelBuilder.canScroll()); |
922 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); | 928 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); |
923 } | 929 } |
924 } | 930 } |
925 | 931 |
926 } // anonymous namespace | 932 } // anonymous namespace |
OLD | NEW |