diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-16 11:45:35 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-17 08:59:23 +0000 |
commit | 552906b0f222c5d5dd11b9fd73829d510980461a (patch) | |
tree | 3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc | |
parent | 1b05827804eaf047779b597718c03e7d38344261 (diff) | |
download | qtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz |
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc | 253 |
1 files changed, 133 insertions, 120 deletions
diff --git a/chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc b/chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc index 4047e3baccf..8453864e754 100644 --- a/chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc +++ b/chromium/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc @@ -33,6 +33,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/web/web_frame.h" #include "third_party/blink/public/web/web_settings.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_keyboard_event_init.h" #include "third_party/blink/renderer/core/events/gesture_event.h" #include "third_party/blink/renderer/core/events/keyboard_event.h" #include "third_party/blink/renderer/core/events/mouse_event.h" @@ -125,7 +126,7 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { int page_height = 480; web_view->MainFrameWidget()->Resize(WebSize(page_width, page_height)); web_view->MainFrameWidget()->UpdateAllLifecyclePhases( - WebWidget::LifecycleUpdateReason::kTest); + DocumentUpdateReason::kTest); web_view->SetPageScaleFactor(3); @@ -147,8 +148,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { FlooredIntPoint(transformed_event.PositionInRootFrame()); EXPECT_EQ(5, position.X()); EXPECT_EQ(5, position.Y()); - EXPECT_EQ(15, transformed_event.PositionInScreen().x); - EXPECT_EQ(15, transformed_event.PositionInScreen().y); + EXPECT_EQ(15, transformed_event.PositionInScreen().x()); + EXPECT_EQ(15, transformed_event.PositionInScreen().y()); EXPECT_EQ(15, transformed_event.movement_x); EXPECT_EQ(15, transformed_event.movement_y); @@ -159,8 +160,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebInputEvent::kGestureScrollUpdate, WebInputEvent::kNoModifiers, WebInputEvent::GetStaticTimeStampForTests(), WebGestureDevice::kTouchscreen); - web_gesture_event.SetPositionInWidget(WebFloatPoint(15, 18)); - web_gesture_event.SetPositionInScreen(WebFloatPoint(20, 22)); + web_gesture_event.SetPositionInWidget(gfx::PointF(15, 18)); + web_gesture_event.SetPositionInScreen(gfx::PointF(20, 22)); web_gesture_event.data.scroll_update.delta_x = 45; web_gesture_event.data.scroll_update.delta_y = 48; web_gesture_event.data.scroll_update.velocity_x = 40; @@ -174,8 +175,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { FlooredIntPoint(scaled_gesture_event.PositionInRootFrame()); EXPECT_EQ(5, position.X()); EXPECT_EQ(6, position.Y()); - EXPECT_EQ(20, scaled_gesture_event.PositionInScreen().x); - EXPECT_EQ(22, scaled_gesture_event.PositionInScreen().y); + EXPECT_EQ(20, scaled_gesture_event.PositionInScreen().x()); + EXPECT_EQ(22, scaled_gesture_event.PositionInScreen().y()); EXPECT_EQ(15, scaled_gesture_event.DeltaXInRootFrame()); EXPECT_EQ(16, scaled_gesture_event.DeltaYInRootFrame()); // TODO: The velocity values may need to be scaled to page scale in @@ -191,8 +192,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebInputEvent::kGestureScrollEnd, WebInputEvent::kNoModifiers, WebInputEvent::GetStaticTimeStampForTests(), WebGestureDevice::kTouchscreen); - web_gesture_event.SetPositionInWidget(WebFloatPoint(15, 18)); - web_gesture_event.SetPositionInScreen(WebFloatPoint(20, 22)); + web_gesture_event.SetPositionInWidget(gfx::PointF(15, 18)); + web_gesture_event.SetPositionInScreen(gfx::PointF(20, 22)); WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); @@ -200,8 +201,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { FlooredIntPoint(scaled_gesture_event.PositionInRootFrame()); EXPECT_EQ(5, position.X()); EXPECT_EQ(6, position.Y()); - EXPECT_EQ(20, scaled_gesture_event.PositionInScreen().x); - EXPECT_EQ(22, scaled_gesture_event.PositionInScreen().y); + EXPECT_EQ(20, scaled_gesture_event.PositionInScreen().x()); + EXPECT_EQ(22, scaled_gesture_event.PositionInScreen().y()); EXPECT_EQ(WebGestureEvent::InertialPhaseState::kUnknownMomentum, scaled_gesture_event.InertialPhase()); } @@ -216,7 +217,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(5, area.Width()); EXPECT_EQ(5, area.Height()); } @@ -231,7 +233,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(10, area.Width()); EXPECT_EQ(10, area.Height()); } @@ -246,7 +249,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(3, area.Width()); EXPECT_EQ(3, area.Height()); } @@ -261,7 +265,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(6, area.Width()); EXPECT_EQ(6, area.Height()); } @@ -276,7 +281,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(5, area.Width()); EXPECT_EQ(5, area.Height()); } @@ -291,7 +297,8 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(5, area.Width()); EXPECT_EQ(5, area.Height()); } @@ -301,13 +308,13 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebInputEvent::kPointerDown, WebPointerProperties(1, WebPointerProperties::PointerType::kTouch, WebPointerProperties::Button::kLeft, - WebFloatPoint(10.8f, 10.5f), - WebFloatPoint(10.8f, 10.5f), 30, 30), + gfx::PointF(10.8f, 10.5f), + gfx::PointF(10.8f, 10.5f), 30, 30), 6.6f, 9.9f); - EXPECT_FLOAT_EQ(10.8f, web_pointer_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(10.5f, web_pointer_event.PositionInScreen().y); - EXPECT_FLOAT_EQ(10.8f, web_pointer_event.PositionInWidget().x); - EXPECT_FLOAT_EQ(10.5f, web_pointer_event.PositionInWidget().y); + EXPECT_FLOAT_EQ(10.8f, web_pointer_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(10.5f, web_pointer_event.PositionInScreen().y()); + EXPECT_FLOAT_EQ(10.8f, web_pointer_event.PositionInWidget().x()); + EXPECT_FLOAT_EQ(10.5f, web_pointer_event.PositionInWidget().y()); EXPECT_FLOAT_EQ(6.6f, web_pointer_event.width); EXPECT_FLOAT_EQ(9.9f, web_pointer_event.height); EXPECT_EQ(30, web_pointer_event.movement_x); @@ -316,10 +323,10 @@ TEST(WebInputEventConversionTest, InputEventsScaling) { WebPointerEvent transformed_event = TransformWebPointerEvent(view, web_pointer_event) .WebPointerEventInRootFrame(); - EXPECT_FLOAT_EQ(10.8f, transformed_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(10.5f, transformed_event.PositionInScreen().y); - EXPECT_FLOAT_EQ(3.6f, transformed_event.PositionInWidget().x); - EXPECT_FLOAT_EQ(3.5f, transformed_event.PositionInWidget().y); + EXPECT_FLOAT_EQ(10.8f, transformed_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(10.5f, transformed_event.PositionInScreen().y()); + EXPECT_FLOAT_EQ(3.6f, transformed_event.PositionInWidget().x()); + EXPECT_FLOAT_EQ(3.5f, transformed_event.PositionInWidget().y()); EXPECT_FLOAT_EQ(2.2f, transformed_event.width); EXPECT_FLOAT_EQ(3.3f, transformed_event.height); EXPECT_EQ(30, transformed_event.movement_x); @@ -340,7 +347,7 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { int page_height = 480; web_view->MainFrameWidget()->Resize(WebSize(page_width, page_height)); web_view->MainFrameWidget()->UpdateAllLifecyclePhases( - WebWidget::LifecycleUpdateReason::kTest); + DocumentUpdateReason::kTest); web_view->SetPageScaleFactor(2); @@ -358,12 +365,12 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebMouseEvent transformed_event = TransformWebMouseEvent(view, web_mouse_event); - FloatPoint position = transformed_event.PositionInRootFrame(); + gfx::PointF position = transformed_event.PositionInRootFrame(); - EXPECT_FLOAT_EQ(45, position.X()); - EXPECT_FLOAT_EQ(45, position.Y()); - EXPECT_EQ(90, transformed_event.PositionInScreen().x); - EXPECT_EQ(90, transformed_event.PositionInScreen().y); + EXPECT_FLOAT_EQ(45, position.x()); + EXPECT_FLOAT_EQ(45, position.y()); + EXPECT_EQ(90, transformed_event.PositionInScreen().x()); + EXPECT_EQ(90, transformed_event.PositionInScreen().y()); EXPECT_EQ(60, transformed_event.movement_x); EXPECT_EQ(60, transformed_event.movement_y); } @@ -378,10 +385,10 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { web_mouse_event1.movement_y = 60; WebMouseEvent web_mouse_event2 = web_mouse_event1; - web_mouse_event2.SetPositionInWidget(web_mouse_event1.PositionInWidget().x, - 120); - web_mouse_event2.SetPositionInScreen(web_mouse_event1.PositionInScreen().x, - 120); + web_mouse_event2.SetPositionInWidget( + web_mouse_event1.PositionInWidget().x(), 120); + web_mouse_event2.SetPositionInScreen( + web_mouse_event1.PositionInScreen().x(), 120); web_mouse_event2.movement_y = 30; WebVector<const WebInputEvent*> events; @@ -392,20 +399,20 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { TransformWebMouseEventVector(view, events); EXPECT_EQ(events.size(), coalescedevents.size()); - FloatPoint position = coalescedevents[0].PositionInRootFrame(); - EXPECT_FLOAT_EQ(45, position.X()); - EXPECT_FLOAT_EQ(45, position.Y()); - EXPECT_EQ(90, coalescedevents[0].PositionInScreen().x); - EXPECT_EQ(90, coalescedevents[0].PositionInScreen().y); + gfx::PointF position = coalescedevents[0].PositionInRootFrame(); + EXPECT_FLOAT_EQ(45, position.x()); + EXPECT_FLOAT_EQ(45, position.y()); + EXPECT_EQ(90, coalescedevents[0].PositionInScreen().x()); + EXPECT_EQ(90, coalescedevents[0].PositionInScreen().y()); EXPECT_EQ(60, coalescedevents[0].movement_x); EXPECT_EQ(60, coalescedevents[0].movement_y); position = coalescedevents[1].PositionInRootFrame(); - EXPECT_FLOAT_EQ(45, position.X()); - EXPECT_FLOAT_EQ(60, position.Y()); - EXPECT_EQ(90, coalescedevents[1].PositionInScreen().x); - EXPECT_EQ(120, coalescedevents[1].PositionInScreen().y); + EXPECT_FLOAT_EQ(45, position.x()); + EXPECT_FLOAT_EQ(60, position.y()); + EXPECT_EQ(90, coalescedevents[1].PositionInScreen().x()); + EXPECT_EQ(120, coalescedevents[1].PositionInScreen().y()); EXPECT_EQ(60, coalescedevents[1].movement_x); EXPECT_EQ(30, coalescedevents[1].movement_y); @@ -416,19 +423,19 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebInputEvent::kGestureScrollUpdate, WebInputEvent::kNoModifiers, WebInputEvent::GetStaticTimeStampForTests(), WebGestureDevice::kTouchscreen); - web_gesture_event.SetPositionInWidget(WebFloatPoint(90, 90)); - web_gesture_event.SetPositionInScreen(WebFloatPoint(90, 90)); + web_gesture_event.SetPositionInWidget(gfx::PointF(90, 90)); + web_gesture_event.SetPositionInScreen(gfx::PointF(90, 90)); web_gesture_event.data.scroll_update.delta_x = 60; web_gesture_event.data.scroll_update.delta_y = 60; WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - FloatPoint position = scaled_gesture_event.PositionInRootFrame(); + gfx::PointF position = scaled_gesture_event.PositionInRootFrame(); - EXPECT_FLOAT_EQ(45, position.X()); - EXPECT_FLOAT_EQ(45, position.Y()); - EXPECT_EQ(90, scaled_gesture_event.PositionInScreen().x); - EXPECT_EQ(90, scaled_gesture_event.PositionInScreen().y); + EXPECT_FLOAT_EQ(45, position.x()); + EXPECT_FLOAT_EQ(45, position.y()); + EXPECT_EQ(90, scaled_gesture_event.PositionInScreen().x()); + EXPECT_EQ(90, scaled_gesture_event.PositionInScreen().y()); EXPECT_EQ(30, scaled_gesture_event.DeltaXInRootFrame()); EXPECT_EQ(30, scaled_gesture_event.DeltaYInRootFrame()); } @@ -443,7 +450,8 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(15, area.Width()); EXPECT_EQ(15, area.Height()); } @@ -458,7 +466,8 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(15, area.Width()); EXPECT_EQ(15, area.Height()); } @@ -473,7 +482,8 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(15, area.Width()); EXPECT_EQ(15, area.Height()); } @@ -488,7 +498,8 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(15, area.Width()); EXPECT_EQ(15, area.Height()); } @@ -503,7 +514,8 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(15, area.Width()); EXPECT_EQ(15, area.Height()); } @@ -518,7 +530,8 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); - IntSize area = FlooredIntSize(scaled_gesture_event.TapAreaInRootFrame()); + IntSize area = + FlooredIntSize(FloatSize(scaled_gesture_event.TapAreaInRootFrame())); EXPECT_EQ(15, area.Width()); EXPECT_EQ(15, area.Height()); } @@ -528,17 +541,17 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebInputEvent::kPointerDown, WebPointerProperties(1, WebPointerProperties::PointerType::kTouch, WebPointerProperties::Button::kLeft, - WebFloatPoint(90, 90), WebFloatPoint(90, 90)), + gfx::PointF(90, 90), gfx::PointF(90, 90)), 30, 30); WebPointerEvent transformed_event = TransformWebPointerEvent(view, web_pointer_event) .WebPointerEventInRootFrame(); - EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().y); - EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().x); - EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().y); + EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().y()); + EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().x()); + EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().y()); EXPECT_FLOAT_EQ(15, transformed_event.width); EXPECT_FLOAT_EQ(15, transformed_event.height); } @@ -548,14 +561,14 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebInputEvent::kPointerDown, WebPointerProperties(1, WebPointerProperties::PointerType::kTouch, WebPointerProperties::Button::kLeft, - WebFloatPoint(90, 90), WebFloatPoint(90, 90)), + gfx::PointF(90, 90), gfx::PointF(90, 90)), 30, 30); WebPointerEvent web_pointer_event2( WebInputEvent::kPointerDown, WebPointerProperties(1, WebPointerProperties::PointerType::kTouch, WebPointerProperties::Button::kLeft, - WebFloatPoint(120, 90), WebFloatPoint(120, 90)), + gfx::PointF(120, 90), gfx::PointF(120, 90)), 60, 30); WebVector<const WebInputEvent*> events; @@ -568,18 +581,18 @@ TEST(WebInputEventConversionTest, InputEventsTransform) { WebPointerEvent transformed_event = coalescedevents[0].WebPointerEventInRootFrame(); - EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().y); - EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().x); - EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().y); + EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().y()); + EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().x()); + EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().y()); EXPECT_FLOAT_EQ(15, transformed_event.width); EXPECT_FLOAT_EQ(15, transformed_event.height); transformed_event = coalescedevents[1].WebPointerEventInRootFrame(); - EXPECT_FLOAT_EQ(120, transformed_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().y); - EXPECT_FLOAT_EQ(60, transformed_event.PositionInWidget().x); - EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().y); + EXPECT_FLOAT_EQ(120, transformed_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(90, transformed_event.PositionInScreen().y()); + EXPECT_FLOAT_EQ(60, transformed_event.PositionInWidget().x()); + EXPECT_FLOAT_EQ(45, transformed_event.PositionInWidget().y()); EXPECT_FLOAT_EQ(30, transformed_event.width); EXPECT_FLOAT_EQ(15, transformed_event.height); } @@ -597,7 +610,7 @@ TEST(WebInputEventConversionTest, InputEventsConversions) { int page_height = 480; web_view->MainFrameWidget()->Resize(WebSize(page_width, page_height)); web_view->MainFrameWidget()->UpdateAllLifecyclePhases( - WebWidget::LifecycleUpdateReason::kTest); + DocumentUpdateReason::kTest); LocalFrameView* view = To<LocalFrame>(web_view->GetPage()->MainFrame())->View(); @@ -606,8 +619,8 @@ TEST(WebInputEventConversionTest, InputEventsConversions) { WebInputEvent::kGestureTap, WebInputEvent::kNoModifiers, WebInputEvent::GetStaticTimeStampForTests(), WebGestureDevice::kTouchscreen); - web_gesture_event.SetPositionInWidget(WebFloatPoint(10, 10)); - web_gesture_event.SetPositionInScreen(WebFloatPoint(10, 10)); + web_gesture_event.SetPositionInWidget(gfx::PointF(10, 10)); + web_gesture_event.SetPositionInScreen(gfx::PointF(10, 10)); web_gesture_event.data.tap.tap_count = 1; web_gesture_event.data.tap.width = 10; web_gesture_event.data.tap.height = 10; @@ -618,8 +631,8 @@ TEST(WebInputEventConversionTest, InputEventsConversions) { FlooredIntPoint(scaled_gesture_event.PositionInRootFrame()); EXPECT_EQ(10.f, position.X()); EXPECT_EQ(10.f, position.Y()); - EXPECT_EQ(10.f, scaled_gesture_event.PositionInScreen().x); - EXPECT_EQ(10.f, scaled_gesture_event.PositionInScreen().y); + EXPECT_EQ(10.f, scaled_gesture_event.PositionInScreen().x()); + EXPECT_EQ(10.f, scaled_gesture_event.PositionInScreen().y()); EXPECT_EQ(1, scaled_gesture_event.TapCount()); } } @@ -636,7 +649,7 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) { int page_height = 480; web_view->MainFrameWidget()->Resize(WebSize(page_width, page_height)); web_view->MainFrameWidget()->UpdateAllLifecyclePhases( - WebWidget::LifecycleUpdateReason::kTest); + DocumentUpdateReason::kTest); web_view->SetPageScaleFactor(2); @@ -659,8 +672,8 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) { FlooredIntPoint(transformed_mouse_event.PositionInRootFrame()); EXPECT_EQ(5 + visual_offset.X(), position.X()); EXPECT_EQ(5 + visual_offset.Y(), position.Y()); - EXPECT_EQ(10, transformed_mouse_event.PositionInScreen().x); - EXPECT_EQ(10, transformed_mouse_event.PositionInScreen().y); + EXPECT_EQ(10, transformed_mouse_event.PositionInScreen().x()); + EXPECT_EQ(10, transformed_mouse_event.PositionInScreen().y()); } { @@ -676,8 +689,8 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) { FlooredIntPoint(scaled_mouse_wheel_event.PositionInRootFrame()); EXPECT_EQ(5 + visual_offset.X(), position.X()); EXPECT_EQ(5 + visual_offset.Y(), position.Y()); - EXPECT_EQ(10, scaled_mouse_wheel_event.PositionInScreen().x); - EXPECT_EQ(10, scaled_mouse_wheel_event.PositionInScreen().y); + EXPECT_EQ(10, scaled_mouse_wheel_event.PositionInScreen().x()); + EXPECT_EQ(10, scaled_mouse_wheel_event.PositionInScreen().y()); } { @@ -685,8 +698,8 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) { WebInputEvent::kGestureScrollUpdate, WebInputEvent::kNoModifiers, WebInputEvent::GetStaticTimeStampForTests(), WebGestureDevice::kTouchscreen); - web_gesture_event.SetPositionInWidget(WebFloatPoint(10, 10)); - web_gesture_event.SetPositionInScreen(WebFloatPoint(10, 10)); + web_gesture_event.SetPositionInWidget(gfx::PointF(10, 10)); + web_gesture_event.SetPositionInScreen(gfx::PointF(10, 10)); WebGestureEvent scaled_gesture_event = TransformWebGestureEvent(view, web_gesture_event); @@ -694,8 +707,8 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) { FlooredIntPoint(scaled_gesture_event.PositionInRootFrame()); EXPECT_EQ(5 + visual_offset.X(), position.X()); EXPECT_EQ(5 + visual_offset.Y(), position.Y()); - EXPECT_EQ(10, scaled_gesture_event.PositionInScreen().x); - EXPECT_EQ(10, scaled_gesture_event.PositionInScreen().y); + EXPECT_EQ(10, scaled_gesture_event.PositionInScreen().x()); + EXPECT_EQ(10, scaled_gesture_event.PositionInScreen().y()); } { @@ -703,24 +716,24 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) { WebInputEvent::kPointerDown, WebPointerProperties(1, WebPointerProperties::PointerType::kTouch, WebPointerProperties::Button::kLeft, - WebFloatPoint(10.6f, 10.4f), - WebFloatPoint(10.6f, 10.4f)), + gfx::PointF(10.6f, 10.4f), + gfx::PointF(10.6f, 10.4f)), 10, 10); - EXPECT_FLOAT_EQ(10.6f, web_pointer_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(10.4f, web_pointer_event.PositionInScreen().y); - EXPECT_FLOAT_EQ(10.6f, web_pointer_event.PositionInWidget().x); - EXPECT_FLOAT_EQ(10.4f, web_pointer_event.PositionInWidget().y); + EXPECT_FLOAT_EQ(10.6f, web_pointer_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(10.4f, web_pointer_event.PositionInScreen().y()); + EXPECT_FLOAT_EQ(10.6f, web_pointer_event.PositionInWidget().x()); + EXPECT_FLOAT_EQ(10.4f, web_pointer_event.PositionInWidget().y()); WebPointerEvent transformed_event = TransformWebPointerEvent(view, web_pointer_event) .WebPointerEventInRootFrame(); - EXPECT_FLOAT_EQ(10.6f, transformed_event.PositionInScreen().x); - EXPECT_FLOAT_EQ(10.4f, transformed_event.PositionInScreen().y); + EXPECT_FLOAT_EQ(10.6f, transformed_event.PositionInScreen().x()); + EXPECT_FLOAT_EQ(10.4f, transformed_event.PositionInScreen().y()); EXPECT_FLOAT_EQ(5.3f + visual_offset.X(), - transformed_event.PositionInWidget().x); + transformed_event.PositionInWidget().x()); EXPECT_FLOAT_EQ(5.2f + visual_offset.Y(), - transformed_event.PositionInWidget().y); + transformed_event.PositionInWidget().y()); } } @@ -736,13 +749,13 @@ TEST(WebInputEventConversionTest, ElasticOverscroll) { int page_height = 480; web_view->MainFrameWidget()->Resize(WebSize(page_width, page_height)); web_view->MainFrameWidget()->UpdateAllLifecyclePhases( - WebWidget::LifecycleUpdateReason::kTest); + DocumentUpdateReason::kTest); LocalFrameView* view = To<LocalFrame>(web_view->GetPage()->MainFrame())->View(); gfx::Vector2dF elastic_overscroll(10, -20); - web_view->MainFrameWidget()->ApplyViewportChanges( + web_view->MainFrameWidget()->ApplyViewportChangesForTesting( {gfx::ScrollOffset(), elastic_overscroll, 1.0f, false, 0.0f}); // Just elastic overscroll. @@ -758,14 +771,14 @@ TEST(WebInputEventConversionTest, ElasticOverscroll) { IntPoint position = FlooredIntPoint(transformed_mouse_event.PositionInRootFrame()); - EXPECT_EQ(web_mouse_event.PositionInWidget().x + elastic_overscroll.x(), + EXPECT_EQ(web_mouse_event.PositionInWidget().x() + elastic_overscroll.x(), position.X()); - EXPECT_EQ(web_mouse_event.PositionInWidget().y + elastic_overscroll.y(), + EXPECT_EQ(web_mouse_event.PositionInWidget().y() + elastic_overscroll.y(), position.Y()); - EXPECT_EQ(web_mouse_event.PositionInScreen().x, - transformed_mouse_event.PositionInScreen().x); - EXPECT_EQ(web_mouse_event.PositionInScreen().y, - transformed_mouse_event.PositionInScreen().y); + EXPECT_EQ(web_mouse_event.PositionInScreen().x(), + transformed_mouse_event.PositionInScreen().x()); + EXPECT_EQ(web_mouse_event.PositionInScreen().y(), + transformed_mouse_event.PositionInScreen().y()); } // Elastic overscroll and pinch-zoom (this doesn't actually ever happen, @@ -787,16 +800,16 @@ TEST(WebInputEventConversionTest, ElasticOverscroll) { IntPoint position = FlooredIntPoint(transformed_mouse_event.PositionInRootFrame()); - EXPECT_EQ(web_mouse_event.PositionInWidget().x / page_scale + + EXPECT_EQ(web_mouse_event.PositionInWidget().x() / page_scale + visual_offset.X() + elastic_overscroll.x(), position.X()); - EXPECT_EQ(web_mouse_event.PositionInWidget().y / page_scale + + EXPECT_EQ(web_mouse_event.PositionInWidget().y() / page_scale + visual_offset.Y() + elastic_overscroll.y(), position.Y()); - EXPECT_EQ(web_mouse_event.PositionInScreen().x, - transformed_mouse_event.PositionInScreen().x); - EXPECT_EQ(web_mouse_event.PositionInScreen().y, - transformed_mouse_event.PositionInScreen().y); + EXPECT_EQ(web_mouse_event.PositionInScreen().x(), + transformed_mouse_event.PositionInScreen().x()); + EXPECT_EQ(web_mouse_event.PositionInScreen().y(), + transformed_mouse_event.PositionInScreen().y()); } } @@ -813,10 +826,10 @@ TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) { int page_height = 480; web_view->MainFrameWidget()->Resize(WebSize(page_width, page_height)); web_view->MainFrameWidget()->UpdateAllLifecyclePhases( - WebWidget::LifecycleUpdateReason::kTest); + DocumentUpdateReason::kTest); gfx::Vector2dF elastic_overscroll(10, -20); - web_view->MainFrameWidget()->ApplyViewportChanges( + web_view->MainFrameWidget()->ApplyViewportChangesForTesting( {gfx::ScrollOffset(), elastic_overscroll, 1.0f, false, 0.0f}); frame_test_helpers::ReloadFrame( web_view_helper.GetWebView()->MainFrameImpl()); @@ -836,14 +849,14 @@ TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) { IntPoint position = FlooredIntPoint(transformed_mouse_event.PositionInRootFrame()); - EXPECT_EQ(web_mouse_event.PositionInWidget().x + elastic_overscroll.x(), + EXPECT_EQ(web_mouse_event.PositionInWidget().x() + elastic_overscroll.x(), position.X()); - EXPECT_EQ(web_mouse_event.PositionInWidget().y + elastic_overscroll.y(), + EXPECT_EQ(web_mouse_event.PositionInWidget().y() + elastic_overscroll.y(), position.Y()); - EXPECT_EQ(web_mouse_event.PositionInScreen().x, - transformed_mouse_event.PositionInScreen().x); - EXPECT_EQ(web_mouse_event.PositionInScreen().y, - transformed_mouse_event.PositionInScreen().y); + EXPECT_EQ(web_mouse_event.PositionInScreen().x(), + transformed_mouse_event.PositionInScreen().x()); + EXPECT_EQ(web_mouse_event.PositionInScreen().y(), + transformed_mouse_event.PositionInScreen().y()); } } |