From ed581684889fbc46810aac75a7fd70ee3dfb6886 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 14 Feb 2020 16:13:46 -0800 Subject: [PATCH] fix: add patch to route mouse event navigations through the WebContentsDelegate (#22202) --- patches/chromium/.patches | 1 + ...ns_through_the_web_contents_delegate.patch | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index cc9206139258..e317399cdfc9 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -84,3 +84,4 @@ fix_use_the_new_mediaplaypause_key_listener_for_internal_chrome.patch fix_use_native_window_button_positions_when_macos_locale_is_rtl.patch use_electron_resources_in_pdf_util.patch hack_plugin_response_interceptor_to_point_to_electron.patch +fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch diff --git a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch new file mode 100644 index 000000000000..bcfc6c2cddb9 --- /dev/null +++ b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Fri, 14 Feb 2020 13:35:47 -0800 +Subject: fix: route mouse event navigations through the web_contents delegate + +This ensures that embedders can handle browser-side mouse navigations +themselves. We need this so that we can correctly ensure that processes +are not restarted for in-document navigations. + +Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1769525 + +This patch can be removed once app.allowRendererProcessReuse is forced +to true as then Chromiums assumptions around processes become correct. + +diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc +index 70d735dcc38734edaaf6221cd40c49beb6d2e37e..9cd7368966c20b9e9306c41e455c002d686d3013 100644 +--- a/content/browser/web_contents/web_contents_impl.cc ++++ b/content/browser/web_contents/web_contents_impl.cc +@@ -2347,11 +2347,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { + WebContentsImpl* outermost = GetOutermostWebContents(); + if (event.button == blink::WebPointerProperties::Button::kBack && + outermost->controller_.CanGoBack()) { +- outermost->controller_.GoBack(); ++ if (delegate_->OnGoToEntryOffset(-1)) ++ outermost->controller_.GoBack(); + return true; + } else if (event.button == blink::WebPointerProperties::Button::kForward && + outermost->controller_.CanGoForward()) { +- outermost->controller_.GoForward(); ++ if (delegate_->OnGoToEntryOffset(1)) ++ outermost->controller_.GoForward(); + return true; + } + }