summaryrefslogtreecommitdiff
path: root/chromium/content/browser/renderer_host/input
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/renderer_host/input')
-rw-r--r--chromium/content/browser/renderer_host/input/autoscroll_browsertest.cc25
-rw-r--r--chromium/content/browser/renderer_host/input/compositor_event_ack_browsertest.cc6
-rw-r--r--chromium/content/browser/renderer_host/input/event_latency_aura_browsertest.cc3
-rw-r--r--chromium/content/browser/renderer_host/input/fling_browsertest.cc3
-rw-r--r--chromium/content/browser/renderer_host/input/gesture_event_queue_unittest.cc29
-rw-r--r--chromium/content/browser/renderer_host/input/input_router.h9
-rw-r--r--chromium/content/browser/renderer_host/input/input_router_client.h9
-rw-r--r--chromium/content/browser/renderer_host/input/input_router_impl.cc68
-rw-r--r--chromium/content/browser/renderer_host/input/input_router_impl.h39
-rw-r--r--chromium/content/browser/renderer_host/input/input_router_impl_unittest.cc139
-rw-r--r--chromium/content/browser/renderer_host/input/main_thread_event_queue_browsertest.cc19
-rw-r--r--chromium/content/browser/renderer_host/input/mock_input_router.cc7
-rw-r--r--chromium/content/browser/renderer_host/input/mock_input_router.h3
-rw-r--r--chromium/content/browser/renderer_host/input/mock_input_router_client.cc20
-rw-r--r--chromium/content/browser/renderer_host/input/mock_input_router_client.h22
-rw-r--r--chromium/content/browser/renderer_host/input/mouse_latency_browsertest.cc7
-rw-r--r--chromium/content/browser/renderer_host/input/mouse_wheel_event_queue.cc6
-rw-r--r--chromium/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc4
-rw-r--r--chromium/content/browser/renderer_host/input/passthrough_touch_event_queue.cc12
-rw-r--r--chromium/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc3
-rw-r--r--chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc69
-rw-r--r--chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.h6
-rw-r--r--chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc352
-rw-r--r--chromium/content/browser/renderer_host/input/scroll_latency_browsertest.cc28
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.cc12
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.h4
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc11
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.h3
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_gesture_target_base.cc13
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_input_browsertest.cc64
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_mouse_driver.cc7
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_mouse_driver.h1
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_pen_driver.cc4
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_pointer_driver.h1
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc22
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h1
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_tap_gesture.cc2
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_touch_driver.cc3
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_touch_driver.h6
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc12
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h2
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc5
-rw-r--r--chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h2
-rw-r--r--chromium/content/browser/renderer_host/input/touch_action_browsertest.cc18
-rw-r--r--chromium/content/browser/renderer_host/input/touch_action_filter.cc154
-rw-r--r--chromium/content/browser/renderer_host/input/touch_action_filter.h19
-rw-r--r--chromium/content/browser/renderer_host/input/touch_action_filter_unittest.cc79
-rw-r--r--chromium/content/browser/renderer_host/input/touch_input_browsertest.cc12
-rw-r--r--chromium/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc2
-rw-r--r--chromium/content/browser/renderer_host/input/web_input_event_builders_mac.mm23
-rw-r--r--chromium/content/browser/renderer_host/input/web_input_event_util_unittest.cc2
-rw-r--r--chromium/content/browser/renderer_host/input/wheel_event_listener_browsertest.cc3
-rw-r--r--chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc22
53 files changed, 519 insertions, 878 deletions
diff --git a/chromium/content/browser/renderer_host/input/autoscroll_browsertest.cc b/chromium/content/browser/renderer_host/input/autoscroll_browsertest.cc
index 9bc610581d5..c0663aa3d79 100644
--- a/chromium/content/browser/renderer_host/input/autoscroll_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/autoscroll_browsertest.cc
@@ -12,6 +12,7 @@
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/events/base_event_utils.h"
using blink::WebInputEvent;
@@ -125,8 +126,7 @@ class AutoscrollBrowserTest : public ContentBrowserTest {
RenderFrameSubmissionObserver observer(
GetWidgetHost()->render_frame_metadata_provider());
for (int i = 0; i < num_repeat; i++) {
- GetWidgetHost()->Send(
- new WidgetMsg_ForceRedraw(GetWidgetHost()->GetRoutingID(), i));
+ GetWidgetHost()->RequestForceRedraw(i);
observer.WaitForAnyFrameSubmission();
}
}
@@ -135,15 +135,16 @@ class AutoscrollBrowserTest : public ContentBrowserTest {
bool is_autoscroll_in_progress = GetWidgetHost()->IsAutoscrollInProgress();
// Simulate and send middle click mouse down.
- blink::WebMouseEvent down_event = SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseDown, x, y, modifiers);
+ blink::WebMouseEvent down_event =
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseDown, x, y, modifiers);
down_event.button = blink::WebMouseEvent::Button::kMiddle;
down_event.SetTimeStamp(ui::EventTimeForNow());
down_event.SetPositionInScreen(x, y);
GetWidgetHost()->ForwardMouseEvent(down_event);
// Simulate and send middle click mouse up.
- blink::WebMouseEvent up_event = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent up_event = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseUp, x, y, modifiers);
up_event.button = blink::WebMouseEvent::Button::kMiddle;
up_event.SetTimeStamp(ui::EventTimeForNow());
@@ -184,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest, AutoscrollFling) {
// The page should start scrolling with mouse move.
RenderFrameSubmissionObserver observer(
GetWidgetHost()->render_frame_metadata_provider());
- blink::WebMouseEvent move_event = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent move_event = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, 50, 50,
blink::WebInputEvent::kNoModifiers);
move_event.SetTimeStamp(ui::EventTimeForNow());
@@ -205,7 +206,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest, AutoscrollFlingGSBDeltaHints) {
SimulateMiddleClick(10, 10, blink::WebInputEvent::kNoModifiers);
// A GSB will be sent on first mouse move.
- blink::WebMouseEvent move_event = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent move_event = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, 50, 50,
blink::WebInputEvent::kNoModifiers);
move_event.SetTimeStamp(ui::EventTimeForNow());
@@ -232,7 +233,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest,
SimulateMiddleClick(10, 10, blink::WebInputEvent::kNoModifiers);
// Check that the generated GSU has non-zero position in widget.
- blink::WebMouseEvent move_event = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent move_event = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, 50, 50,
blink::WebInputEvent::kNoModifiers);
move_event.SetTimeStamp(ui::EventTimeForNow());
@@ -271,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest,
RenderFrameSubmissionObserver observer(
GetWidgetHost()->render_frame_metadata_provider());
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
10, 10, 0, -53, 0, ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
GetWidgetHost()->ForwardWheelEvent(wheel_event);
@@ -291,7 +292,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest,
RenderFrameSubmissionObserver observer(
GetWidgetHost()->render_frame_metadata_provider());
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
10, 10, 0, -53, 0, ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
GetWidgetHost()->ForwardWheelEvent(wheel_event);
@@ -319,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest,
// Move the mouse up, no scrolling happens since the page is at its extent.
auto scroll_update_watcher = std::make_unique<InputMsgWatcher>(
GetWidgetHost(), blink::WebInputEvent::Type::kGestureScrollUpdate);
- blink::WebMouseEvent move_up = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent move_up = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, 20, 20,
blink::WebInputEvent::kNoModifiers);
move_up.SetTimeStamp(ui::EventTimeForNow());
@@ -336,7 +337,7 @@ IN_PROC_BROWSER_TEST_F(AutoscrollBrowserTest,
// timeout if autoscrolling does not work after direction change.
RenderFrameSubmissionObserver observer(
GetWidgetHost()->render_frame_metadata_provider());
- blink::WebMouseEvent move_down = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent move_down = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, 180, 180,
blink::WebInputEvent::kNoModifiers);
move_down.SetTimeStamp(ui::EventTimeForNow());
diff --git a/chromium/content/browser/renderer_host/input/compositor_event_ack_browsertest.cc b/chromium/content/browser/renderer_host/input/compositor_event_ack_browsertest.cc
index 0300adb8e03..7169c2df905 100644
--- a/chromium/content/browser/renderer_host/input/compositor_event_ack_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/compositor_event_ack_browsertest.cc
@@ -16,7 +16,6 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/common/input_messages.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -28,6 +27,7 @@
#include "content/public/test/hit_test_region_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event_switches.h"
@@ -166,7 +166,7 @@ class CompositorEventAckBrowserTest : public ContentBrowserTest {
// This event never completes its processing. As kCompositorEventAckDataURL
// will block the renderer's main thread once it is received.
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
10, 10, 0, -53, 0, ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
GetWidgetHost()->ForwardWheelEvent(wheel_event);
@@ -255,7 +255,7 @@ IN_PROC_BROWSER_TEST_F(CompositorEventAckBrowserTest,
auto* input_event_router = GetWidgetHost()->delegate()->GetInputEventRouter();
// Send a TouchStart so that we can set allowed touch action to Auto.
- SyntheticWebTouchEvent touch_event;
+ blink::SyntheticWebTouchEvent touch_event;
touch_event.PressPoint(50, 50);
touch_event.SetTimeStamp(ui::EventTimeForNow());
input_event_router->RouteTouchEvent(root_view, &touch_event,
diff --git a/chromium/content/browser/renderer_host/input/event_latency_aura_browsertest.cc b/chromium/content/browser/renderer_host/input/event_latency_aura_browsertest.cc
index 3a86f59f27b..7ce2be8b615 100644
--- a/chromium/content/browser/renderer_host/input/event_latency_aura_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/event_latency_aura_browsertest.cc
@@ -64,7 +64,8 @@ class EventLatencyBrowserTest : public ContentBrowserTest {
// Tests that if a key-press on a page causes a visual update, appropriate event
// latency metrics are reported.
-IN_PROC_BROWSER_TEST_F(EventLatencyBrowserTest, KeyPressOnButton) {
+// TODO(crbug.com/1085046): flaky test.
+IN_PROC_BROWSER_TEST_F(EventLatencyBrowserTest, DISABLED_KeyPressOnButton) {
base::HistogramTester histogram_tester;
ASSERT_NO_FATAL_FAILURE(LoadTestPage());
diff --git a/chromium/content/browser/renderer_host/input/fling_browsertest.cc b/chromium/content/browser/renderer_host/input/fling_browsertest.cc
index ba9bbc9b4d5..c63608e368a 100644
--- a/chromium/content/browser/renderer_host/input/fling_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/fling_browsertest.cc
@@ -16,6 +16,7 @@
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/dns/mock_host_resolver.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/base_event_utils.h"
@@ -199,7 +200,7 @@ class BrowserSideFlingBrowserTest : public ContentBrowserTest {
render_widget_host,
blink::WebInputEvent::Type::kGestureScrollBegin);
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
10, 10, fling_velocity.x() / 1000, fling_velocity.y() / 1000, 0,
ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
diff --git a/chromium/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/chromium/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
index b6c72126ffd..bdd4a78e781 100644
--- a/chromium/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
@@ -20,8 +20,8 @@
#include "build/build_config.h"
#include "content/browser/renderer_host/input/input_router_config_helper.h"
#include "content/browser/renderer_host/input/touchpad_tap_suppression_controller.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
#include "ui/events/blink/blink_features.h"
@@ -129,37 +129,38 @@ class GestureEventQueueTest : public testing::Test,
void SimulateGestureEvent(WebInputEvent::Type type,
WebGestureDevice sourceDevice) {
SimulateGestureEvent(
- SyntheticWebGestureEventBuilder::Build(type, sourceDevice));
+ blink::SyntheticWebGestureEventBuilder::Build(type, sourceDevice));
}
void SimulateGSEGeneratedByFlingController(WebGestureDevice sourceDevice) {
- WebGestureEvent gesture_scroll_end = SyntheticWebGestureEventBuilder::Build(
- WebInputEvent::Type::kGestureScrollEnd, sourceDevice);
+ WebGestureEvent gesture_scroll_end =
+ blink::SyntheticWebGestureEventBuilder::Build(
+ WebInputEvent::Type::kGestureScrollEnd, sourceDevice);
gesture_scroll_end.data.scroll_end.generated_by_fling_controller = true;
SimulateGestureEvent(gesture_scroll_end);
}
void SimulateGestureScrollUpdateEvent(float dX, float dY, int modifiers) {
- SimulateGestureEvent(SyntheticWebGestureEventBuilder::BuildScrollUpdate(
- dX, dY, modifiers, blink::WebGestureDevice::kTouchscreen));
+ SimulateGestureEvent(
+ blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ dX, dY, modifiers, blink::WebGestureDevice::kTouchscreen));
}
void SimulateGesturePinchUpdateEvent(float scale,
float anchorX,
float anchorY,
int modifiers) {
- SimulateGestureEvent(SyntheticWebGestureEventBuilder::BuildPinchUpdate(
- scale, anchorX, anchorY, modifiers,
- blink::WebGestureDevice::kTouchscreen));
+ SimulateGestureEvent(
+ blink::SyntheticWebGestureEventBuilder::BuildPinchUpdate(
+ scale, anchorX, anchorY, modifiers,
+ blink::WebGestureDevice::kTouchscreen));
}
void SimulateGestureFlingStartEvent(float velocityX,
float velocityY,
WebGestureDevice sourceDevice) {
- SimulateGestureEvent(
- SyntheticWebGestureEventBuilder::BuildFling(velocityX,
- velocityY,
- sourceDevice));
+ SimulateGestureEvent(blink::SyntheticWebGestureEventBuilder::BuildFling(
+ velocityX, velocityY, sourceDevice));
}
void SendInputEventACK(WebInputEvent::Type type,
@@ -194,7 +195,7 @@ class GestureEventQueueTest : public testing::Test,
void set_sync_followup_event(WebInputEvent::Type type,
WebGestureDevice sourceDevice) {
sync_followup_event_.reset(new WebGestureEvent(
- SyntheticWebGestureEventBuilder::Build(type, sourceDevice)));
+ blink::SyntheticWebGestureEventBuilder::Build(type, sourceDevice)));
}
unsigned GestureEventQueueSize() {
diff --git a/chromium/content/browser/renderer_host/input/input_router.h b/chromium/content/browser/renderer_host/input/input_router.h
index 8d09e00cca5..ee162263d21 100644
--- a/chromium/content/browser/renderer_host/input/input_router.h
+++ b/chromium/content/browser/renderer_host/input/input_router.h
@@ -10,11 +10,11 @@
#include "content/browser/renderer_host/event_with_latency_info.h"
#include "content/browser/renderer_host/input/gesture_event_queue.h"
#include "content/browser/renderer_host/input/passthrough_touch_event_queue.h"
-#include "content/common/widget.mojom.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
+#include "third_party/blink/public/mojom/input/input_handler.mojom.h"
namespace content {
@@ -86,11 +86,8 @@ class InputRouter {
virtual void SetForceEnableZoom(bool enabled) = 0;
// Create and bind a new host channel.
- virtual mojo::PendingRemote<mojom::WidgetInputHandlerHost> BindNewHost() = 0;
-
- // Create and bind a new frame based host channel.
- virtual mojo::PendingRemote<mojom::WidgetInputHandlerHost>
- BindNewFrameHost() = 0;
+ virtual mojo::PendingRemote<blink::mojom::WidgetInputHandlerHost>
+ BindNewHost() = 0;
// Used to stop an active fling if such exists.
virtual void StopFling() = 0;
diff --git a/chromium/content/browser/renderer_host/input/input_router_client.h b/chromium/content/browser/renderer_host/input/input_router_client.h
index 137975ca6db..fea6b9e9dc8 100644
--- a/chromium/content/browser/renderer_host/input/input_router_client.h
+++ b/chromium/content/browser/renderer_host/input/input_router_client.h
@@ -8,10 +8,10 @@
#include "cc/input/touch_action.h"
#include "content/browser/renderer_host/event_with_latency_info.h"
#include "content/common/content_export.h"
-#include "content/common/input/input_handler.mojom.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
+#include "third_party/blink/public/mojom/input/input_handler.mojom.h"
namespace ui {
class LatencyInfo;
@@ -45,9 +45,9 @@ class CONTENT_EXPORT InputRouterClient {
// renderer.
virtual void DidOverscroll(const ui::DidOverscrollParams& params) = 0;
- // Called when the router has received a whitelisted touch action notification
+ // Called when the router has received an allowed touch action notification
// from the renderer.
- virtual void OnSetWhiteListedTouchAction(cc::TouchAction touch_action) = 0;
+ virtual void OnSetCompositorAllowedTouchAction(cc::TouchAction) = 0;
// Called when a GSB has started scrolling a viewport.
virtual void DidStartScrollingViewport() = 0;
@@ -82,7 +82,8 @@ class CONTENT_EXPORT InputRouterClient {
bool from_user_gesture,
bool privileged,
bool unadjusted_movement,
- mojom::WidgetInputHandlerHost::RequestMouseLockCallback response) = 0;
+ blink::mojom::WidgetInputHandlerHost::RequestMouseLockCallback
+ response) = 0;
// Returns the size of visible viewport in screen space, in DIPs.
virtual gfx::Size GetRootWidgetViewportSize() = 0;
diff --git a/chromium/content/browser/renderer_host/input/input_router_impl.cc b/chromium/content/browser/renderer_host/input/input_router_impl.cc
index a7a2b26cd94..fffec86cf97 100644
--- a/chromium/content/browser/renderer_host/input/input_router_impl.cc
+++ b/chromium/content/browser/renderer_host/input/input_router_impl.cc
@@ -17,7 +17,6 @@
#include "content/browser/renderer_host/input/input_disposition_handler.h"
#include "content/browser/renderer_host/input/input_router_client.h"
#include "content/common/content_constants_internal.h"
-#include "content/common/input/input_handler.mojom.h"
#include "content/common/input/web_touch_event_traits.h"
#include "content/common/input_messages.h"
#include "content/public/browser/notification_service.h"
@@ -26,7 +25,9 @@
#include "content/public/common/input_event_ack_state.h"
#include "ipc/ipc_sender.h"
#include "services/tracing/public/cpp/perfetto/flow_event_utils.h"
+#include "third_party/blink/public/common/input/web_coalesced_input_event.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
+#include "third_party/blink/public/mojom/input/input_handler.mojom-shared.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/blink/blink_features.h"
#include "ui/events/blink/web_input_event_traits.h"
@@ -58,18 +59,23 @@ bool WasHandled(blink::mojom::InputEventResultState state) {
}
}
-std::unique_ptr<InputEvent> ScaleEvent(const WebInputEvent& event,
- double scale,
- const ui::LatencyInfo& latency_info) {
+std::unique_ptr<blink::WebCoalescedInputEvent> ScaleEvent(
+ const WebInputEvent& event,
+ double scale,
+ const ui::LatencyInfo& latency_info) {
std::unique_ptr<blink::WebInputEvent> event_in_viewport =
ui::ScaleWebInputEvent(event, scale);
if (event_in_viewport) {
- return std::make_unique<InputEvent>(
- ui::WebScopedInputEvent(event_in_viewport.release()),
+ return std::make_unique<blink::WebCoalescedInputEvent>(
+ std::move(event_in_viewport),
+ std::vector<std::unique_ptr<WebInputEvent>>(),
+ std::vector<std::unique_ptr<WebInputEvent>>(),
latency_info.ScaledBy(scale));
}
- return std::make_unique<InputEvent>(event.Clone(), latency_info);
+ return std::make_unique<blink::WebCoalescedInputEvent>(
+ event.Clone(), std::vector<std::unique_ptr<WebInputEvent>>(),
+ std::vector<std::unique_ptr<WebInputEvent>>(), latency_info);
}
} // namespace
@@ -128,7 +134,7 @@ void InputRouterImpl::SendKeyboardEvent(
const NativeWebKeyboardEventWithLatencyInfo& key_event,
KeyboardEventCallback event_result_callback) {
gesture_event_queue_.StopFling();
- mojom::WidgetInputHandler::DispatchEventCallback callback =
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
base::BindOnce(&InputRouterImpl::KeyboardEventHandled, weak_this_,
key_event, std::move(event_result_callback));
FilterAndSendWebInputEvent(key_event.event, key_event.latency,
@@ -250,18 +256,12 @@ base::Optional<cc::TouchAction> InputRouterImpl::ActiveTouchAction() {
return touch_action_filter_.active_touch_action();
}
-mojo::PendingRemote<mojom::WidgetInputHandlerHost>
+mojo::PendingRemote<blink::mojom::WidgetInputHandlerHost>
InputRouterImpl::BindNewHost() {
host_receiver_.reset();
return host_receiver_.BindNewPipeAndPassRemote();
}
-mojo::PendingRemote<mojom::WidgetInputHandlerHost>
-InputRouterImpl::BindNewFrameHost() {
- frame_host_receiver_.reset();
- return frame_host_receiver_.BindNewPipeAndPassRemote();
-}
-
void InputRouterImpl::StopFling() {
gesture_event_queue_.StopFling();
}
@@ -286,12 +286,12 @@ void InputRouterImpl::SetTouchActionFromMain(cc::TouchAction touch_action) {
UpdateTouchAckTimeoutEnabled();
}
-void InputRouterImpl::OnSetWhiteListedTouchAction(
+void InputRouterImpl::OnSetCompositorAllowedTouchAction(
cc::TouchAction touch_action) {
- TRACE_EVENT1("input", "InputRouterImpl::OnSetWhiteListedTouchAction",
+ TRACE_EVENT1("input", "InputRouterImpl::OnSetCompositorAllowedTouchAction",
"action", cc::TouchActionToString(touch_action));
- touch_action_filter_.OnSetWhiteListedTouchAction(touch_action);
- client_->OnSetWhiteListedTouchAction(touch_action);
+ touch_action_filter_.OnSetCompositorAllowedTouchAction(touch_action);
+ client_->OnSetCompositorAllowedTouchAction(touch_action);
if (touch_action == cc::TouchAction::kAuto)
FlushDeferredGestureQueue();
UpdateTouchAckTimeoutEnabled();
@@ -370,7 +370,7 @@ void InputRouterImpl::SetMovementXYForTouchPoints(blink::WebTouchEvent* event) {
void InputRouterImpl::SendMouseEventImmediately(
const MouseEventWithLatencyInfo& mouse_event,
MouseEventCallback event_result_callback) {
- mojom::WidgetInputHandler::DispatchEventCallback callback =
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
base::BindOnce(&InputRouterImpl::MouseEventHandled, weak_this_,
mouse_event, std::move(event_result_callback));
FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency,
@@ -379,8 +379,9 @@ void InputRouterImpl::SendMouseEventImmediately(
void InputRouterImpl::SendTouchEventImmediately(
const TouchEventWithLatencyInfo& touch_event) {
- mojom::WidgetInputHandler::DispatchEventCallback callback = base::BindOnce(
- &InputRouterImpl::TouchEventHandled, weak_this_, touch_event);
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
+ base::BindOnce(&InputRouterImpl::TouchEventHandled, weak_this_,
+ touch_event);
FilterAndSendWebInputEvent(touch_event.event, touch_event.latency,
std::move(callback));
}
@@ -427,8 +428,9 @@ void InputRouterImpl::OnFilteringTouchEvent(const WebTouchEvent& touch_event) {
void InputRouterImpl::SendGestureEventImmediately(
const GestureEventWithLatencyInfo& gesture_event) {
- mojom::WidgetInputHandler::DispatchEventCallback callback = base::BindOnce(
- &InputRouterImpl::GestureEventHandled, weak_this_, gesture_event);
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
+ base::BindOnce(&InputRouterImpl::GestureEventHandled, weak_this_,
+ gesture_event);
FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency,
std::move(callback));
}
@@ -461,7 +463,7 @@ void InputRouterImpl::SendMouseWheelEventImmediately(
const MouseWheelEventWithLatencyInfo& wheel_event,
MouseWheelEventQueueClient::MouseWheelEventHandledCallback
callee_callback) {
- mojom::WidgetInputHandler::DispatchEventCallback callback =
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
base::BindOnce(&InputRouterImpl::MouseWheelEventHandled, weak_this_,
wheel_event, std::move(callee_callback));
FilterAndSendWebInputEvent(wheel_event.event, wheel_event.latency,
@@ -506,7 +508,7 @@ bool InputRouterImpl::IsAutoscrollInProgress() {
void InputRouterImpl::FilterAndSendWebInputEvent(
const WebInputEvent& input_event,
const ui::LatencyInfo& latency_info,
- mojom::WidgetInputHandler::DispatchEventCallback callback) {
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback) {
TRACE_EVENT1("input", "InputRouterImpl::FilterAndSendWebInputEvent", "type",
WebInputEvent::GetName(input_event.GetType()));
TRACE_EVENT("input,benchmark,devtools.timeline", "LatencyInfo.Flow",
@@ -537,15 +539,15 @@ void InputRouterImpl::FilterAndSendWebInputEvent(
return;
}
- std::unique_ptr<InputEvent> event =
+ std::unique_ptr<blink::WebCoalescedInputEvent> event =
ScaleEvent(input_event, device_scale_factor_, latency_info);
if (WebInputEventTraits::ShouldBlockEventStream(input_event)) {
TRACE_EVENT_INSTANT0("input", "InputEventSentBlocking",
TRACE_EVENT_SCOPE_THREAD);
client_->IncrementInFlightEventCount();
- mojom::WidgetInputHandler::DispatchEventCallback renderer_callback =
+ blink::mojom::WidgetInputHandler::DispatchEventCallback renderer_callback =
base::BindOnce(
- [](mojom::WidgetInputHandler::DispatchEventCallback callback,
+ [](blink::mojom::WidgetInputHandler::DispatchEventCallback callback,
base::WeakPtr<InputRouterImpl> input_router,
blink::mojom::InputEventResultSource source,
const ui::LatencyInfo& latency,
@@ -638,7 +640,7 @@ void InputRouterImpl::TouchEventHandled(
// time the ACK is handled.
if (touch_action) {
if (source == blink::mojom::InputEventResultSource::kCompositorThread)
- OnSetWhiteListedTouchAction(touch_action->touch_action);
+ OnSetCompositorAllowedTouchAction(touch_action->touch_action);
else if (source == blink::mojom::InputEventResultSource::kMainThread)
OnSetTouchAction(touch_action->touch_action);
else
@@ -759,12 +761,12 @@ void InputRouterImpl::UpdateTouchAckTimeoutEnabled() {
// to page functionality, so the timeout could do more harm than good.
base::Optional<cc::TouchAction> allowed_touch_action =
touch_action_filter_.allowed_touch_action();
- cc::TouchAction white_listed_touch_action =
- touch_action_filter_.white_listed_touch_action();
+ cc::TouchAction compositor_allowed_touch_action =
+ touch_action_filter_.compositor_allowed_touch_action();
const bool touch_ack_timeout_disabled =
(allowed_touch_action.has_value() &&
allowed_touch_action.value() == cc::TouchAction::kNone) ||
- (white_listed_touch_action == cc::TouchAction::kNone);
+ (compositor_allowed_touch_action == cc::TouchAction::kNone);
touch_event_queue_.SetAckTimeoutEnabled(!touch_ack_timeout_disabled);
}
diff --git a/chromium/content/browser/renderer_host/input/input_router_impl.h b/chromium/content/browser/renderer_host/input/input_router_impl.h
index 47961159c83..bb3186bb930 100644
--- a/chromium/content/browser/renderer_host/input/input_router_impl.h
+++ b/chromium/content/browser/renderer_host/input/input_router_impl.h
@@ -24,12 +24,11 @@
#include "content/browser/renderer_host/input/touch_action_filter.h"
#include "content/browser/renderer_host/input/touchpad_pinch_event_queue.h"
#include "content/common/input/input_event_stream_validator.h"
-#include "content/common/input/input_handler.mojom.h"
-#include "content/common/widget.mojom.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
+#include "third_party/blink/public/mojom/input/input_handler.mojom.h"
namespace ui {
class LatencyInfo;
@@ -43,7 +42,7 @@ class MockRenderWidgetHost;
class CONTENT_EXPORT InputRouterImplClient : public InputRouterClient {
public:
- virtual mojom::WidgetInputHandler* GetWidgetInputHandler() = 0;
+ virtual blink::mojom::WidgetInputHandler* GetWidgetInputHandler() = 0;
virtual void OnImeCancelComposition() = 0;
virtual void OnImeCompositionRangeChanged(
const gfx::Range& range,
@@ -51,13 +50,14 @@ class CONTENT_EXPORT InputRouterImplClient : public InputRouterClient {
};
// A default implementation for browser input event routing.
-class CONTENT_EXPORT InputRouterImpl : public InputRouter,
- public GestureEventQueueClient,
- public FlingControllerEventSenderClient,
- public MouseWheelEventQueueClient,
- public PassthroughTouchEventQueueClient,
- public TouchpadPinchEventQueueClient,
- public mojom::WidgetInputHandlerHost {
+class CONTENT_EXPORT InputRouterImpl
+ : public InputRouter,
+ public GestureEventQueueClient,
+ public FlingControllerEventSenderClient,
+ public MouseWheelEventQueueClient,
+ public PassthroughTouchEventQueueClient,
+ public TouchpadPinchEventQueueClient,
+ public blink::mojom::WidgetInputHandlerHost {
public:
InputRouterImpl(InputRouterImplClient* client,
InputDispositionHandler* disposition_handler,
@@ -82,8 +82,7 @@ class CONTENT_EXPORT InputRouterImpl : public InputRouter,
void SetForceEnableZoom(bool enabled) override;
base::Optional<cc::TouchAction> AllowedTouchAction() override;
base::Optional<cc::TouchAction> ActiveTouchAction() override;
- mojo::PendingRemote<mojom::WidgetInputHandlerHost> BindNewHost() override;
- mojo::PendingRemote<mojom::WidgetInputHandlerHost> BindNewFrameHost()
+ mojo::PendingRemote<blink::mojom::WidgetInputHandlerHost> BindNewHost()
override;
void StopFling() override;
void OnSetTouchAction(cc::TouchAction touch_action) override;
@@ -107,9 +106,9 @@ class CONTENT_EXPORT InputRouterImpl : public InputRouter,
void FlushTouchEventQueue() override;
// Exposed so that tests can swap out the implementation and intercept calls.
- mojo::Receiver<mojom::WidgetInputHandlerHost>&
- frame_host_receiver_for_testing() {
- return frame_host_receiver_;
+ mojo::Receiver<blink::mojom::WidgetInputHandlerHost>&
+ host_receiver_for_testing() {
+ return host_receiver_;
}
void ForceResetTouchActionForTest();
@@ -181,7 +180,7 @@ class CONTENT_EXPORT InputRouterImpl : public InputRouter,
void FilterAndSendWebInputEvent(
const blink::WebInputEvent& input_event,
const ui::LatencyInfo& latency_info,
- mojom::WidgetInputHandler::DispatchEventCallback callback);
+ blink::mojom::WidgetInputHandler::DispatchEventCallback callback);
void KeyboardEventHandled(const NativeWebKeyboardEventWithLatencyInfo& event,
KeyboardEventCallback event_result_callback,
@@ -229,7 +228,7 @@ class CONTENT_EXPORT InputRouterImpl : public InputRouter,
GestureEventWithLatencyInfo& gesture_event,
const FilterGestureEventResult& existing_result);
void ProcessDeferredGestureEventQueue();
- void OnSetWhiteListedTouchAction(cc::TouchAction touch_action);
+ void OnSetCompositorAllowedTouchAction(cc::TouchAction touch_action);
InputRouterImplClient* client_;
InputDispositionHandler* disposition_handler_;
@@ -254,11 +253,7 @@ class CONTENT_EXPORT InputRouterImpl : public InputRouter,
// The host receiver associated with the widget input handler from
// the widget.
- mojo::Receiver<mojom::WidgetInputHandlerHost> host_receiver_{this};
-
- // The host receiver associated with the widget input handler from
- // the frame.
- mojo::Receiver<mojom::WidgetInputHandlerHost> frame_host_receiver_{this};
+ mojo::Receiver<blink::mojom::WidgetInputHandlerHost> host_receiver_{this};
base::WeakPtr<InputRouterImpl> weak_this_;
base::WeakPtrFactory<InputRouterImpl> weak_ptr_factory_{this};
diff --git a/chromium/content/browser/renderer_host/input/input_router_impl_unittest.cc b/chromium/content/browser/renderer_host/input/input_router_impl_unittest.cc
index d70d6c359f8..9461366b199 100644
--- a/chromium/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -28,7 +28,6 @@
#include "content/browser/renderer_host/input/mock_input_disposition_handler.h"
#include "content/browser/renderer_host/input/mock_input_router_client.h"
#include "content/common/content_constants_internal.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/common/input_messages.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
@@ -36,6 +35,7 @@
#include "content/public/test/test_browser_context.h"
#include "content/test/mock_widget_input_handler.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/blink_features.h"
#include "ui/events/blink/web_input_event_traits.h"
@@ -50,10 +50,14 @@
#include "ui/display/win/test/scoped_screen_win.h"
#endif
+using blink::SyntheticWebGestureEventBuilder;
+using blink::SyntheticWebMouseEventBuilder;
+using blink::SyntheticWebMouseWheelEventBuilder;
+using blink::SyntheticWebTouchEvent;
using blink::WebGestureDevice;
using blink::WebGestureEvent;
-using blink::WebKeyboardEvent;
using blink::WebInputEvent;
+using blink::WebKeyboardEvent;
using blink::WebMouseEvent;
using blink::WebMouseWheelEvent;
using blink::WebTouchEvent;
@@ -98,7 +102,7 @@ WebInputEvent& GetEventWithType(WebInputEvent::Type type) {
// of InputRouters.
class MockInputRouterImplClient : public InputRouterImplClient {
public:
- mojom::WidgetInputHandler* GetWidgetInputHandler() override {
+ blink::mojom::WidgetInputHandler* GetWidgetInputHandler() override {
return &widget_input_handler_;
}
@@ -110,11 +114,12 @@ class MockInputRouterImplClient : public InputRouterImplClient {
void SetMouseCapture(bool capture) override {}
- void RequestMouseLock(bool from_user_gesture,
- bool privileged,
- bool unadjusted_movement,
- mojom::WidgetInputHandlerHost::RequestMouseLockCallback
- response) override {}
+ void RequestMouseLock(
+ bool from_user_gesture,
+ bool privileged,
+ bool unadjusted_movement,
+ blink::mojom::WidgetInputHandlerHost::RequestMouseLockCallback response)
+ override {}
gfx::Size GetRootWidgetViewportSize() override {
return gfx::Size(1920, 1080);
@@ -171,8 +176,9 @@ class MockInputRouterImplClient : public InputRouterImplClient {
return input_router_client_.IsAutoscrollInProgress();
}
- void OnSetWhiteListedTouchAction(cc::TouchAction touch_action) override {
- input_router_client_.OnSetWhiteListedTouchAction(touch_action);
+ void OnSetCompositorAllowedTouchAction(
+ cc::TouchAction touch_action) override {
+ input_router_client_.OnSetCompositorAllowedTouchAction(touch_action);
}
bool GetAndResetFilterEventCalled() {
@@ -183,8 +189,8 @@ class MockInputRouterImplClient : public InputRouterImplClient {
return input_router_client_.GetAndResetOverscroll();
}
- cc::TouchAction GetAndResetWhiteListedTouchAction() {
- return input_router_client_.GetAndResetWhiteListedTouchAction();
+ cc::TouchAction GetAndResetCompositorAllowedTouchAction() {
+ return input_router_client_.GetAndResetCompositorAllowedTouchAction();
}
void set_input_router(InputRouter* input_router) {
@@ -474,7 +480,7 @@ class InputRouterImplTestBase : public testing::Test {
blink::mojom::InputEventResultSource source,
blink::mojom::InputEventResultState ack_state,
base::Optional<cc::TouchAction> expected_touch_action,
- base::Optional<cc::TouchAction> expected_white_listed_touch_action) {
+ base::Optional<cc::TouchAction> expected_allowed_touch_action) {
input_router_->OnHasTouchEventHandlers(true);
EXPECT_FALSE(input_router_->AllowedTouchAction().has_value());
PressTouchPoint(1, 1);
@@ -482,8 +488,9 @@ class InputRouterImplTestBase : public testing::Test {
input_router_->OnTouchEventAck(TouchEventWithLatencyInfo(touch_event_),
source, ack_state);
EXPECT_EQ(input_router_->AllowedTouchAction(), expected_touch_action);
- EXPECT_EQ(input_router_->touch_action_filter_.white_listed_touch_action(),
- expected_white_listed_touch_action.value());
+ EXPECT_EQ(
+ input_router_->touch_action_filter_.compositor_allowed_touch_action(),
+ expected_allowed_touch_action.value());
}
const float radius_x_ = 20.0f;
@@ -506,8 +513,8 @@ class InputRouterImplTest : public InputRouterImplTestBase {
return input_router_->touch_action_filter_.allowed_touch_action_;
}
- cc::TouchAction WhiteListedTouchAction() {
- return input_router_->touch_action_filter_.white_listed_touch_action_;
+ cc::TouchAction CompositorAllowedTouchAction() {
+ return input_router_->touch_action_filter_.compositor_allowed_touch_action_;
}
};
@@ -588,10 +595,10 @@ TEST_F(InputRouterImplTest, CoalescesWheelEvents) {
ASSERT_EQ(1u, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
ASSERT_EQ(WebInputEvent::Type::kMouseWheel,
- dispatched_messages[0]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
const WebMouseWheelEvent* wheel_event =
static_cast<const WebMouseWheelEvent*>(
- dispatched_messages[0]->ToEvent()->Event()->web_event.get());
+ &dispatched_messages[0]->ToEvent()->Event()->Event());
EXPECT_EQ(0, wheel_event->delta_x);
EXPECT_EQ(-5, wheel_event->delta_y);
@@ -607,9 +614,9 @@ TEST_F(InputRouterImplTest, CoalescesWheelEvents) {
ASSERT_EQ(1u, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
ASSERT_EQ(WebInputEvent::Type::kMouseWheel,
- dispatched_messages[0]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
wheel_event = static_cast<const WebMouseWheelEvent*>(
- dispatched_messages[0]->ToEvent()->Event()->web_event.get());
+ &dispatched_messages[0]->ToEvent()->Event()->Event());
EXPECT_EQ(8, wheel_event->delta_x);
EXPECT_EQ(-10 + -6, wheel_event->delta_y); // coalesced
@@ -622,9 +629,9 @@ TEST_F(InputRouterImplTest, CoalescesWheelEvents) {
ASSERT_EQ(1u, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
ASSERT_EQ(WebInputEvent::Type::kMouseWheel,
- dispatched_messages[0]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
wheel_event = static_cast<const WebMouseWheelEvent*>(
- dispatched_messages[0]->ToEvent()->Event()->web_event.get());
+ &dispatched_messages[0]->ToEvent()->Event()->Event());
EXPECT_EQ(9, wheel_event->delta_x);
EXPECT_EQ(-7, wheel_event->delta_y);
@@ -637,9 +644,9 @@ TEST_F(InputRouterImplTest, CoalescesWheelEvents) {
ASSERT_EQ(1u, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
ASSERT_EQ(WebInputEvent::Type::kMouseWheel,
- dispatched_messages[0]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
wheel_event = static_cast<const WebMouseWheelEvent*>(
- dispatched_messages[0]->ToEvent()->Event()->web_event.get());
+ &dispatched_messages[0]->ToEvent()->Event()->Event());
EXPECT_EQ(0, wheel_event->delta_x);
EXPECT_EQ(-10, wheel_event->delta_y);
@@ -652,9 +659,9 @@ TEST_F(InputRouterImplTest, CoalescesWheelEvents) {
ASSERT_EQ(1u, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
ASSERT_EQ(WebInputEvent::Type::kMouseWheel,
- dispatched_messages[0]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
wheel_event = static_cast<const WebMouseWheelEvent*>(
- dispatched_messages[0]->ToEvent()->Event()->web_event.get());
+ &dispatched_messages[0]->ToEvent()->Event()->Event());
EXPECT_EQ(0, wheel_event->delta_x);
EXPECT_EQ(0, wheel_event->delta_y);
EXPECT_EQ(WebMouseWheelEvent::kPhaseEnded, wheel_event->phase);
@@ -845,13 +852,13 @@ TEST_F(InputRouterImplTest, UnhandledWheelEvent) {
ASSERT_TRUE(dispatched_messages[2]->ToEvent());
ASSERT_TRUE(dispatched_messages[3]->ToEvent());
ASSERT_EQ(WebInputEvent::Type::kGestureScrollBegin,
- dispatched_messages[0]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
ASSERT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
- dispatched_messages[1]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[1]->ToEvent()->Event()->Event().GetType());
ASSERT_EQ(WebInputEvent::Type::kMouseWheel,
- dispatched_messages[2]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[2]->ToEvent()->Event()->Event().GetType());
ASSERT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
- dispatched_messages[3]->ToEvent()->Event()->web_event->GetType());
+ dispatched_messages[3]->ToEvent()->Event()->Event().GetType());
// Indicate that the GestureScrollBegin event was consumed.
dispatched_messages[0]->ToEvent()->CallCallback(
@@ -1620,6 +1627,9 @@ TEST_F(InputRouterImplTest, AsyncTouchMoveAckedImmediately) {
dispatched_messages[0]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kConsumed);
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
+ EXPECT_EQ(WebInputEvent::Type::kTouchStart,
+ disposition_handler_->ack_event_type());
+
SimulateGestureEvent(WebInputEvent::Type::kGestureScrollBegin,
blink::WebGestureDevice::kTouchscreen);
dispatched_messages = GetAndResetDispatchedMessages();
@@ -1628,14 +1638,55 @@ TEST_F(InputRouterImplTest, AsyncTouchMoveAckedImmediately) {
dispatched_messages[0]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kConsumed);
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
+ EXPECT_EQ(WebInputEvent::Type::kGestureScrollBegin,
+ disposition_handler_->ack_event_type());
+
SimulateGestureEvent(WebInputEvent::Type::kGestureScrollUpdate,
blink::WebGestureDevice::kTouchscreen);
EXPECT_EQ(0U, disposition_handler_->GetAndResetAckCount());
- EXPECT_EQ(2U, GetAndResetDispatchedMessages().size());
+ dispatched_messages = GetAndResetDispatchedMessages();
+ EXPECT_EQ(2U, dispatched_messages.size());
+ EXPECT_EQ(WebInputEvent::Type::kTouchScrollStarted,
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
+ EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
+ dispatched_messages[1]->ToEvent()->Event()->Event().GetType());
+ // Ack the GestureScrollUpdate.
+ dispatched_messages[1]->ToEvent()->CallCallback(
+ blink::mojom::InputEventResultState::kConsumed);
+ EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
+ disposition_handler_->ack_event_type());
+ EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
- // Now send an async move.
+ // Now since we're scrolling send an async move.
MoveTouchPoint(0, 5, 5);
SendTouchEvent();
+ EXPECT_EQ(WebInputEvent::Type::kTouchMove,
+ disposition_handler_->ack_event_type());
+ EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
+ EXPECT_EQ(1U, GetAndResetDispatchedMessages().size());
+
+ // To catch crbug/1072364 send another scroll which returns kNoConsumerExists
+ // and ensure we're still async scrolling since we've already started the
+ // scroll.
+ SimulateGestureEvent(WebInputEvent::Type::kGestureScrollUpdate,
+ blink::WebGestureDevice::kTouchscreen);
+ EXPECT_EQ(0U, disposition_handler_->GetAndResetAckCount());
+ dispatched_messages = GetAndResetDispatchedMessages();
+ EXPECT_EQ(1U, dispatched_messages.size());
+ EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
+ dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
+ // Ack the GestureScrollUpdate.
+ dispatched_messages[0]->ToEvent()->CallCallback(
+ blink::mojom::InputEventResultState::kNoConsumerExists);
+ EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
+ disposition_handler_->ack_event_type());
+ EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
+
+ // Now since we're scrolling (even with NoConsumerExists) send an async move.
+ MoveTouchPoint(0, 10, 5);
+ SendTouchEvent();
+ EXPECT_EQ(WebInputEvent::Type::kTouchMove,
+ disposition_handler_->ack_event_type());
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
EXPECT_EQ(1U, GetAndResetDispatchedMessages().size());
}
@@ -1766,7 +1817,7 @@ TEST_P(TouchpadPinchInputRouterImplTest, TouchpadPinchUpdate) {
ASSERT_EQ(1U, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
const WebInputEvent* input_event =
- dispatched_messages[0]->ToEvent()->Event()->web_event.get();
+ &dispatched_messages[0]->ToEvent()->Event()->Event();
ASSERT_EQ(WebInputEvent::Type::kMouseWheel, input_event->GetType());
const WebMouseWheelEvent* synthetic_wheel =
static_cast<const WebMouseWheelEvent*>(input_event);
@@ -1800,7 +1851,7 @@ TEST_P(TouchpadPinchInputRouterImplTest, TouchpadPinchUpdate) {
dispatched_messages = GetAndResetDispatchedMessages();
ASSERT_EQ(1U, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
- input_event = dispatched_messages[0]->ToEvent()->Event()->web_event.get();
+ input_event = &dispatched_messages[0]->ToEvent()->Event()->Event();
ASSERT_EQ(WebInputEvent::Type::kMouseWheel, input_event->GetType());
synthetic_wheel = static_cast<const WebMouseWheelEvent*>(input_event);
EXPECT_EQ(blink::WebMouseWheelEvent::kPhaseChanged, synthetic_wheel->phase);
@@ -1840,7 +1891,7 @@ TEST_P(TouchpadPinchInputRouterImplTest, TouchpadPinchUpdate) {
dispatched_messages = GetAndResetDispatchedMessages();
ASSERT_EQ(1U, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
- input_event = dispatched_messages[0]->ToEvent()->Event()->web_event.get();
+ input_event = &dispatched_messages[0]->ToEvent()->Event()->Event();
ASSERT_EQ(WebInputEvent::Type::kMouseWheel, input_event->GetType());
synthetic_wheel = static_cast<const WebMouseWheelEvent*>(input_event);
EXPECT_EQ(blink::WebMouseWheelEvent::kPhaseEnded, synthetic_wheel->phase);
@@ -1870,7 +1921,7 @@ TEST_P(TouchpadPinchInputRouterImplTest, TouchpadPinchUpdate) {
dispatched_messages = GetAndResetDispatchedMessages();
ASSERT_EQ(1U, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
- input_event = dispatched_messages[0]->ToEvent()->Event()->web_event.get();
+ input_event = &dispatched_messages[0]->ToEvent()->Event()->Event();
ASSERT_EQ(WebInputEvent::Type::kMouseWheel, input_event->GetType());
synthetic_wheel = static_cast<const WebMouseWheelEvent*>(input_event);
EXPECT_TRUE(synthetic_wheel->GetModifiers() &
@@ -1899,7 +1950,7 @@ TEST_P(TouchpadPinchInputRouterImplTest, TouchpadPinchUpdate) {
dispatched_messages = GetAndResetDispatchedMessages();
ASSERT_EQ(1U, dispatched_messages.size());
ASSERT_TRUE(dispatched_messages[0]->ToEvent());
- input_event = dispatched_messages[0]->ToEvent()->Event()->web_event.get();
+ input_event = &dispatched_messages[0]->ToEvent()->Event()->Event();
ASSERT_EQ(WebInputEvent::Type::kMouseWheel, input_event->GetType());
synthetic_wheel = static_cast<const WebMouseWheelEvent*>(input_event);
EXPECT_EQ(blink::WebMouseWheelEvent::kPhaseChanged, synthetic_wheel->phase);
@@ -2094,9 +2145,10 @@ TEST_F(InputRouterImplTest, TouchActionInCallback) {
nullptr, blink::mojom::TouchActionOptional::New(cc::TouchAction::kPan));
ASSERT_EQ(1U, disposition_handler_->GetAndResetAckCount());
base::Optional<cc::TouchAction> allowed_touch_action = AllowedTouchAction();
- cc::TouchAction white_listed_touch_action = WhiteListedTouchAction();
+ cc::TouchAction compositor_allowed_touch_action =
+ CompositorAllowedTouchAction();
EXPECT_FALSE(allowed_touch_action.has_value());
- EXPECT_EQ(expected_touch_action.value(), white_listed_touch_action);
+ EXPECT_EQ(expected_touch_action.value(), compositor_allowed_touch_action);
}
// TODO(crbug.com/953547): enable this when the bug is fixed.
@@ -2123,7 +2175,7 @@ class InputRouterImplScaleEventTest : public InputRouterImplTestBase {
EXPECT_EQ(1u, dispatched_messages_.size());
return static_cast<const T*>(
- dispatched_messages_[0]->ToEvent()->Event()->web_event.get());
+ &dispatched_messages_[0]->ToEvent()->Event()->Event());
}
template <typename T>
@@ -2417,9 +2469,8 @@ class InputRouterImplScaleGestureEventTest
ASSERT_EQ(expected_types.size(), dispatched_messages_.size());
for (size_t i = 0; i < dispatched_messages_.size(); i++) {
ASSERT_TRUE(dispatched_messages_[i]->ToEvent());
- ASSERT_EQ(
- expected_types[i],
- dispatched_messages_[i]->ToEvent()->Event()->web_event->GetType());
+ ASSERT_EQ(expected_types[i],
+ dispatched_messages_[i]->ToEvent()->Event()->Event().GetType());
dispatched_messages_[i]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kConsumed);
}
diff --git a/chromium/content/browser/renderer_host/input/main_thread_event_queue_browsertest.cc b/chromium/content/browser/renderer_host/input/main_thread_event_queue_browsertest.cc
index 95cc5860200..f2518c5dcac 100644
--- a/chromium/content/browser/renderer_host/input/main_thread_event_queue_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/main_thread_event_queue_browsertest.cc
@@ -16,7 +16,6 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/common/input_messages.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -28,6 +27,7 @@
#include "content/public/test/hit_test_region_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/event_switches.h"
#include "ui/latency/latency_info.h"
@@ -117,12 +117,15 @@ class MainThreadEventQueueBrowserTest : public ContentBrowserTest {
blink::WebPointerProperties::Button::kLeft);
auto input_msg_watcher = std::make_unique<InputMsgWatcher>(
GetWidgetHost(), blink::WebInputEvent::Type::kMouseMove);
- GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseMove, 10, 10, 0));
- GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseMove, 15, 15, 0));
- GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseMove, 20, 25, 0));
+ GetWidgetHost()->ForwardMouseEvent(
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseMove, 10, 10, 0));
+ GetWidgetHost()->ForwardMouseEvent(
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseMove, 15, 15, 0));
+ GetWidgetHost()->ForwardMouseEvent(
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseMove, 20, 25, 0));
// Runs until we get the InputMsgAck callback.
EXPECT_EQ(blink::mojom::InputEventResultState::kConsumed,
@@ -145,7 +148,7 @@ class MainThreadEventQueueBrowserTest : public ContentBrowserTest {
}
void DoTouchMove() {
- SyntheticWebTouchEvent events[4];
+ blink::SyntheticWebTouchEvent events[4];
events[0].PressPoint(10, 10);
events[1].PressPoint(10, 10);
events[1].MovePoint(0, 20, 20);
diff --git a/chromium/content/browser/renderer_host/input/mock_input_router.cc b/chromium/content/browser/renderer_host/input/mock_input_router.cc
index 40557631617..22abfeeb336 100644
--- a/chromium/content/browser/renderer_host/input/mock_input_router.cc
+++ b/chromium/content/browser/renderer_host/input/mock_input_router.cc
@@ -45,16 +45,11 @@ base::Optional<cc::TouchAction> MockInputRouter::ActiveTouchAction() {
return cc::TouchAction::kAuto;
}
-mojo::PendingRemote<mojom::WidgetInputHandlerHost>
+mojo::PendingRemote<blink::mojom::WidgetInputHandlerHost>
MockInputRouter::BindNewHost() {
return mojo::NullRemote();
}
-mojo::PendingRemote<mojom::WidgetInputHandlerHost>
-MockInputRouter::BindNewFrameHost() {
- return mojo::NullRemote();
-}
-
void MockInputRouter::OnHasTouchEventHandlers(bool has_handlers) {
has_handlers_ = has_handlers;
}
diff --git a/chromium/content/browser/renderer_host/input/mock_input_router.h b/chromium/content/browser/renderer_host/input/mock_input_router.h
index 1e09ca7b05f..de9cd9972e3 100644
--- a/chromium/content/browser/renderer_host/input/mock_input_router.h
+++ b/chromium/content/browser/renderer_host/input/mock_input_router.h
@@ -44,8 +44,7 @@ class MockInputRouter : public InputRouter {
base::Optional<cc::TouchAction> AllowedTouchAction() override;
base::Optional<cc::TouchAction> ActiveTouchAction() override;
void SetForceEnableZoom(bool enabled) override {}
- mojo::PendingRemote<mojom::WidgetInputHandlerHost> BindNewHost() override;
- mojo::PendingRemote<mojom::WidgetInputHandlerHost> BindNewFrameHost()
+ mojo::PendingRemote<blink::mojom::WidgetInputHandlerHost> BindNewHost()
override;
void StopFling() override {}
void OnSetTouchAction(cc::TouchAction touch_action) override {}
diff --git a/chromium/content/browser/renderer_host/input/mock_input_router_client.cc b/chromium/content/browser/renderer_host/input/mock_input_router_client.cc
index 7c1102b7ad5..95c94ab58cc 100644
--- a/chromium/content/browser/renderer_host/input/mock_input_router_client.cc
+++ b/chromium/content/browser/renderer_host/input/mock_input_router_client.cc
@@ -5,7 +5,6 @@
#include "content/browser/renderer_host/input/mock_input_router_client.h"
#include "content/browser/renderer_host/input/input_router.h"
-#include "content/common/input/input_event.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::TimeDelta;
@@ -23,7 +22,7 @@ MockInputRouterClient::MockInputRouterClient()
in_flight_event_count_(0),
filter_state_(blink::mojom::InputEventResultState::kNotConsumed),
filter_input_event_called_(false),
- white_listed_touch_action_(cc::TouchAction::kAuto) {}
+ compositor_allowed_touch_action_(cc::TouchAction::kAuto) {}
MockInputRouterClient::~MockInputRouterClient() {}
@@ -31,7 +30,7 @@ blink::mojom::InputEventResultState MockInputRouterClient::FilterInputEvent(
const WebInputEvent& input_event,
const ui::LatencyInfo& latency_info) {
filter_input_event_called_ = true;
- last_filter_event_.reset(new InputEvent(input_event, latency_info));
+ last_filter_event_ = input_event.Clone();
return filter_state_;
}
@@ -49,9 +48,9 @@ void MockInputRouterClient::DidOverscroll(
overscroll_ = params;
}
-void MockInputRouterClient::OnSetWhiteListedTouchAction(
- cc::TouchAction white_listed_touch_action) {
- white_listed_touch_action_ = white_listed_touch_action;
+void MockInputRouterClient::OnSetCompositorAllowedTouchAction(
+ cc::TouchAction compositor_allowed_touch_action) {
+ compositor_allowed_touch_action_ = compositor_allowed_touch_action;
}
void MockInputRouterClient::DidStartScrollingViewport() {}
@@ -107,10 +106,11 @@ ui::DidOverscrollParams MockInputRouterClient::GetAndResetOverscroll() {
return overscroll;
}
-cc::TouchAction MockInputRouterClient::GetAndResetWhiteListedTouchAction() {
- cc::TouchAction white_listed_touch_action = white_listed_touch_action_;
- white_listed_touch_action_ = cc::TouchAction::kAuto;
- return white_listed_touch_action;
+cc::TouchAction
+MockInputRouterClient::GetAndResetCompositorAllowedTouchAction() {
+ cc::TouchAction allowed = compositor_allowed_touch_action_;
+ compositor_allowed_touch_action_ = cc::TouchAction::kAuto;
+ return allowed;
}
bool MockInputRouterClient::NeedsBeginFrameForFlingProgress() {
diff --git a/chromium/content/browser/renderer_host/input/mock_input_router_client.h b/chromium/content/browser/renderer_host/input/mock_input_router_client.h
index 333a84c6b58..4830d5a845d 100644
--- a/chromium/content/browser/renderer_host/input/mock_input_router_client.h
+++ b/chromium/content/browser/renderer_host/input/mock_input_router_client.h
@@ -11,7 +11,6 @@
#include "content/browser/renderer_host/input/fling_controller.h"
#include "content/browser/renderer_host/input/input_router_client.h"
-#include "content/common/input/input_event.h"
#include "ui/events/blink/did_overscroll_params.h"
namespace content {
@@ -32,7 +31,7 @@ class MockInputRouterClient : public InputRouterClient,
void DecrementInFlightEventCount(
blink::mojom::InputEventResultSource ack_source) override;
void DidOverscroll(const ui::DidOverscrollParams& params) override;
- void OnSetWhiteListedTouchAction(cc::TouchAction touch_action) override;
+ void OnSetCompositorAllowedTouchAction(cc::TouchAction touch_action) override;
void DidStartScrollingViewport() override;
void ForwardWheelEventWithLatencyInfo(
const blink::WebMouseWheelEvent& wheel_event,
@@ -43,17 +42,18 @@ class MockInputRouterClient : public InputRouterClient,
bool IsWheelScrollInProgress() override;
bool IsAutoscrollInProgress() override;
void SetMouseCapture(bool capture) override {}
- void RequestMouseLock(bool user_gesture,
- bool privileged,
- bool unadjusted_movement,
- mojom::WidgetInputHandlerHost::RequestMouseLockCallback
- response) override {}
+ void RequestMouseLock(
+ bool user_gesture,
+ bool privileged,
+ bool unadjusted_movement,
+ blink::mojom::WidgetInputHandlerHost::RequestMouseLockCallback response)
+ override {}
gfx::Size GetRootWidgetViewportSize() override;
void OnInvalidInputEventSource() override {}
bool GetAndResetFilterEventCalled();
ui::DidOverscrollParams GetAndResetOverscroll();
- cc::TouchAction GetAndResetWhiteListedTouchAction();
+ cc::TouchAction GetAndResetCompositorAllowedTouchAction();
void set_input_router(InputRouter* input_router) {
input_router_ = input_router;
@@ -72,7 +72,7 @@ class MockInputRouterClient : public InputRouterClient,
filter_state_ = blink::mojom::InputEventResultState::kNoConsumerExists;
}
const blink::WebInputEvent* last_filter_event() const {
- return last_filter_event_->web_event.get();
+ return last_filter_event_.get();
}
// FlingControllerSchedulerClient
@@ -89,11 +89,11 @@ class MockInputRouterClient : public InputRouterClient,
blink::mojom::InputEventResultState filter_state_;
bool filter_input_event_called_;
- std::unique_ptr<InputEvent> last_filter_event_;
+ std::unique_ptr<blink::WebInputEvent> last_filter_event_;
ui::DidOverscrollParams overscroll_;
- cc::TouchAction white_listed_touch_action_;
+ cc::TouchAction compositor_allowed_touch_action_;
bool is_wheel_scroll_in_progress_ = false;
};
diff --git a/chromium/content/browser/renderer_host/input/mouse_latency_browsertest.cc b/chromium/content/browser/renderer_host/input/mouse_latency_browsertest.cc
index cfc239f3fd6..d134d4d7673 100644
--- a/chromium/content/browser/renderer_host/input/mouse_latency_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/mouse_latency_browsertest.cc
@@ -78,12 +78,10 @@ class TracingRenderWidgetHost : public RenderWidgetHostImpl {
TracingRenderWidgetHost(RenderWidgetHostDelegate* delegate,
RenderProcessHost* process,
int32_t routing_id,
- mojo::PendingRemote<mojom::Widget> widget,
bool hidden)
: RenderWidgetHostImpl(delegate,
process,
routing_id,
- std::move(widget),
hidden,
std::make_unique<FrameTokenMessageQueue>()) {
}
@@ -112,10 +110,9 @@ class TracingRenderWidgetHostFactory : public RenderWidgetHostFactory {
RenderWidgetHostDelegate* delegate,
RenderProcessHost* process,
int32_t routing_id,
- mojo::PendingRemote<mojom::Widget> widget_interface,
bool hidden) override {
- return std::make_unique<TracingRenderWidgetHost>(
- delegate, process, routing_id, std::move(widget_interface), hidden);
+ return std::make_unique<TracingRenderWidgetHost>(delegate, process,
+ routing_id, hidden);
}
private:
diff --git a/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue.cc b/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue.cc
index 35da2e0a436..600af684d53 100644
--- a/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue.cc
+++ b/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue.cc
@@ -8,7 +8,6 @@
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "content/common/input/input_event_dispatch_type.h"
-#include "content/common/input/web_mouse_wheel_event_traits.h"
#include "content/public/common/content_features.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/web_input_event_traits.h"
@@ -44,7 +43,8 @@ void MouseWheelEventQueue::QueueEvent(
// The deltas for the coalesced event change; the corresponding action
// might be different now.
last_event->event.event_action =
- WebMouseWheelEventTraits::GetEventAction(last_event->event);
+ WebMouseWheelEvent::GetPlatformSpecificDefaultEventAction(
+ last_event->event);
TRACE_EVENT_INSTANT2("input", "MouseWheelEventQueue::CoalescedWheelEvent",
TRACE_EVENT_SCOPE_THREAD, "total_dx",
last_event->event.delta_x, "total_dy",
@@ -55,7 +55,7 @@ void MouseWheelEventQueue::QueueEvent(
MouseWheelEventWithLatencyInfo event_with_action(event.event, event.latency);
event_with_action.event.event_action =
- WebMouseWheelEventTraits::GetEventAction(event.event);
+ WebMouseWheelEvent::GetPlatformSpecificDefaultEventAction(event.event);
// Update the expected event action before queuing the event. From this point
// on, the action should not change.
wheel_queue_.push_back(
diff --git a/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc b/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc
index 7d6707bfa28..a2452530a8d 100644
--- a/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc
@@ -17,8 +17,8 @@
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/input/timeout_monitor.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/base_event_utils.h"
@@ -254,7 +254,7 @@ class MouseWheelEventQueueTest : public testing::Test,
blink::WebMouseWheelEvent::Phase momentum_phase,
WebInputEvent::RailsMode rails_mode,
bool has_synthetic_phase = false) {
- WebMouseWheelEvent event = SyntheticWebMouseWheelEventBuilder::Build(
+ WebMouseWheelEvent event = blink::SyntheticWebMouseWheelEventBuilder::Build(
x, y, global_x, global_y, dX, dY, modifiers,
high_precision ? ui::ScrollGranularity::kScrollByPrecisePixel
: ui::ScrollGranularity::kScrollByPixel);
diff --git a/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue.cc b/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue.cc
index dcc3fdf2e21..558fc1872de 100644
--- a/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue.cc
+++ b/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue.cc
@@ -156,6 +156,7 @@ void PassthroughTouchEventQueue::ProcessTouchAck(
void PassthroughTouchEventQueue::OnGestureScrollEvent(
const GestureEventWithLatencyInfo& gesture_event) {
+ // Turn events sent during gesture scrolls to be async.
if (gesture_event.event.GetType() ==
blink::WebInputEvent::Type::kGestureScrollUpdate) {
send_touch_events_async_ = true;
@@ -165,11 +166,12 @@ void PassthroughTouchEventQueue::OnGestureScrollEvent(
void PassthroughTouchEventQueue::OnGestureEventAck(
const GestureEventWithLatencyInfo& event,
blink::mojom::InputEventResultState ack_result) {
- // Turn events sent during gesture scrolls to be async.
- if (event.event.GetType() ==
- blink::WebInputEvent::Type::kGestureScrollUpdate) {
- send_touch_events_async_ =
- (ack_result == blink::mojom::InputEventResultState::kConsumed);
+ // When the scroll finishes allow TouchEvents to be blocking again.
+ if (event.event.GetType() == blink::WebInputEvent::Type::kGestureScrollEnd) {
+ send_touch_events_async_ = false;
+ } else if (event.event.GetType() ==
+ blink::WebInputEvent::Type::kGestureScrollUpdate) {
+ send_touch_events_async_ = true;
}
}
diff --git a/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc b/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc
index b4c2e2df629..7f67166e2bf 100644
--- a/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc
@@ -19,13 +19,14 @@
#include "base/test/task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/renderer_host/input/timeout_monitor.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/common/input/web_touch_event_traits.h"
#include "content/public/common/content_features.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/base_event_utils.h"
+using blink::SyntheticWebTouchEvent;
using blink::WebGestureEvent;
using blink::WebInputEvent;
using blink::WebTouchEvent;
diff --git a/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
index 341e7a7d2dc..dd3766c4406 100644
--- a/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
+++ b/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
@@ -90,72 +90,6 @@ RenderWidgetHostLatencyTracker::RenderWidgetHostLatencyTracker(
RenderWidgetHostLatencyTracker::~RenderWidgetHostLatencyTracker() {}
-void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms(
- WebInputEvent::Type type,
- const LatencyInfo& latency,
- blink::mojom::InputEventResultState ack_result,
- base::TimeTicks ack_timestamp) {
- DCHECK(!ack_timestamp.is_null());
- // If this event was coalesced into another event, ignore it, as the event it
- // was coalesced into will reflect the full latency.
- if (latency.coalesced())
- return;
-
- if (latency.source_event_type() == ui::SourceEventType::UNKNOWN ||
- latency.source_event_type() == ui::SourceEventType::OTHER) {
- return;
- }
-
- // The event will have gone through OnInputEvent(). So the BEGIN_RWH component
- // should always be available here.
- base::TimeTicks rwh_timestamp;
- bool found_component = latency.FindLatency(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, &rwh_timestamp);
- DCHECK(found_component);
-
- bool multi_finger_touch_gesture =
- WebInputEvent::IsTouchEventType(type) && active_multi_finger_gesture_;
-
- bool action_prevented =
- ack_result == blink::mojom::InputEventResultState::kConsumed;
- // Touchscreen tap and scroll gestures depend on the disposition of the touch
- // start and the current touch. For touch start,
- // touch_start_default_prevented_ == (ack_result ==
- // blink::mojom::InputEventResultState::kConsumed).
- if (WebInputEvent::IsTouchEventType(type))
- action_prevented |= touch_start_default_prevented_;
-
- std::string event_name = WebInputEvent::GetName(type);
-
- if (latency.source_event_type() == ui::SourceEventType::KEY_PRESS) {
- event_name = "KeyPress";
- } else if (event_name != "TouchEnd" && event_name != "TouchMove" &&
- event_name != "TouchStart") {
- // Only log events we care about (that are documented in histograms.xml),
- // to avoid using memory and bandwidth for metrics that are not important.
- return;
- }
-
- std::string default_action_status =
- action_prevented ? "DefaultPrevented" : "DefaultAllowed";
-
- base::TimeTicks main_thread_timestamp;
- if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT,
- &main_thread_timestamp)) {
- if (!multi_finger_touch_gesture) {
- UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
- "Event.Latency.QueueingTime." + event_name + default_action_status,
- rwh_timestamp, main_thread_timestamp);
- }
- }
-
- if (!multi_finger_touch_gesture && !main_thread_timestamp.is_null()) {
- UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
- "Event.Latency.BlockingTime." + event_name + default_action_status,
- main_thread_timestamp, ack_timestamp);
- }
-}
-
void RenderWidgetHostLatencyTracker::OnInputEvent(
const blink::WebInputEvent& event,
LatencyInfo* latency) {
@@ -270,9 +204,6 @@ void RenderWidgetHostLatencyTracker::OnInputEventAck(
ack_result == blink::mojom::InputEventResultState::kNoConsumerExists)) {
latency->Terminate();
}
-
- ComputeInputLatencyHistograms(event.GetType(), *latency, ack_result,
- base::TimeTicks::Now());
}
void RenderWidgetHostLatencyTracker::OnEventStart(ui::LatencyInfo* latency) {
diff --git a/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.h b/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.h
index 5c88d696eea..e2528c10fb2 100644
--- a/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.h
+++ b/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker.h
@@ -27,12 +27,6 @@ class CONTENT_EXPORT RenderWidgetHostLatencyTracker {
explicit RenderWidgetHostLatencyTracker(RenderWidgetHostDelegate* delegate);
virtual ~RenderWidgetHostLatencyTracker();
- void ComputeInputLatencyHistograms(
- blink::WebInputEvent::Type type,
- const ui::LatencyInfo& latency,
- blink::mojom::InputEventResultState ack_result,
- base::TimeTicks ack_timestamp);
-
// Populates the LatencyInfo with relevant entries for latency tracking.
// Called when an event is received by the RenderWidgetHost, prior to
// that event being forwarded to the renderer (via the InputRouter).
diff --git a/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc b/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
index 64308c5f3db..574220301fa 100644
--- a/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
@@ -12,7 +12,6 @@
#include "build/build_config.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/common/content_client.h"
#include "content/test/test_content_browser_client.h"
@@ -21,6 +20,8 @@
#include "services/metrics/public/cpp/ukm_source.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
+#include "ui/events/base_event_utils.h"
using base::Bucket;
using blink::WebInputEvent;
@@ -190,7 +191,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestValidEventTiming) {
latency_info.AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_LATENCY_FRAME_SWAP_COMPONENT, now);
- viz_tracker()->OnGpuSwapBuffersCompleted(latency_info);
+ viz_tracker()->OnGpuSwapBuffersCompleted({latency_info});
// When last_event_time of the end_component is less than the first_event_time
// of the start_component, zero is recorded instead of a negative value.
@@ -232,7 +233,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
for (bool rendering_on_main : {false, true}) {
ResetHistograms();
{
- auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
+ auto wheel = blink::SyntheticWebMouseWheelEventBuilder::Build(
blink::WebMouseWheelEvent::kPhaseChanged);
base::TimeTicks now = base::TimeTicks::Now();
wheel.SetTimeStamp(now);
@@ -249,7 +250,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
tracker()->OnInputEventAck(
wheel, &wheel_latency,
blink::mojom::InputEventResultState::kNotConsumed);
- viz_tracker()->OnGpuSwapBuffersCompleted(wheel_latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({wheel_latency});
// UKM metrics.
total_ukm_entry_count++;
@@ -346,7 +347,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_TestWheelToScrollHistograms) {
for (bool rendering_on_main : {false, true}) {
ResetHistograms();
{
- auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
+ auto wheel = blink::SyntheticWebMouseWheelEventBuilder::Build(
blink::WebMouseWheelEvent::kPhaseChanged);
base::TimeTicks now = base::TimeTicks::Now();
wheel.SetTimeStamp(now);
@@ -363,7 +364,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_TestWheelToScrollHistograms) {
tracker()->OnInputEventAck(
wheel, &wheel_latency,
blink::mojom::InputEventResultState::kNotConsumed);
- viz_tracker()->OnGpuSwapBuffersCompleted(wheel_latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({wheel_latency});
// UKM metrics.
total_ukm_entry_count++;
@@ -458,7 +459,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
for (bool rendering_on_main : {false, true}) {
ResetHistograms();
{
- auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ auto scroll = blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
5.f, -5.f, 0, blink::WebGestureDevice::kTouchscreen);
base::TimeTicks now = base::TimeTicks::Now();
scroll.SetTimeStamp(now);
@@ -473,7 +474,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
tracker()->OnInputEventAck(
scroll, &scroll_latency,
blink::mojom::InputEventResultState::kNotConsumed);
- viz_tracker()->OnGpuSwapBuffersCompleted(scroll_latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({scroll_latency});
}
// UMA histograms.
@@ -524,7 +525,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
for (bool rendering_on_main : {false, true}) {
ResetHistograms();
{
- auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ auto scroll = blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
5.f, -5.f, 0, blink::WebGestureDevice::kTouchscreen);
base::TimeTicks now = base::TimeTicks::Now();
scroll.SetTimeStamp(now);
@@ -542,7 +543,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
}
{
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(0, 0);
touch.PressPoint(1, 1);
ui::LatencyInfo touch_latency(ui::SourceEventType::TOUCH);
@@ -561,7 +562,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
tracker()->OnInputEventAck(
touch, &touch_latency,
blink::mojom::InputEventResultState::kNotConsumed);
- viz_tracker()->OnGpuSwapBuffersCompleted(touch_latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({touch_latency});
}
// UKM metrics.
@@ -643,7 +644,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_TestTouchToScrollHistograms) {
for (bool rendering_on_main : {false, true}) {
ResetHistograms();
{
- auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ auto scroll = blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
5.f, -5.f, 0, blink::WebGestureDevice::kTouchscreen);
base::TimeTicks now = base::TimeTicks::Now();
scroll.SetTimeStamp(now);
@@ -661,7 +662,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_TestTouchToScrollHistograms) {
}
{
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(0, 0);
touch.PressPoint(1, 1);
ui::LatencyInfo touch_latency(ui::SourceEventType::TOUCH);
@@ -680,7 +681,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_TestTouchToScrollHistograms) {
tracker()->OnInputEventAck(
touch, &touch_latency,
blink::mojom::InputEventResultState::kNotConsumed);
- viz_tracker()->OnGpuSwapBuffersCompleted(touch_latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({touch_latency});
}
// UKM metrics.
@@ -756,7 +757,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_ScrollbarEndToEndHistograms) {
contents()->NavigateAndCommit(url);
ResetHistograms();
{
- auto mouse_move = SyntheticWebMouseEventBuilder::Build(
+ auto mouse_move = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebMouseEvent::Type::kMouseMove);
base::TimeTicks now = base::TimeTicks::Now();
@@ -779,7 +780,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_ScrollbarEndToEndHistograms) {
tracker()->OnInputEventAck(
mouse_move, &scrollbar_latency,
blink::mojom::InputEventResultState::kNotConsumed);
- viz_tracker()->OnGpuSwapBuffersCompleted(scrollbar_latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({scrollbar_latency});
}
}
}
@@ -811,7 +812,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, MAYBE_ScrollbarEndToEndHistograms) {
TEST_F(RenderWidgetHostLatencyTrackerTest,
LatencyTerminatedOnAckIfRenderingNotScheduled) {
{
- auto scroll = SyntheticWebGestureEventBuilder::BuildScrollBegin(
+ auto scroll = blink::SyntheticWebGestureEventBuilder::BuildScrollBegin(
5.f, -5.f, blink::WebGestureDevice::kTouchscreen);
ui::LatencyInfo scroll_latency;
AddFakeComponents(*tracker(), &scroll_latency);
@@ -825,7 +826,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
}
{
- auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
+ auto wheel = blink::SyntheticWebMouseWheelEventBuilder::Build(
blink::WebMouseWheelEvent::kPhaseChanged);
ui::LatencyInfo wheel_latency;
wheel_latency.set_source_event_type(ui::SourceEventType::WHEEL);
@@ -838,7 +839,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
}
{
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(0, 0);
ui::LatencyInfo touch_latency;
touch_latency.set_source_event_type(ui::SourceEventType::TOUCH);
@@ -851,7 +852,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
}
{
- auto mouse_move = SyntheticWebMouseEventBuilder::Build(
+ auto mouse_move = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebMouseEvent::Type::kMouseMove);
ui::LatencyInfo mouse_latency;
AddFakeComponents(*tracker(), &mouse_latency);
@@ -863,8 +864,10 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
}
{
- auto key_event = SyntheticWebKeyboardEventBuilder::Build(
- blink::WebKeyboardEvent::Type::kChar);
+ auto key_event = blink::WebKeyboardEvent(
+ blink::WebKeyboardEvent::Type::kChar, WebInputEvent::kNoModifiers,
+ ui::EventTimeForNow());
+ key_event.windows_key_code = ui::VKEY_L; // non-null made up value.
ui::LatencyInfo key_latency;
key_latency.set_source_event_type(ui::SourceEventType::KEY_PRESS);
AddFakeComponents(*tracker(), &key_latency);
@@ -895,7 +898,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, LatencyTerminatedOnAckIfGSUIgnored) {
{blink::WebGestureDevice::kTouchscreen,
blink::WebGestureDevice::kTouchpad}) {
for (bool rendering_on_main : {false, true}) {
- auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ auto scroll = blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
5.f, -5.f, 0, source_device);
base::TimeTicks now = base::TimeTicks::Now();
scroll.SetTimeStamp(now);
@@ -916,7 +919,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, LatencyTerminatedOnAckIfGSUIgnored) {
}
TEST_F(RenderWidgetHostLatencyTrackerTest, ScrollLatency) {
- auto scroll_begin = SyntheticWebGestureEventBuilder::BuildScrollBegin(
+ auto scroll_begin = blink::SyntheticWebGestureEventBuilder::BuildScrollBegin(
5, -5, blink::WebGestureDevice::kTouchscreen);
ui::LatencyInfo scroll_latency;
scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT);
@@ -927,8 +930,9 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, ScrollLatency) {
// The first GestureScrollUpdate should be provided with
// INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT.
- auto first_scroll_update = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
- 5.f, -5.f, 0, blink::WebGestureDevice::kTouchscreen);
+ auto first_scroll_update =
+ blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ 5.f, -5.f, 0, blink::WebGestureDevice::kTouchscreen);
scroll_latency = ui::LatencyInfo();
scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT);
tracker()->OnInputEvent(first_scroll_update, &scroll_latency);
@@ -944,8 +948,9 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, ScrollLatency) {
// Subsequent GestureScrollUpdates should be provided with
// INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT.
- auto scroll_update = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
- -5.f, 5.f, 0, blink::WebGestureDevice::kTouchscreen);
+ auto scroll_update =
+ blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ -5.f, 5.f, 0, blink::WebGestureDevice::kTouchscreen);
scroll_latency = ui::LatencyInfo();
scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT);
tracker()->OnInputEvent(scroll_update, &scroll_latency);
@@ -960,241 +965,6 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, ScrollLatency) {
EXPECT_EQ(4U, scroll_latency.latency_components().size());
}
-TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) {
- // These numbers are sensitive to where the histogram buckets are.
- int touchstart_timestamps_ms[] = {11, 25, 35};
- int touchmove_timestamps_ms[] = {1, 5, 12};
- int touchend_timestamps_ms[] = {3, 8, 12};
-
- for (blink::mojom::InputEventResultState blocking :
- {blink::mojom::InputEventResultState::kNotConsumed,
- blink::mojom::InputEventResultState::kConsumed}) {
- SyntheticWebTouchEvent event;
- {
- // Touch start.
- event.PressPoint(1, 1);
-
- ui::LatencyInfo latency;
- latency.set_source_event_type(ui::SourceEventType::TOUCH);
- tracker()->OnInputEvent(event, &latency);
-
- ui::LatencyInfo fake_latency;
- fake_latency.set_trace_id(kTraceEventId);
- fake_latency.set_source_event_type(ui::SourceEventType::TOUCH);
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[0]));
-
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1]));
-
- auto ack_timestamp =
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]);
-
- // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
- // overwriting components.
- tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
- blocking, ack_timestamp);
- tracker()->OnInputEventAck(event, &latency, blocking);
- }
-
- {
- // Touch move.
- ui::LatencyInfo latency;
- latency.set_source_event_type(ui::SourceEventType::TOUCH);
- event.MovePoint(0, 20, 20);
- tracker()->OnInputEvent(event, &latency);
-
- EXPECT_TRUE(latency.FindLatency(
- ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, nullptr));
- EXPECT_TRUE(latency.FindLatency(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, nullptr));
-
- EXPECT_EQ(2U, latency.latency_components().size());
-
- ui::LatencyInfo fake_latency;
- fake_latency.set_trace_id(kTraceEventId);
- fake_latency.set_source_event_type(ui::SourceEventType::TOUCH);
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[0]));
-
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[1]));
-
- auto ack_timestamp =
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]);
-
- // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
- // overwriting components.
- tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
- blocking, ack_timestamp);
- }
-
- {
- // Touch end.
- ui::LatencyInfo latency;
- latency.set_source_event_type(ui::SourceEventType::TOUCH);
- event.ReleasePoint(0);
- tracker()->OnInputEvent(event, &latency);
-
- EXPECT_TRUE(latency.FindLatency(
- ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, nullptr));
- EXPECT_TRUE(latency.FindLatency(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, nullptr));
-
- EXPECT_EQ(2U, latency.latency_components().size());
-
- ui::LatencyInfo fake_latency;
- fake_latency.set_trace_id(kTraceEventId);
- fake_latency.set_source_event_type(ui::SourceEventType::TOUCH);
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[0]));
-
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[1]));
-
- auto ack_timestamp =
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]);
-
- // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
- // overwriting components.
- tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
- blocking, ack_timestamp);
- }
- }
-
- // Touch start.
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchStartDefaultPrevented"),
- ElementsAre(Bucket(
- touchstart_timestamps_ms[1] - touchstart_timestamps_ms[0], 1)));
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchStartDefaultAllowed"),
- ElementsAre(Bucket(
- touchstart_timestamps_ms[1] - touchstart_timestamps_ms[0], 1)));
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.TouchStartDefaultPrevented"),
- ElementsAre(Bucket(
- touchstart_timestamps_ms[2] - touchstart_timestamps_ms[1], 1)));
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.TouchStartDefaultAllowed"),
- ElementsAre(Bucket(
- touchstart_timestamps_ms[2] - touchstart_timestamps_ms[1], 1)));
-
- // Touch move.
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchMoveDefaultPrevented"),
- ElementsAre(Bucket(
- touchmove_timestamps_ms[1] - touchmove_timestamps_ms[0], 1)));
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchMoveDefaultAllowed"),
- ElementsAre(Bucket(
- touchmove_timestamps_ms[1] - touchmove_timestamps_ms[0], 1)));
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.TouchMoveDefaultPrevented"),
- ElementsAre(Bucket(
- touchmove_timestamps_ms[2] - touchmove_timestamps_ms[1], 1)));
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.TouchMoveDefaultAllowed"),
- ElementsAre(Bucket(
- touchmove_timestamps_ms[2] - touchmove_timestamps_ms[1], 1)));
-
- // Touch end.
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchEndDefaultPrevented"),
- ElementsAre(Bucket(
- touchend_timestamps_ms[1] - touchend_timestamps_ms[0], 1)));
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchEndDefaultAllowed"),
- ElementsAre(Bucket(
- touchend_timestamps_ms[1] - touchend_timestamps_ms[0], 1)));
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.TouchEndDefaultPrevented"),
- ElementsAre(Bucket(
- touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.TouchEndDefaultAllowed"),
- ElementsAre(Bucket(
- touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
-}
-
-TEST_F(RenderWidgetHostLatencyTrackerTest, KeyBlockingAndQueueingTime) {
- // These numbers are sensitive to where the histogram buckets are.
- int event_timestamps_ms[] = {11, 25, 35};
-
- for (blink::mojom::InputEventResultState blocking :
- {blink::mojom::InputEventResultState::kNotConsumed,
- blink::mojom::InputEventResultState::kConsumed}) {
- {
- NativeWebKeyboardEvent event(blink::WebKeyboardEvent::Type::kRawKeyDown,
- blink::WebInputEvent::kNoModifiers,
- base::TimeTicks::Now());
- ui::LatencyInfo latency_info;
- latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS);
- tracker()->OnInputEvent(event, &latency_info);
-
- ui::LatencyInfo fake_latency;
- fake_latency.set_trace_id(kTraceEventId);
- fake_latency.set_source_event_type(ui::SourceEventType::KEY_PRESS);
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(event_timestamps_ms[0]));
-
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(event_timestamps_ms[1]));
-
- auto ack_timestamp =
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(event_timestamps_ms[2]);
-
- // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
- // overwriting components.
- tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
- blocking, ack_timestamp);
-
- tracker()->OnInputEventAck(event, &latency_info, blocking);
- }
- }
-
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.KeyPressDefaultPrevented"),
- ElementsAre(Bucket(event_timestamps_ms[1] - event_timestamps_ms[0], 1)));
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.KeyPressDefaultAllowed"),
- ElementsAre(Bucket(event_timestamps_ms[1] - event_timestamps_ms[0], 1)));
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.KeyPressDefaultPrevented"),
- ElementsAre(Bucket(event_timestamps_ms[2] - event_timestamps_ms[1], 1)));
- EXPECT_THAT(
- histogram_tester().GetAllSamples(
- "Event.Latency.BlockingTime.KeyPressDefaultAllowed"),
- ElementsAre(Bucket(event_timestamps_ms[2] - event_timestamps_ms[1], 1)));
-}
-
TEST_F(RenderWidgetHostLatencyTrackerTest, KeyEndToEndLatency) {
// These numbers are sensitive to where the histogram buckets are.
int event_timestamps_microseconds[] = {11, 24};
@@ -1222,7 +992,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, KeyEndToEndLatency) {
base::TimeTicks() +
base::TimeDelta::FromMicroseconds(event_timestamps_microseconds[1]));
- viz_tracker()->OnGpuSwapBuffersCompleted(latency_info);
+ viz_tracker()->OnGpuSwapBuffersCompleted({latency_info});
EXPECT_THAT(
histogram_tester().GetAllSamples("Event.Latency.EndToEnd.KeyPress"),
@@ -1231,58 +1001,6 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, KeyEndToEndLatency) {
1)));
}
-// Event.Latency.(Queueing|Blocking)Time.* histograms shouldn't be reported for
-// multi-finger touch.
-TEST_F(RenderWidgetHostLatencyTrackerTest,
- MultiFingerTouchIgnoredForQueueingAndBlockingTimeMetrics) {
- SyntheticWebTouchEvent event;
- blink::mojom::InputEventResultState ack_state =
- blink::mojom::InputEventResultState::kNotConsumed;
-
- {
- // First touch start.
- ui::LatencyInfo latency;
- event.PressPoint(1, 1);
- tracker()->OnInputEvent(event, &latency);
- tracker()->OnInputEventAck(event, &latency, ack_state);
- }
-
- {
- // Additional touch start will be ignored for queueing and blocking time
- // metrics.
- int touchstart_timestamps_ms[] = {11, 25, 35};
- ui::LatencyInfo latency;
- event.PressPoint(1, 1);
- tracker()->OnInputEvent(event, &latency);
-
- ui::LatencyInfo fake_latency;
- fake_latency.set_trace_id(kTraceEventId);
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[0]));
-
- fake_latency.AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT,
- base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1]));
-
- auto ack_timestamp = base::TimeTicks() + base::TimeDelta::FromMilliseconds(
- touchstart_timestamps_ms[2]);
-
- // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
- // overwriting components.
- tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
- ack_state, ack_timestamp);
-
- tracker()->OnInputEventAck(event, &latency, ack_state);
- }
-
- EXPECT_THAT(histogram_tester().GetAllSamples(
- "Event.Latency.QueueingTime.TouchStartDefaultAllowed"),
- ElementsAre());
-}
-
TEST_F(RenderWidgetHostLatencyTrackerTest, TouchpadPinchEvents) {
ui::LatencyInfo latency;
latency.set_trace_id(kTraceEventId);
@@ -1296,7 +1014,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchpadPinchEvents) {
AddFakeComponentsWithTimeStamp(
*tracker(), &latency,
base::TimeTicks() + base::TimeDelta::FromMilliseconds(5));
- viz_tracker()->OnGpuSwapBuffersCompleted(latency);
+ viz_tracker()->OnGpuSwapBuffersCompleted({latency});
EXPECT_TRUE(HistogramSizeEq("Event.Latency.EventToRender.TouchpadPinch", 1));
EXPECT_TRUE(HistogramSizeEq("Event.Latency.EndToEnd.TouchpadPinch", 1));
diff --git a/chromium/content/browser/renderer_host/input/scroll_latency_browsertest.cc b/chromium/content/browser/renderer_host/input/scroll_latency_browsertest.cc
index 4474ae7c66c..32aa02b70fa 100644
--- a/chromium/content/browser/renderer_host/input/scroll_latency_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/scroll_latency_browsertest.cc
@@ -28,6 +28,7 @@
#include "content/public/test/hit_test_region_observer.h"
#include "content/shell/browser/shell.h"
#include "third_party/blink/public/common/features.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/base/ui_base_features.h"
#include "ui/native_theme/native_theme_features.h"
@@ -125,7 +126,7 @@ class ScrollLatencyBrowserTest : public ContentBrowserTest {
// which support it.
void DoSmoothWheelScroll(const gfx::Vector2d& distance) {
blink::WebGestureEvent event =
- SyntheticWebGestureEventBuilder::BuildScrollBegin(
+ blink::SyntheticWebGestureEventBuilder::BuildScrollBegin(
distance.x(), -distance.y(), blink::WebGestureDevice::kTouchpad, 1);
event.data.scroll_begin.delta_hint_units =
ui::ScrollGranularity::kScrollByPixel;
@@ -144,7 +145,7 @@ class ScrollLatencyBrowserTest : public ContentBrowserTest {
base::Unretained(this)));
blink::WebGestureEvent event2 =
- SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ blink::SyntheticWebGestureEventBuilder::BuildScrollUpdate(
distance.x(), -distance.y(), 0,
blink::WebGestureDevice::kTouchpad);
event2.data.scroll_update.delta_units =
@@ -354,9 +355,10 @@ class ScrollLatencyScrollbarBrowserTest : public ScrollLatencyBrowserTest {
// Click on the forward scrollbar button to induce a compositor thread
// scrollbar scroll.
gfx::PointF scrollbar_forward_button(795, 595);
- blink::WebMouseEvent mouse_event = SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseDown, scrollbar_forward_button.x(),
- scrollbar_forward_button.y(), 0);
+ blink::WebMouseEvent mouse_event =
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseDown,
+ scrollbar_forward_button.x(), scrollbar_forward_button.y(), 0);
mouse_event.button = blink::WebMouseEvent::Button::kLeft;
mouse_event.SetTimeStamp(base::TimeTicks::Now());
GetWidgetHost()->ForwardMouseEvent(mouse_event);
@@ -395,9 +397,10 @@ class ScrollLatencyScrollbarBrowserTest : public ScrollLatencyBrowserTest {
// Click on the scrollbar thumb and drag it twice to induce a compositor
// thread scrollbar ScrollBegin and ScrollUpdate.
gfx::PointF scrollbar_thumb(795, 30);
- blink::WebMouseEvent mouse_down = SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseDown, scrollbar_thumb.x(),
- scrollbar_thumb.y(), 0);
+ blink::WebMouseEvent mouse_down =
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseDown, scrollbar_thumb.x(),
+ scrollbar_thumb.y(), 0);
mouse_down.button = blink::WebMouseEvent::Button::kLeft;
mouse_down.SetTimeStamp(base::TimeTicks::Now());
GetWidgetHost()->ForwardMouseEvent(mouse_down);
@@ -411,9 +414,10 @@ class ScrollLatencyScrollbarBrowserTest : public ScrollLatencyBrowserTest {
// and this can lead to nullptr derefernces.
RunUntilInputProcessed(GetWidgetHost());
- blink::WebMouseEvent mouse_move = SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseMove, scrollbar_thumb.x(),
- scrollbar_thumb.y() + 10, 0);
+ blink::WebMouseEvent mouse_move =
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseMove, scrollbar_thumb.x(),
+ scrollbar_thumb.y() + 10, 0);
mouse_move.button = blink::WebMouseEvent::Button::kLeft;
mouse_move.SetTimeStamp(base::TimeTicks::Now());
GetWidgetHost()->ForwardMouseEvent(mouse_move);
@@ -426,7 +430,7 @@ class ScrollLatencyScrollbarBrowserTest : public ScrollLatencyBrowserTest {
GetWidgetHost()->ForwardMouseEvent(mouse_move);
RunUntilInputProcessed(GetWidgetHost());
- blink::WebMouseEvent mouse_up = SyntheticWebMouseEventBuilder::Build(
+ blink::WebMouseEvent mouse_up = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseUp, scrollbar_thumb.x(),
scrollbar_thumb.y() + 20, 0);
mouse_up.button = blink::WebMouseEvent::Button::kLeft;
diff --git a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.cc b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.cc
index a42e5b53dad..871e9ec34d8 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.cc
@@ -38,8 +38,8 @@ SyntheticGestureTargetAndroid::SyntheticGestureTargetAndroid(
SyntheticGestureTargetAndroid::~SyntheticGestureTargetAndroid() = default;
void SyntheticGestureTargetAndroid::TouchSetPointer(int index,
- int x,
- int y,
+ float x,
+ float y,
int id) {
TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer");
JNIEnv* env = base::android::AttachCurrentThread();
@@ -48,10 +48,10 @@ void SyntheticGestureTargetAndroid::TouchSetPointer(int index,
env, java_ref_, index, x * scale_factor, y * scale_factor, id);
}
-void SyntheticGestureTargetAndroid::TouchSetScrollDeltas(int x,
- int y,
- int dx,
- int dy) {
+void SyntheticGestureTargetAndroid::TouchSetScrollDeltas(float x,
+ float y,
+ float dx,
+ float dy) {
TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetScrollDeltas");
JNIEnv* env = base::android::AttachCurrentThread();
diff --git a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.h b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.h
index 5f203ae19e4..6dbe2c79ae0 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_android.h
@@ -47,8 +47,8 @@ class SyntheticGestureTargetAndroid : public SyntheticGestureTargetBase {
float GetMinScalingSpanInDips() const override;
private:
- void TouchSetPointer(int index, int x, int y, int id);
- void TouchSetScrollDeltas(int x, int y, int dx, int dy);
+ void TouchSetPointer(int index, float x, float y, int id);
+ void TouchSetScrollDeltas(float x, float y, float dx, float dy);
void TouchInject(MotionEventAction action,
int pointer_count,
base::TimeTicks time);
diff --git a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
index ac603a8a1c5..93a1bd66115 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
@@ -90,10 +90,13 @@ void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
modifiers |= ui::EF_SCROLL_BY_PAGE;
}
+ float delta_x = web_wheel.delta_x + wheel_precision_x_;
+ float delta_y = web_wheel.delta_y + wheel_precision_y_;
ui::MouseWheelEvent wheel_event(
- gfx::Vector2d(web_wheel.delta_x, web_wheel.delta_y),
- web_wheel.PositionInWidget(), web_wheel.PositionInWidget(), timestamp,
- modifiers, ui::EF_NONE);
+ gfx::Vector2d(delta_x, delta_y), web_wheel.PositionInWidget(),
+ web_wheel.PositionInWidget(), timestamp, modifiers, ui::EF_NONE);
+ wheel_precision_x_ = delta_x - wheel_event.x_offset();
+ wheel_precision_y_ = delta_y - wheel_event.y_offset();
aura::Window* window = GetWindow();
wheel_event.ConvertLocationToTarget(window, window->GetRootWindow());
@@ -170,7 +173,7 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
SyntheticGestureParams::GestureSourceType
SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const {
- return SyntheticGestureParams::TOUCH_INPUT;
+ return SyntheticGestureParams::MOUSE_INPUT;
}
float SyntheticGestureTargetAura::GetTouchSlopInDips() const {
diff --git a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.h b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.h
index 3117e31ac3f..75b7fa52744 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_aura.h
@@ -58,6 +58,9 @@ class SyntheticGestureTargetAura : public SyntheticGestureTargetBase {
// before dispatching it into platform.
float device_scale_factor_;
+ float wheel_precision_x_ = 0.f;
+ float wheel_precision_y_ = 0.f;
+
aura::EventInjector event_injector_;
DISALLOW_COPY_AND_ASSIGN(SyntheticGestureTargetAura);
diff --git a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_base.cc b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_base.cc
index 6a357327057..2a7866fd9e8 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_gesture_target_base.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_gesture_target_base.cc
@@ -5,6 +5,7 @@
#include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/ui_events_helper.h"
#include "content/common/input_messages.h"
@@ -78,8 +79,16 @@ void SyntheticGestureTargetBase::DispatchInputEventToPlatform(
// from the ui::MouseWheelEvent. ui::MouseWheelEvent does
// not have a float value for delta, so that codepath ends up truncating.
// So instead, dispatch the WebMouseWheelEvent directly through the
- // RenderWidgetHostImpl.
- host_->ForwardWheelEventWithLatencyInfo(web_wheel, latency_info);
+ // RenderWidgetHostInputEventRouter attached to the RenderWidgetHostImpl.
+
+ DCHECK(host_->delegate());
+ DCHECK(host_->delegate()->IsWidgetForMainFrame(host_));
+ DCHECK(host_->delegate()->GetInputEventRouter());
+
+ std::unique_ptr<WebInputEvent> wheel_evt_ptr = web_wheel.Clone();
+ host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent(
+ host_->GetView(),
+ static_cast<WebMouseWheelEvent*>(wheel_evt_ptr.get()), latency_info);
}
} else if (WebInputEvent::IsMouseEventType(event.GetType())) {
const WebMouseEvent& web_mouse =
diff --git a/chromium/content/browser/renderer_host/input/synthetic_input_browsertest.cc b/chromium/content/browser/renderer_host/input/synthetic_input_browsertest.cc
index 39c9a8eda68..9a3c016fd6a 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_input_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_input_browsertest.cc
@@ -6,12 +6,12 @@
#include "base/callback.h"
#include "base/run_loop.h"
#include "base/test/test_timeouts.h"
+#include "build/build_config.h"
#include "cc/base/switches.h"
#include "content/browser/renderer_host/input/synthetic_gesture.h"
#include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/input/input_event.h"
#include "content/common/input/synthetic_gesture_params.h"
#include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
#include "content/public/browser/render_view_host.h"
@@ -93,9 +93,10 @@ IN_PROC_BROWSER_TEST_F(SyntheticInputTest, DestroyWidgetWithOngoingGesture) {
// By starting a gesture, there's a Mojo callback that the renderer is
// waiting on the browser to resolve. If the browser is shutdown before
// ACKing the callback or closing the channel, we'll DCHECK.
- ASSERT_TRUE(ExecJs(shell()->web_contents(),
- "chrome.gpuBenchmarking.smoothScrollBy(10000, ()=>{}, "
- "100, 100, chrome.gpuBenchmarking.TOUCH_INPUT);"));
+ ASSERT_TRUE(
+ ExecJs(shell()->web_contents(),
+ "chrome.gpuBenchmarking.smoothScrollByXY(0, 10000, ()=>{}, "
+ "100, 100, chrome.gpuBenchmarking.TOUCH_INPUT);"));
while (!gesture_observer.HasSeenGestureScrollBegin()) {
base::RunLoop run_loop;
@@ -134,7 +135,7 @@ IN_PROC_BROWSER_TEST_F(SyntheticInputTest, SmoothScrollWheel) {
// Use a speed that's fast enough that the entire scroll occurs in a single
// GSU, avoiding precision loss. SyntheticGestures can lose delta over time
- // in slower scrolls.
+ // in slower scrolls on some platforms.
params.speed_in_pixels_s = 10000000.f;
// Use PrecisePixel to avoid animating.
@@ -157,4 +158,57 @@ IN_PROC_BROWSER_TEST_F(SyntheticInputTest, SmoothScrollWheel) {
"document.scrollingElement.scrollTop"));
}
+// This test ensures that slow synthetic wheel scrolling does not lose precision
+// over time.
+IN_PROC_BROWSER_TEST_F(SyntheticInputTest, SlowSmoothScrollWheel) {
+ LoadURL(R"HTML(
+ data:text/html;charset=utf-8,
+ <!DOCTYPE html>
+ <meta name='viewport' content='width=device-width'>
+ <style>
+ body {
+ width: 10px;
+ height: 2000px;
+ }
+ </style>
+ <script>
+ document.title = 'ready';
+ </script>
+ )HTML");
+
+ SyntheticSmoothScrollGestureParams params;
+ params.gesture_source_type = SyntheticGestureParams::MOUSE_INPUT;
+ params.anchor = gfx::PointF(1, 1);
+
+ // Note: 1024 is precisely chosen since Android's minimum granularity is 64px.
+ // All other platforms can specify the delta per-pixel.
+ params.distances.push_back(gfx::Vector2d(0, -1024));
+
+ // Use a speed that's slow enough that it requires the browser to require
+ // multiple wheel-events to be dispatched, so that precision is needed to
+ // scroll the correct amount.
+ params.speed_in_pixels_s = 1000.f;
+
+ // Use PrecisePixel to avoid animating.
+ params.granularity = ui::ScrollGranularity::kScrollByPrecisePixel;
+
+ runner_ = std::make_unique<base::RunLoop>();
+
+ auto* web_contents = shell()->web_contents();
+ RenderFrameSubmissionObserver scroll_offset_wait(web_contents);
+ std::unique_ptr<SyntheticSmoothScrollGesture> gesture(
+ new SyntheticSmoothScrollGesture(params));
+ GetRenderWidgetHost()->QueueSyntheticGesture(
+ std::move(gesture),
+ base::BindOnce(&SyntheticInputTest::OnSyntheticGestureCompleted,
+ base::Unretained(this)));
+ float device_scale_factor =
+ web_contents->GetRenderWidgetHostView()->GetDeviceScaleFactor();
+ scroll_offset_wait.WaitForScrollOffset(
+ gfx::Vector2dF(0.f, 1024.f * device_scale_factor));
+
+ EXPECT_EQ(1024, EvalJs(shell()->web_contents(),
+ "document.scrollingElement.scrollTop"));
+}
+
} // namespace content
diff --git a/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.cc b/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.cc
index 44772997cfd..f8a4a16e8c2 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.cc
@@ -5,6 +5,7 @@
#include "content/browser/renderer_host/input/synthetic_mouse_driver.h"
#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
namespace content {
@@ -36,7 +37,7 @@ void SyntheticMouseDriver::Press(float x,
DCHECK_EQ(index, 0);
int modifiers =
SyntheticPointerActionParams::GetWebMouseEventModifier(button);
- mouse_event_ = SyntheticWebMouseEventBuilder::Build(
+ mouse_event_ = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseDown, x, y,
modifiers | key_modifiers | last_modifiers_, mouse_event_.pointer_type);
mouse_event_.button =
@@ -59,7 +60,7 @@ void SyntheticMouseDriver::Move(float x,
float rotation_angle,
float force) {
DCHECK_EQ(index, 0);
- mouse_event_ = SyntheticWebMouseEventBuilder::Build(
+ mouse_event_ = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, x, y,
key_modifiers | last_modifiers_, mouse_event_.pointer_type);
mouse_event_.button =
@@ -72,7 +73,7 @@ void SyntheticMouseDriver::Release(int index,
SyntheticPointerActionParams::Button button,
int key_modifiers) {
DCHECK_EQ(index, 0);
- mouse_event_ = SyntheticWebMouseEventBuilder::Build(
+ mouse_event_ = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseUp, mouse_event_.PositionInWidget().x(),
mouse_event_.PositionInWidget().y(), key_modifiers | last_modifiers_,
mouse_event_.pointer_type);
diff --git a/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.h b/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.h
index c08be40af11..145323f6f93 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_mouse_driver.h
@@ -8,7 +8,6 @@
#include "base/macros.h"
#include "content/browser/renderer_host/input/synthetic_pointer_driver.h"
#include "content/common/content_export.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
namespace content {
diff --git a/chromium/content/browser/renderer_host/input/synthetic_pen_driver.cc b/chromium/content/browser/renderer_host/input/synthetic_pen_driver.cc
index d848fe89f82..1733681fc74 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_pen_driver.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_pen_driver.cc
@@ -4,6 +4,8 @@
#include "content/browser/renderer_host/input/synthetic_pen_driver.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
+
namespace content {
SyntheticPenDriver::SyntheticPenDriver() : SyntheticMouseDriver() {
@@ -14,7 +16,7 @@ SyntheticPenDriver::~SyntheticPenDriver() {}
void SyntheticPenDriver::Leave(int index) {
DCHECK_EQ(index, 0);
- mouse_event_ = SyntheticWebMouseEventBuilder::Build(
+ mouse_event_ = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseLeave,
mouse_event_.PositionInWidget().x(), mouse_event_.PositionInWidget().y(),
last_modifiers_, mouse_event_.pointer_type);
diff --git a/chromium/content/browser/renderer_host/input/synthetic_pointer_driver.h b/chromium/content/browser/renderer_host/input/synthetic_pointer_driver.h
index 197489dc90e..94b3cf0f372 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_pointer_driver.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_pointer_driver.h
@@ -11,7 +11,6 @@
#include "content/common/content_export.h"
#include "content/common/input/synthetic_gesture_params.h"
#include "content/common/input/synthetic_pointer_action_params.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
namespace content {
diff --git a/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc b/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc
index e44ed3e504b..2216d73704c 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc
@@ -8,6 +8,7 @@
#include "base/check_op.h"
#include "base/notreached.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/gfx/geometry/point_f.h"
namespace content {
@@ -172,23 +173,6 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelInputEvents(
base::TimeTicks event_timestamp = ClampTimestamp(timestamp);
gfx::Vector2dF delta = GetPositionDeltaAtTime(event_timestamp) -
current_move_segment_total_delta_;
-
- // Android MotionEvents that carry mouse wheel ticks and the tick
- // granularity. Since it's not easy to change this granularity, it means
- // we can only scroll in terms of number of these ticks. Note also: if
- // the delta is smaller than one tick size we wont send an event or
- // accumulate it in current_move_segment_total_delta_ so that we don't
- // consider that delta applied. If we did, slow scrolls would be entirely
- // lost since we'd send 0 ticks in each event but assume delta was
- // applied.
- int pixels_per_wheel_tick = target->GetMouseWheelMinimumGranularity();
- if (pixels_per_wheel_tick) {
- int wheel_ticks_x = static_cast<int>(delta.x() / pixels_per_wheel_tick);
- int wheel_ticks_y = static_cast<int>(delta.y() / pixels_per_wheel_tick);
- delta = gfx::Vector2dF(wheel_ticks_x * pixels_per_wheel_tick,
- wheel_ticks_y * pixels_per_wheel_tick);
- }
-
if (delta.x() || delta.y()) {
blink::WebMouseWheelEvent::Phase phase =
needs_scroll_begin_ ? blink::WebMouseWheelEvent::kPhaseBegan
@@ -287,7 +271,7 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent(
const base::TimeTicks& timestamp,
int key_modifiers) const {
blink::WebMouseWheelEvent mouse_wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
0, 0, delta.x(), delta.y(), key_modifiers, params_.granularity);
mouse_wheel_event.SetPositionInWidget(
@@ -304,7 +288,7 @@ void SyntheticSmoothMoveGesture::ForwardFlingGestureEvent(
SyntheticGestureTarget* target,
const blink::WebInputEvent::Type type) const {
blink::WebGestureEvent fling_gesture_event =
- SyntheticWebGestureEventBuilder::Build(
+ blink::SyntheticWebGestureEventBuilder::Build(
type, blink::WebGestureDevice::kTouchpad);
fling_gesture_event.data.fling_start.velocity_x = params_.fling_velocity_x;
fling_gesture_event.data.fling_start.velocity_y = params_.fling_velocity_y;
diff --git a/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h b/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
index 3781656327b..7161ee78e43 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
@@ -16,6 +16,7 @@
#include "content/common/input/synthetic_smooth_drag_gesture_params.h"
#include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
#include "third_party/blink/public/common/input/web_input_event.h"
+#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "ui/events/types/scroll_types.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/geometry/vector2d_f.h"
diff --git a/chromium/content/browser/renderer_host/input/synthetic_tap_gesture.cc b/chromium/content/browser/renderer_host/input/synthetic_tap_gesture.cc
index ff92b5de359..8f790c52911 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_tap_gesture.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_tap_gesture.cc
@@ -17,6 +17,8 @@ SyntheticTapGesture::SyntheticTapGesture(
gesture_source_type_(SyntheticGestureParams::DEFAULT_INPUT),
state_(SETUP) {
DCHECK_GE(params_.duration_ms, 0);
+ if (params_.gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT)
+ params_.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
}
SyntheticTapGesture::~SyntheticTapGesture() {}
diff --git a/chromium/content/browser/renderer_host/input/synthetic_touch_driver.cc b/chromium/content/browser/renderer_host/input/synthetic_touch_driver.cc
index d8f8becfd07..4cacab90cc2 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_touch_driver.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_touch_driver.cc
@@ -10,7 +10,8 @@ namespace content {
SyntheticTouchDriver::SyntheticTouchDriver() {}
-SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event)
+SyntheticTouchDriver::SyntheticTouchDriver(
+ blink::SyntheticWebTouchEvent touch_event)
: touch_event_(touch_event) {}
SyntheticTouchDriver::~SyntheticTouchDriver() {}
diff --git a/chromium/content/browser/renderer_host/input/synthetic_touch_driver.h b/chromium/content/browser/renderer_host/input/synthetic_touch_driver.h
index 40445caad92..279134eccf3 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_touch_driver.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_touch_driver.h
@@ -9,14 +9,14 @@
#include "base/macros.h"
#include "content/browser/renderer_host/input/synthetic_pointer_driver.h"
#include "content/common/content_export.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
namespace content {
class CONTENT_EXPORT SyntheticTouchDriver : public SyntheticPointerDriver {
public:
SyntheticTouchDriver();
- explicit SyntheticTouchDriver(SyntheticWebTouchEvent touch_event);
+ explicit SyntheticTouchDriver(blink::SyntheticWebTouchEvent touch_event);
~SyntheticTouchDriver() override;
void DispatchEvent(SyntheticGestureTarget* target,
@@ -61,7 +61,7 @@ class CONTENT_EXPORT SyntheticTouchDriver : public SyntheticPointerDriver {
void ResetPointerIdIndexMap();
int GetIndexFromMap(int value) const;
- SyntheticWebTouchEvent touch_event_;
+ blink::SyntheticWebTouchEvent touch_event_;
PointerIdIndexMap pointer_id_map_;
DISALLOW_COPY_AND_ASSIGN(SyntheticTouchDriver);
diff --git a/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc b/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc
index bbb71098e8b..8a4d6be4173 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc
@@ -6,6 +6,7 @@
#include "base/callback.h"
#include "content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
namespace content {
namespace {
@@ -23,6 +24,11 @@ SyntheticTouchpadPinchGesture::SyntheticTouchpadPinchGesture(
state_(SETUP),
current_scale_(1.0f) {
DCHECK_GT(params_.scale_factor, 0.0f);
+ if (params_.gesture_source_type != SyntheticGestureParams::TOUCHPAD_INPUT) {
+ DCHECK_EQ(params_.gesture_source_type,
+ SyntheticGestureParams::DEFAULT_INPUT);
+ params_.gesture_source_type = SyntheticGestureParams::TOUCHPAD_INPUT;
+ }
}
SyntheticTouchpadPinchGesture::~SyntheticTouchpadPinchGesture() {}
@@ -73,7 +79,7 @@ void SyntheticTouchpadPinchGesture::ForwardGestureEvents(
// Send the start event.
target->DispatchInputEventToPlatform(
- SyntheticWebGestureEventBuilder::Build(
+ blink::SyntheticWebGestureEventBuilder::Build(
blink::WebGestureEvent::Type::kGesturePinchBegin,
blink::WebGestureDevice::kTouchpad));
state_ = IN_PROGRESS;
@@ -87,13 +93,13 @@ void SyntheticTouchpadPinchGesture::ForwardGestureEvents(
// Send the incremental scale event.
target->DispatchInputEventToPlatform(
- SyntheticWebGestureEventBuilder::BuildPinchUpdate(
+ blink::SyntheticWebGestureEventBuilder::BuildPinchUpdate(
incremental_scale, params_.anchor.x(), params_.anchor.y(),
0 /* modifierFlags */, blink::WebGestureDevice::kTouchpad));
if (HasReachedTarget(event_timestamp)) {
target->DispatchInputEventToPlatform(
- SyntheticWebGestureEventBuilder::Build(
+ blink::SyntheticWebGestureEventBuilder::Build(
blink::WebGestureEvent::Type::kGesturePinchEnd,
blink::WebGestureDevice::kTouchpad));
state_ = DONE;
diff --git a/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h b/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h
index 3a587439a7a..d66c0332361 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h
@@ -11,7 +11,7 @@
#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
#include "content/common/content_export.h"
#include "content/common/input/synthetic_pinch_gesture_params.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
namespace content {
diff --git a/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc b/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc
index d620a9f3a3b..f48eb3cf534 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc
+++ b/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc
@@ -23,6 +23,11 @@ SyntheticTouchscreenPinchGesture::SyntheticTouchscreenPinchGesture(
gesture_source_type_(SyntheticGestureParams::DEFAULT_INPUT),
state_(SETUP) {
DCHECK_GT(params_.scale_factor, 0.0f);
+ if (params_.gesture_source_type != SyntheticGestureParams::TOUCH_INPUT) {
+ DCHECK_EQ(params_.gesture_source_type,
+ SyntheticGestureParams::DEFAULT_INPUT);
+ params_.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
+ }
}
SyntheticTouchscreenPinchGesture::~SyntheticTouchscreenPinchGesture() {}
diff --git a/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h b/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h
index 2350eadab28..96547047512 100644
--- a/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h
+++ b/chromium/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h
@@ -12,7 +12,7 @@
#include "content/browser/renderer_host/input/synthetic_pointer_driver.h"
#include "content/common/content_export.h"
#include "content/common/input/synthetic_pinch_gesture_params.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
namespace content {
diff --git a/chromium/content/browser/renderer_host/input/touch_action_browsertest.cc b/chromium/content/browser/renderer_host/input/touch_action_browsertest.cc
index 4c0d99b042a..b56634b2283 100644
--- a/chromium/content/browser/renderer_host/input/touch_action_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/touch_action_browsertest.cc
@@ -346,11 +346,10 @@ class TouchActionBrowserTest : public ContentBrowserTest {
{ "name": "pointerUp"}]}]
)HTML";
- base::JSONReader json_reader;
- base::Optional<base::Value> params =
- json_reader.ReadToValue(pointer_actions_json);
- ASSERT_TRUE(params.has_value()) << json_reader.GetErrorMessage();
- ActionsParser actions_parser(std::move(params.value()));
+ base::JSONReader::ValueWithError parsed_json =
+ base::JSONReader::ReadAndReturnValueWithError(pointer_actions_json);
+ ASSERT_TRUE(parsed_json.value) << parsed_json.error_message;
+ ActionsParser actions_parser(std::move(*parsed_json.value));
ASSERT_TRUE(actions_parser.ParsePointerActionSequence());
@@ -385,11 +384,10 @@ class TouchActionBrowserTest : public ContentBrowserTest {
}]
)HTML";
- base::JSONReader json_reader;
- base::Optional<base::Value> params =
- json_reader.ReadToValue(pointer_actions_json);
- ASSERT_TRUE(params.has_value()) << json_reader.GetErrorMessage();
- ActionsParser actions_parser(std::move(params.value()));
+ base::JSONReader::ValueWithError parsed_json =
+ base::JSONReader::ReadAndReturnValueWithError(pointer_actions_json);
+ ASSERT_TRUE(parsed_json.value) << parsed_json.error_message;
+ ActionsParser actions_parser(std::move(*parsed_json.value));
ASSERT_TRUE(actions_parser.ParsePointerActionSequence());
diff --git a/chromium/content/browser/renderer_host/input/touch_action_filter.cc b/chromium/content/browser/renderer_host/input/touch_action_filter.cc
index 1398ad469d3..772db2e5fbf 100644
--- a/chromium/content/browser/renderer_host/input/touch_action_filter.cc
+++ b/chromium/content/browser/renderer_host/input/touch_action_filter.cc
@@ -9,7 +9,6 @@
#include "base/check_op.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
-#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
@@ -34,68 +33,6 @@ bool IsXAxisActionDisallowed(cc::TouchAction action) {
((action & cc::TouchAction::kPanX) == cc::TouchAction::kNone);
}
-// Report how often the gesture event is or is not dropped due to the current
-// allowed touch action state not matching the gesture event.
-void ReportGestureEventFiltered(bool event_filtered) {
- UMA_HISTOGRAM_BOOLEAN("TouchAction.GestureEventFiltered", event_filtered);
-}
-
-// These values are persisted to logs. Entries should not be renumbered and
-// numeric values should never be reused.
-enum class GestureEventFilterResults {
- kGSBAllowedByMain = 0,
- kGSBAllowedByCC = 1,
- kGSBFilteredByMain = 2,
- kGSBFilteredByCC = 3,
- kGSBDeferred = 4,
- kGSUAllowedByMain = 5,
- kGSUAllowedByCC = 6,
- kGSUFilteredByMain = 7,
- kGSUFilteredByCC = 8,
- kGSUDeferred = 9,
- kFilterResultsCount = 10,
- kMaxValue = kFilterResultsCount
-};
-
-void ReportGestureEventFilterResults(bool is_gesture_scroll_begin,
- bool active_touch_action_known,
- FilterGestureEventResult result) {
- GestureEventFilterResults report_type;
- if (is_gesture_scroll_begin) {
- if (result == FilterGestureEventResult::kFilterGestureEventAllowed) {
- if (active_touch_action_known)
- report_type = GestureEventFilterResults::kGSBAllowedByMain;
- else
- report_type = GestureEventFilterResults::kGSBAllowedByCC;
- } else if (result ==
- FilterGestureEventResult::kFilterGestureEventFiltered) {
- if (active_touch_action_known)
- report_type = GestureEventFilterResults::kGSBFilteredByMain;
- else
- report_type = GestureEventFilterResults::kGSBFilteredByCC;
- } else {
- report_type = GestureEventFilterResults::kGSBDeferred;
- }
- } else {
- if (result == FilterGestureEventResult::kFilterGestureEventAllowed) {
- if (active_touch_action_known)
- report_type = GestureEventFilterResults::kGSUAllowedByMain;
- else
- report_type = GestureEventFilterResults::kGSUAllowedByCC;
- } else if (result ==
- FilterGestureEventResult::kFilterGestureEventFiltered) {
- if (active_touch_action_known)
- report_type = GestureEventFilterResults::kGSUFilteredByMain;
- else
- report_type = GestureEventFilterResults::kGSUFilteredByCC;
- } else {
- report_type = GestureEventFilterResults::kGSUDeferred;
- }
- }
- UMA_HISTOGRAM_ENUMERATION("TouchAction.GestureEventFilterResults",
- report_type, GestureEventFilterResults::kMaxValue);
-}
-
} // namespace
TouchActionFilter::TouchActionFilter() {
@@ -112,13 +49,6 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
if (has_deferred_events_) {
TRACE_EVENT_INSTANT0("input", "Has Deferred", TRACE_EVENT_SCOPE_THREAD);
- WebInputEvent::Type type = gesture_event->GetType();
- if (type == WebInputEvent::Type::kGestureScrollBegin ||
- type == WebInputEvent::Type::kGestureScrollUpdate) {
- ReportGestureEventFilterResults(
- type == WebInputEvent::Type::kGestureScrollBegin, false,
- FilterGestureEventResult::kFilterGestureEventDelayed);
- }
return FilterGestureEventResult::kFilterGestureEventDelayed;
}
@@ -132,13 +62,13 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
(allowed_touch_action_.has_value()
? cc::TouchActionToString(allowed_touch_action_.value())
: "n/a"));
- TRACE_EVENT_INSTANT1("input", "whitelisted_action", TRACE_EVENT_SCOPE_THREAD,
- "action",
- cc::TouchActionToString(white_listed_touch_action_));
+ TRACE_EVENT_INSTANT1(
+ "input", "compositor_allowed_action", TRACE_EVENT_SCOPE_THREAD, "action",
+ cc::TouchActionToString(compositor_allowed_touch_action_));
cc::TouchAction touch_action = active_touch_action_.has_value()
? active_touch_action_.value()
- : white_listed_touch_action_;
+ : compositor_allowed_touch_action_;
// Filter for allowable touch actions first (eg. before the TouchEventQueue
// can decide to send a touch cancel event).
@@ -150,9 +80,8 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
// filtering out the GestureTapDown due to tap suppression (i.e. tapping
// during a fling should stop the fling, not be sent to the page). We
// should not reset the touch action in this case! We currently work
- // around this by resetting the whitelisted touch action from the
- // compositor in this case as well but we should investigate not
- // filtering the TapDown.
+ // around this by resetting the compositor allowed touch action in this
+ // case as well but we should investigate not filtering the TapDown.
if (!gesture_sequence_in_progress_) {
TRACE_EVENT_INSTANT0("input", "No Sequence at GSB!",
TRACE_EVENT_SCOPE_THREAD);
@@ -161,7 +90,7 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
active_touch_action_ = allowed_touch_action_;
touch_action = allowed_touch_action_.value();
} else {
- touch_action = white_listed_touch_action_;
+ touch_action = compositor_allowed_touch_action_;
}
}
drop_scroll_events_ =
@@ -177,17 +106,12 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
has_deferred_events_ = true;
res = FilterGestureEventResult::kFilterGestureEventDelayed;
}
- ReportGestureEventFilterResults(true, active_touch_action_.has_value(),
- res);
return res;
}
case WebInputEvent::Type::kGestureScrollUpdate: {
if (drop_scroll_events_) {
TRACE_EVENT_INSTANT0("input", "Drop Events", TRACE_EVENT_SCOPE_THREAD);
- ReportGestureEventFilterResults(
- false, active_touch_action_.has_value(),
- FilterGestureEventResult::kFilterGestureEventFiltered);
return FilterGestureEventResult::kFilterGestureEventFiltered;
}
@@ -206,9 +130,6 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
TRACE_EVENT_INSTANT0("input", "Defer Due to YAxis",
TRACE_EVENT_SCOPE_THREAD);
has_deferred_events_ = true;
- ReportGestureEventFilterResults(
- false, active_touch_action_.has_value(),
- FilterGestureEventResult::kFilterGestureEventDelayed);
return FilterGestureEventResult::kFilterGestureEventDelayed;
}
gesture_event->data.scroll_update.delta_y = 0;
@@ -219,17 +140,11 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
TRACE_EVENT_INSTANT0("input", "Defer Due to XAxis",
TRACE_EVENT_SCOPE_THREAD);
has_deferred_events_ = true;
- ReportGestureEventFilterResults(
- false, active_touch_action_.has_value(),
- FilterGestureEventResult::kFilterGestureEventDelayed);
return FilterGestureEventResult::kFilterGestureEventDelayed;
}
gesture_event->data.scroll_update.delta_x = 0;
gesture_event->data.scroll_update.velocity_x = 0;
}
- ReportGestureEventFilterResults(
- false, active_touch_action_.has_value(),
- FilterGestureEventResult::kFilterGestureEventAllowed);
break;
}
@@ -243,12 +158,12 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
if (gesture_sequence_.size() >= 1000)
gesture_sequence_.erase(gesture_sequence_.begin(),
gesture_sequence_.end() - 250);
- // Do not reset |white_listed_touch_action_|. In the fling cancel case,
- // the ack for the second touch sequence start, which sets the white
- // listed touch action, could arrive before the GSE of the first fling
- // sequence, we do not want to reset the white listed touch action.
+ // Do not reset |compositor_allowed_touch_action_|. In the fling cancel
+ // case, the ack for the second touch sequence start, which sets the
+ // compositor allowed touch action, could arrive before the GSE of the
+ // first fling sequence, we do not want to reset the compositor allowed
+ // touch action.
gesture_sequence_in_progress_ = false;
- ReportGestureEventFiltered(drop_scroll_events_);
return FilterScrollEventAndResetState();
// Evaluate the |drop_pinch_events_| here instead of GSB because pinch
@@ -267,7 +182,6 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
}
return FilterGestureEventResult::kFilterGestureEventFiltered;
case WebInputEvent::Type::kGesturePinchEnd:
- ReportGestureEventFiltered(drop_pinch_events_);
return FilterPinchEventAndResetState();
// The double tap gesture is a tap ending event. If a double-tap gesture is
@@ -361,7 +275,7 @@ void TouchActionFilter::SetTouchAction(cc::TouchAction touch_action) {
cc::TouchActionToString(touch_action));
allowed_touch_action_ = touch_action;
active_touch_action_ = allowed_touch_action_;
- white_listed_touch_action_ = touch_action;
+ compositor_allowed_touch_action_ = touch_action;
}
FilterGestureEventResult TouchActionFilter::FilterPinchEventAndResetState() {
@@ -434,33 +348,10 @@ void TouchActionFilter::ReportAndResetTouchAction() {
gesture_sequence_.append("RY");
else
gesture_sequence_.append("RN");
- ReportTouchAction();
if (num_of_active_touches_ <= 0)
ResetTouchAction();
}
-void TouchActionFilter::ReportTouchAction() {
- // Report the effective touch action computed by blink such as
- // TouchAction::kNone, TouchAction::kPanX, etc.
- // Since |cc::TouchAction::kAuto| is equivalent to |cc::TouchAction::kMax|, we
- // must add one to the upper bound to be able to visualize the number of
- // times |cc::TouchAction::kAuto| is hit.
- // https://crbug.com/879511, remove this temporary fix.
- if (!active_touch_action_.has_value())
- return;
-
- UMA_HISTOGRAM_ENUMERATION("TouchAction.EffectiveTouchAction",
- active_touch_action_.value(),
- static_cast<int>(cc::TouchAction::kMax) + 1);
-
- // Report how often the effective touch action computed by blink is or is
- // not equivalent to the whitelisted touch action computed by the
- // compositor.
- UMA_HISTOGRAM_BOOLEAN(
- "TouchAction.EquivalentEffectiveAndWhiteListed",
- active_touch_action_.value() == white_listed_touch_action_);
-}
-
void TouchActionFilter::AppendToGestureSequenceForDebugging(const char* str) {
gesture_sequence_.append(str);
}
@@ -468,11 +359,10 @@ void TouchActionFilter::AppendToGestureSequenceForDebugging(const char* str) {
void TouchActionFilter::ResetTouchAction() {
TRACE_EVENT0("input", "TouchActionFilter::ResetTouchAction");
// Note that resetting the action mid-sequence is tolerated. Gestures that had
- // their begin event(s) suppressed will be suppressed until the next
- // sequenceo.
+ // their begin event(s) suppressed will be suppressed until the next sequence.
if (has_touch_event_handler_) {
allowed_touch_action_.reset();
- white_listed_touch_action_ = cc::TouchAction::kAuto;
+ compositor_allowed_touch_action_ = cc::TouchAction::kAuto;
} else {
// Lack of a touch handler indicates that the page either has no
// touch-action modifiers or that all its touch-action modifiers are auto.
@@ -482,15 +372,15 @@ void TouchActionFilter::ResetTouchAction() {
}
}
-void TouchActionFilter::OnSetWhiteListedTouchAction(
- cc::TouchAction white_listed_touch_action) {
- TRACE_EVENT2("input", "TouchActionFilter::OnSetWhiteListedTouchAction",
- "action", cc::TouchActionToString(white_listed_touch_action),
- "current", cc::TouchActionToString(white_listed_touch_action_));
+void TouchActionFilter::OnSetCompositorAllowedTouchAction(
+ cc::TouchAction allowed_touch_action) {
+ TRACE_EVENT2("input", "TouchActionFilter::OnSetCompositorAllowedTouchAction",
+ "action", cc::TouchActionToString(allowed_touch_action),
+ "current", cc::TouchActionToString(allowed_touch_action));
// We use '&' here to account for the multiple-finger case, which is the same
// as OnSetTouchAction.
- white_listed_touch_action_ =
- white_listed_touch_action_ & white_listed_touch_action;
+ compositor_allowed_touch_action_ =
+ compositor_allowed_touch_action_ & allowed_touch_action;
}
bool TouchActionFilter::ShouldSuppressScrolling(
diff --git a/chromium/content/browser/renderer_host/input/touch_action_filter.h b/chromium/content/browser/renderer_host/input/touch_action_filter.h
index 4d2ff433c67..e967cc17344 100644
--- a/chromium/content/browser/renderer_host/input/touch_action_filter.h
+++ b/chromium/content/browser/renderer_host/input/touch_action_filter.h
@@ -47,13 +47,13 @@ class CONTENT_EXPORT TouchActionFilter {
void OnSetTouchAction(cc::TouchAction touch_action);
// Called at the end of a touch action sequence in order to log when a
- // whitelisted touch action is or is not equivalent to the allowed touch
- // action.
+ // compositor allowed touch action is or is not equivalent to the allowed
+ // touch action.
void ReportAndResetTouchAction();
- // Called when a set-white-listed-touch-action message is received from the
- // renderer for a touch start event that is currently in flight.
- void OnSetWhiteListedTouchAction(cc::TouchAction white_listed_touch_action);
+ // Called when a set-compositor-allowed-touch-action message is received from
+ // the renderer for a touch start event that is currently in flight.
+ void OnSetCompositorAllowedTouchAction(cc::TouchAction);
base::Optional<cc::TouchAction> allowed_touch_action() const {
return allowed_touch_action_;
@@ -63,8 +63,8 @@ class CONTENT_EXPORT TouchActionFilter {
return active_touch_action_;
}
- cc::TouchAction white_listed_touch_action() const {
- return white_listed_touch_action_;
+ cc::TouchAction compositor_allowed_touch_action() const {
+ return compositor_allowed_touch_action_;
}
void SetForceEnableZoom(bool enabled) { force_enable_zoom_ = enabled; }
@@ -91,7 +91,6 @@ class CONTENT_EXPORT TouchActionFilter {
cc::TouchAction touch_action);
FilterGestureEventResult FilterScrollEventAndResetState();
FilterGestureEventResult FilterPinchEventAndResetState();
- void ReportTouchAction();
void ResetTouchAction();
void SetTouchAction(cc::TouchAction touch_action);
@@ -138,8 +137,8 @@ class CONTENT_EXPORT TouchActionFilter {
// sequence due to fling.
base::Optional<cc::TouchAction> active_touch_action_;
- // Whitelisted touch action received from the compositor.
- cc::TouchAction white_listed_touch_action_;
+ // Allowed touch action received from the compositor.
+ cc::TouchAction compositor_allowed_touch_action_;
// Debugging only.
std::string gesture_sequence_;
diff --git a/chromium/content/browser/renderer_host/input/touch_action_filter_unittest.cc b/chromium/content/browser/renderer_host/input/touch_action_filter_unittest.cc
index e0903a59d2e..75353694cff 100644
--- a/chromium/content/browser/renderer_host/input/touch_action_filter_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/touch_action_filter_unittest.cc
@@ -5,12 +5,13 @@
#include "content/browser/renderer_host/input/touch_action_filter.h"
#include "base/test/scoped_feature_list.h"
#include "content/browser/renderer_host/event_with_latency_info.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
#include "ui/events/blink/blink_features.h"
+using blink::SyntheticWebGestureEventBuilder;
using blink::WebGestureEvent;
using blink::WebInputEvent;
@@ -33,8 +34,8 @@ class TouchActionFilterTest : public testing::Test {
}
void ResetTouchAction() { filter_.ResetTouchAction(); }
void ResetActiveTouchAction() { filter_.active_touch_action_.reset(); }
- void ResetWhiteListedTouchAction() {
- filter_.white_listed_touch_action_ = cc::TouchAction::kAuto;
+ void ResetCompositorAllowedTouchAction() {
+ filter_.compositor_allowed_touch_action_ = cc::TouchAction::kAuto;
}
void SetNoDeferredEvents() { filter_.has_deferred_events_ = false; }
void SetGestureSequenceInProgress() {
@@ -1179,13 +1180,14 @@ TEST_F(TouchActionFilterTest, GestureArrivesBeforeHasHandlerSet) {
FilterGestureEventResult::kFilterGestureEventAllowed);
}
-TEST_F(TouchActionFilterTest, PinchGesturesAllowedByWhiteListedTouchAction) {
+TEST_F(TouchActionFilterTest,
+ PinchGesturesAllowedByCompositorAllowedTouchAction) {
filter_.OnHasTouchEventHandlers(true);
EXPECT_FALSE(ActiveTouchAction().has_value());
EXPECT_FALSE(filter_.allowed_touch_action().has_value());
- // white listed touch action has a default value of Auto, and pinch related
- // gestures should be allowed.
+ // Compositor allowed touch action has a default value of Auto, and pinch
+ // related gestures should be allowed.
WebGestureEvent pinch_begin = SyntheticWebGestureEventBuilder::Build(
WebInputEvent::Type::kGesturePinchBegin, kSourceDevice);
WebGestureEvent pinch_update =
@@ -1201,9 +1203,9 @@ TEST_F(TouchActionFilterTest, PinchGesturesAllowedByWhiteListedTouchAction) {
FilterGestureEventResult::kFilterGestureEventAllowed);
}
-// Test gesture event filtering with white listed touch action. It should test
-// all 3 kinds of results: Allowed / Dropped / Delayed.
-TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
+// Test gesture event filtering with compositor allowed touch action. It should
+// test all 3 kinds of results: Allowed / Dropped / Delayed.
+TEST_F(TouchActionFilterTest, FilterWithCompositorAllowedListedTouchAction) {
filter_.OnHasTouchEventHandlers(true);
EXPECT_FALSE(ActiveTouchAction().has_value());
EXPECT_FALSE(filter_.allowed_touch_action().has_value());
@@ -1218,8 +1220,8 @@ TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
WebGestureEvent scroll_end = SyntheticWebGestureEventBuilder::Build(
WebInputEvent::Type::kGestureScrollEnd, kSourceDevice);
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPan);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPan);
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPan);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPan);
SetGestureSequenceInProgress();
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_begin),
FilterGestureEventResult::kFilterGestureEventAllowed);
@@ -1231,9 +1233,9 @@ TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
// Pinch related gestures are always delayed.
ResetTouchAction();
ResetActiveTouchAction();
- ResetWhiteListedTouchAction();
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPan);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPan);
+ ResetCompositorAllowedTouchAction();
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPan);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPan);
WebGestureEvent pinch_begin = SyntheticWebGestureEventBuilder::Build(
WebInputEvent::Type::kGesturePinchBegin, kSourceDevice);
WebGestureEvent pinch_update =
@@ -1248,14 +1250,15 @@ TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
EXPECT_EQ(filter_.FilterGestureEvent(&pinch_end),
FilterGestureEventResult::kFilterGestureEventDelayed);
- // Scroll updates should be delayed if white listed touch action is PanY,
- // because there are delta along the direction that is not allowed.
+ // Scroll updates should be delayed if the compositor allowed listed touch
+ // action is PanY, because there are delta along the direction that is not
+ // allowed.
ResetTouchAction();
ResetActiveTouchAction();
- ResetWhiteListedTouchAction();
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPanY);
+ ResetCompositorAllowedTouchAction();
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPanY);
SetNoDeferredEvents();
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPanY);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPanY);
SetGestureSequenceInProgress();
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_begin),
FilterGestureEventResult::kFilterGestureEventAllowed);
@@ -1266,10 +1269,10 @@ TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
ResetTouchAction();
ResetActiveTouchAction();
- ResetWhiteListedTouchAction();
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPanX);
+ ResetCompositorAllowedTouchAction();
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPanX);
SetNoDeferredEvents();
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPanX);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPanX);
dy = 0;
scroll_begin =
@@ -1290,8 +1293,8 @@ TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
SyntheticWebGestureEventBuilder::BuildScrollBegin(dx, dy, kSourceDevice);
scroll_update = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
dx, dy, 0, kSourceDevice);
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPanX);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPanX);
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPanX);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPanX);
SetGestureSequenceInProgress();
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_begin),
FilterGestureEventResult::kFilterGestureEventDelayed);
@@ -1301,21 +1304,21 @@ TEST_F(TouchActionFilterTest, FilterWithWhiteListedTouchAction) {
FilterGestureEventResult::kFilterGestureEventDelayed);
}
-TEST_F(TouchActionFilterTest, WhiteListedTouchActionResetToAuto) {
+TEST_F(TouchActionFilterTest, CompositorAllowedTouchActionResetToAuto) {
filter_.OnHasTouchEventHandlers(true);
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPan);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPan);
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPan);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPan);
ResetTouchAction();
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kAuto);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kAuto);
}
-TEST_F(TouchActionFilterTest, WhiteListedTouchActionAutoNoHasHandlers) {
+TEST_F(TouchActionFilterTest, CompositorAllowedTouchActionAutoNoHasHandlers) {
filter_.OnHasTouchEventHandlers(false);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kAuto);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kAuto);
ResetTouchAction();
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kAuto);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kAuto);
}
TEST_F(TouchActionFilterTest, ResetBeforeHasHandlerSet) {
@@ -1328,11 +1331,11 @@ TEST_F(TouchActionFilterTest, ResetBeforeHasHandlerSet) {
}
TEST_F(TouchActionFilterTest,
- WhiteListedTouchActionNotResetAtGestureScrollEnd) {
+ CompositorAllowedTouchActionNotResetAtGestureScrollEnd) {
filter_.OnHasTouchEventHandlers(true);
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPan);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPan);
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPan);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPan);
int dx = 2, dy = 5;
WebGestureEvent scroll_begin =
@@ -1351,7 +1354,7 @@ TEST_F(TouchActionFilterTest,
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_end),
FilterGestureEventResult::kFilterGestureEventAllowed);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPan);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPan);
}
// Having a gesture scroll begin without tap down should set touch action to
@@ -1361,12 +1364,12 @@ TEST_F(TouchActionFilterTest, ScrollBeginWithoutTapDown) {
EXPECT_FALSE(ActiveTouchAction().has_value());
EXPECT_FALSE(filter_.allowed_touch_action().has_value());
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPan);
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPan);
WebGestureEvent scroll_begin =
SyntheticWebGestureEventBuilder::BuildScrollBegin(5, 0, kSourceDevice);
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_begin),
FilterGestureEventResult::kFilterGestureEventAllowed);
- EXPECT_EQ(filter_.white_listed_touch_action(), cc::TouchAction::kPan);
+ EXPECT_EQ(filter_.compositor_allowed_touch_action(), cc::TouchAction::kPan);
ResetTouchAction();
ResetActiveTouchAction();
@@ -1376,7 +1379,7 @@ TEST_F(TouchActionFilterTest, ScrollBeginWithoutTapDown) {
// Ensure that there is no crash at GSB if both |allowed_| and |active_|
// touch action have no value.
- filter_.OnSetWhiteListedTouchAction(cc::TouchAction::kPan);
+ filter_.OnSetCompositorAllowedTouchAction(cc::TouchAction::kPan);
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_begin),
FilterGestureEventResult::kFilterGestureEventAllowed);
}
diff --git a/chromium/content/browser/renderer_host/input/touch_input_browsertest.cc b/chromium/content/browser/renderer_host/input/touch_input_browsertest.cc
index 59ee4394413..54d60e31bd6 100644
--- a/chromium/content/browser/renderer_host/input/touch_input_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/touch_input_browsertest.cc
@@ -15,7 +15,6 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/common/input_messages.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/render_view_host.h"
@@ -27,6 +26,7 @@
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/hit_test_region_observer.h"
#include "content/shell/browser/shell.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/latency/latency_info.h"
@@ -100,7 +100,7 @@ class TouchInputBrowserTest : public ContentBrowserTest {
}
protected:
- void SendTouchEvent(SyntheticWebTouchEvent* event) {
+ void SendTouchEvent(blink::SyntheticWebTouchEvent* event) {
auto* root_view = GetWidgetHost()->GetView();
auto* input_event_router =
GetWidgetHost()->delegate()->GetInputEventRouter();
@@ -138,7 +138,7 @@ class TouchInputBrowserTest : public ContentBrowserTest {
IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchNoHandler) {
LoadURL();
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
// A press on |first| should be acked with NO_CONSUMER_EXISTS since there is
// no touch-handler on it.
@@ -157,7 +157,7 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchNoHandler) {
IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerNoConsume) {
LoadURL();
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
// Press on |second| should be acked with NOT_CONSUMED since there is a
// touch-handler on |second|, but it doesn't consume the event.
@@ -175,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerNoConsume) {
IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerConsume) {
LoadURL();
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
// Press on |third| should be acked with CONSUMED since the touch-handler on
// |third| consimes the event.
@@ -193,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerConsume) {
IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MultiPointTouchPress) {
LoadURL();
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
// Press on |first|, which sould be acked with NO_CONSUMER_EXISTS. Then press
// on |third|. That point should be acked with CONSUMED.
diff --git a/chromium/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc b/chromium/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
index 47d7d475576..7dee79afd75 100644
--- a/chromium/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
@@ -215,7 +215,7 @@ TEST(WebInputEventBuilderAndroidTest, WebMouseEventCoordinates) {
ui::MotionEventAndroid motion_event(
AttachCurrentThread(), nullptr, kPixToDip, 0.f, 0.f, 0.f, kEventTimeMs,
- AMOTION_EVENT_ACTION_DOWN, 1, 0, -1, 0, 1, AMETA_ALT_ON, raw_offset_x,
+ AMOTION_EVENT_ACTION_DOWN, 1, 0, -1, 0, 0, 1, AMETA_ALT_ON, raw_offset_x,
raw_offset_y, false, &p0, nullptr);
WebMouseEvent web_event = content::WebMouseEventBuilder::Build(
diff --git a/chromium/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/chromium/content/browser/renderer_host/input/web_input_event_builders_mac.mm
index 9d420f190a7..940757ca1eb 100644
--- a/chromium/content/browser/renderer_host/input/web_input_event_builders_mac.mm
+++ b/chromium/content/browser/renderer_host/input/web_input_event_builders_mac.mm
@@ -241,15 +241,14 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event,
ui::EventTimeStampFromSeconds([event timestamp]);
if (record_debug_uma) {
if (ui::EventTypeFromNative(event) == ui::ET_KEY_PRESSED) {
+ base::TimeDelta diff = (now - hardware_timestamp).magnitude();
UMA_HISTOGRAM_CUSTOM_TIMES(
- now > hardware_timestamp
- ? "Event.Latency.OS_NO_VALIDATION.POSITIVE.KEY_PRESSED"
- : "Event.Latency.OS_NO_VALIDATION.NEGATIVE.KEY_PRESSED",
- (now - hardware_timestamp).magnitude(),
+ "Event.Latency.OS_NO_VALIDATION.POSITIVE.KEY_PRESSED", diff,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(60), 50);
}
}
+
ui::DomCode dom_code = ui::DomCodeFromNSEvent(event);
int modifiers =
ModifiersFromEvent(event) | ui::DomCodeToWebInputEventModifiers(dom_code);
@@ -310,11 +309,9 @@ blink::WebMouseEvent WebMouseEventBuilder::Build(
base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]);
if (ui::EventTypeFromNative(event) == ui::ET_MOUSE_PRESSED) {
+ base::TimeDelta diff = (now - hardware_timestamp).magnitude();
UMA_HISTOGRAM_CUSTOM_TIMES(
- now > hardware_timestamp
- ? "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_PRESSED"
- : "Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_PRESSED",
- (now - hardware_timestamp).magnitude(),
+ "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_PRESSED", diff,
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
50);
}
@@ -430,11 +427,9 @@ blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build(
base::TimeTicks now = ui::EventTimeForNow();
base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]);
+ base::TimeDelta diff = (now - hardware_timestamp).magnitude();
UMA_HISTOGRAM_CUSTOM_TIMES(
- now > hardware_timestamp
- ? "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_WHEEL"
- : "Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_WHEEL",
- (now - hardware_timestamp).magnitude(),
+ "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_WHEEL", diff,
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
50);
blink::WebMouseWheelEvent result(
@@ -673,9 +668,7 @@ blink::WebTouchEvent WebTouchEventBuilder::Build(NSEvent* event, NSView* view) {
base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]);
UMA_HISTOGRAM_CUSTOM_TIMES(
- now > hardware_timestamp
- ? "Event.Latency.OS.NO_VALIDATION.POSITIVE.TOUCH_PRESSED"
- : "Event.Latency.OS.NO_VALIDATION.NEGATIVE.TOUCH_PRESSED",
+ "Event.Latency.OS.NO_VALIDATION.POSITIVE.TOUCH_PRESSED",
(now - hardware_timestamp).magnitude(),
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
50);
diff --git a/chromium/content/browser/renderer_host/input/web_input_event_util_unittest.cc b/chromium/content/browser/renderer_host/input/web_input_event_util_unittest.cc
index 7026fd449f7..f0d9983973e 100644
--- a/chromium/content/browser/renderer_host/input/web_input_event_util_unittest.cc
+++ b/chromium/content/browser/renderer_host/input/web_input_event_util_unittest.cc
@@ -5,8 +5,8 @@
#include <stddef.h>
#include "base/numerics/math_constants.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/blink/web_input_event_traits.h"
#include "ui/events/event_constants.h"
diff --git a/chromium/content/browser/renderer_host/input/wheel_event_listener_browsertest.cc b/chromium/content/browser/renderer_host/input/wheel_event_listener_browsertest.cc
index cfbe402cf7e..80d9c9d9f1f 100644
--- a/chromium/content/browser/renderer_host/input/wheel_event_listener_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/wheel_event_listener_browsertest.cc
@@ -10,6 +10,7 @@
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
using blink::WebInputEvent;
@@ -82,7 +83,7 @@ class WheelEventListenerBrowserTest : public ContentBrowserTest {
double x = 10;
double y = 10;
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
x, y, x, y, -20, -20, 0,
ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
diff --git a/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc b/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
index 97e202bdc4c..5ff317dc6f2 100644
--- a/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
@@ -7,13 +7,13 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/hit_test_region_observer.h"
#include "content/shell/browser/shell.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
#if defined(OS_ANDROID)
@@ -167,7 +167,7 @@ IN_PROC_BROWSER_TEST_F(WheelScrollLatchingBrowserTest, MAYBE_WheelEventTarget) {
float delta_x = 0;
float delta_y = -0.6 * scrollable_div_top;
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
x, y, x, y, delta_x, delta_y, 0,
ui::ScrollGranularity::kScrollByPrecisePixel);
@@ -221,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(WheelScrollLatchingBrowserTest,
float delta_x = 0;
float delta_y = -0.6 * scrollable_div_top;
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
x, y, x, y, delta_x, delta_y, 0,
ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
@@ -257,16 +257,10 @@ IN_PROC_BROWSER_TEST_F(WheelScrollLatchingBrowserTest,
EXPECT_EQ(1, ExecuteScriptAndExtractInt("scrollableDivWheelEventCounter"));
}
-// crbug.com/777258 Flaky on Android and Chrome OS.
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
-#define MAYBE_WheelScrollingRelatchWhenLatchedScrollerRemoved \
- DISABLED_WheelScrollingRelatchWhenLatchedScrollerRemoved
-#else
-#define MAYBE_WheelScrollingRelatchWhenLatchedScrollerRemoved \
- WheelScrollingRelatchWhenLatchedScrollerRemoved
-#endif
-IN_PROC_BROWSER_TEST_F(WheelScrollLatchingBrowserTest,
- MAYBE_WheelScrollingRelatchWhenLatchedScrollerRemoved) {
+// crbug.com/777258 Flaky everywhere.
+IN_PROC_BROWSER_TEST_F(
+ WheelScrollLatchingBrowserTest,
+ DISABLED_WheelScrollingRelatchWhenLatchedScrollerRemoved) {
LoadURL(kWheelEventLatchingDataURL);
EXPECT_EQ(
ExecuteScriptAndExtractDouble("document.scrollingElement.scrollTop"), 0);
@@ -384,7 +378,7 @@ IN_PROC_BROWSER_TEST_F(WheelScrollLatchingBrowserTest,
auto wheel_msg_watcher = std::make_unique<InputMsgWatcher>(
GetWidgetHost(), blink::WebInputEvent::Type::kMouseWheel);
blink::WebMouseWheelEvent wheel_event =
- SyntheticWebMouseWheelEventBuilder::Build(
+ blink::SyntheticWebMouseWheelEventBuilder::Build(
x, y, x, y, 1, 1, 0, ui::ScrollGranularity::kScrollByPrecisePixel);
wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
GetRouter()->RouteMouseWheelEvent(GetRootView(), &wheel_event,