Files
electron/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch
electron-roller[bot] a90ccc753b chore: bump chromium to 145.0.7577.0 (main) (#49175)
* chore: bump chromium in DEPS to 145.0.7572.0

* chore: update patches (trivial only)

* chore(patch-conflict): feat_filter_out_non-shareable_windows_in_the_current_application_in.patch

Polished the edits and formatted the result. No real changes.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7232079 "7232079: Use WindowsToExclude to exclude PiP window in macOS screencapture device"

* chore(patch-conflict): feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7214586 "7214586: Refactor SelectFileDialogLinuxPortal to request XDG portal on demand"
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7237910 "7237910: Remove g_gtk_ui global"

* 7228586: Migrate SystemMemoryInfo from ByteCount to ByteSize

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7228586

* 7207583: GlobalRenderFrameHostId to ChildProcessId

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7207583

* 7205548: Remove uses of BodyAsStringCallbackDeprecated (extensions/)

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7205548

* chore: bump chromium in DEPS to 145.0.7574.0

* chore: update libc++ filenames

* chore: update patches (trivial only)

* chore(patch-conflict): feat_filter_out_non-shareable_windows_in_the_current_application_in.patch

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7246150 "7246150: Fix crash in ScreenCaptureKitDeviceMac due to null PIPScreenCaptureCoordinator"

* fixup! chore(patch-conflict): feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch

* fixup! chore(patch-conflict): feat_filter_out_non-shareable_windows_in_the_current_application_in.patch

* 7239572: [OOPIF PDF] Enable OOPIF PDF by default on Windows/macOS/Linux

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7239572

* chore: bump chromium in DEPS to 145.0.7576.0

* fixup! chore(patch-conflict): feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch

* chore: update patches (trivial only)

* chore: add note to keep patch that was upstreamed but reverted

fix_restore_original_resize_performance_on_macos.patch was organically upstreamed but that change got reverted just after the current roll's cutoff.

I've added a note in the patch contents so the patch sticks around and so we can keep it after the revert is included.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7255334 "7255334: Revert 'Fix jank when resizing browser window'"

* chore: bump chromium in DEPS to 145.0.7577.0

* chore: update patches (trivial only)

* chore(patch-conflict): keep patch after revert

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7255334 "7255334: Revert 'Fix jank when resizing browser window'"

* 7237910: Remove g_gtk_ui global

I tried to find a way to avoid the patch, but other approaches seemed complex and involved.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7237910

* 7251900: Reland "Remove callback_helpers.h include from is_callback.h (try 5)"

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7251900

* 7170174: [LNA] Retry requests for cached local resources

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7170174

* fix: PDFs use OOPIF (behavior change)

* fixup! 7237910: Remove g_gtk_ui global

* fixup! 7251900: Reland "Remove callback_helpers.h include from is_callback.h (try 5)"

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-12-16 12:32:38 -05:00

120 lines
6.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Mon, 1 Sep 2025 23:31:49 +0900
Subject: Revert: partial "Remove unused PreHandleMouseEvent"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411
diff --git a/content/browser/renderer_host/render_widget_host_delegate.cc b/content/browser/renderer_host/render_widget_host_delegate.cc
index 74fea36ea7f9a345b3474ea18be00704831a685e..c75785d5a26fa52a39d1a3552da9a7621e4c8430 100644
--- a/content/browser/renderer_host/render_widget_host_delegate.cc
+++ b/content/browser/renderer_host/render_widget_host_delegate.cc
@@ -13,6 +13,11 @@
namespace content {
+bool RenderWidgetHostDelegate::PreHandleMouseEvent(
+ const blink::WebMouseEvent& event) {
+ return false;
+}
+
KeyboardEventProcessingResult RenderWidgetHostDelegate::PreHandleKeyboardEvent(
const input::NativeWebKeyboardEvent& event) {
return KeyboardEventProcessingResult::NOT_HANDLED;
diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h
index bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81..c6fc03ae158b3ce87fd684d765a3f1b0e9f79212 100644
--- a/content/browser/renderer_host/render_widget_host_delegate.h
+++ b/content/browser/renderer_host/render_widget_host_delegate.h
@@ -103,6 +103,12 @@ class CONTENT_EXPORT RenderWidgetHostDelegate {
virtual void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
const gfx::Size& new_size) {}
+ // Callback to give the browser a chance to handle the specified mouse
+ // event before sending it to the renderer. Returns true if the event was
+ // handled, false otherwise. A true value means no more processing should
+ // happen on the event. The default return value is false.
+ virtual bool PreHandleMouseEvent(const blink::WebMouseEvent& event);
+
// Callback to give the browser a chance to handle the specified keyboard
// event before sending it to the renderer. See enum for details on return
// value.
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index d344972c8322a0590bab8824660088de8e3b646e..37312db1ee0a31099d43b09ad54825c90bdd10dd 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1589,6 +1589,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
CHECK_GE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeFirst);
CHECK_LE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeLast);
+ if (delegate_ && delegate_->PreHandleMouseEvent(mouse_event)) {
+ return;
+ }
+
for (auto& mouse_event_callback : mouse_event_callbacks_) {
if (mouse_event_callback.Run(mouse_event)) {
return;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index a4ac414df4c9d8987ebaf85b60ed6ba285e01a07..26f3346c64789137a6610b4f6f6c7baa8f5ea2fe 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4454,6 +4454,12 @@ void WebContentsImpl::RenderWidgetWasResized(
width_changed);
}
+bool WebContentsImpl::PreHandleMouseEvent(const blink::WebMouseEvent& event) {
+ OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"),
+ "WebContentsImpl::PreHandleMouseEvent");
+ return delegate_ ? delegate_->PreHandleMouseEvent(this, event) : false;
+}
+
void WebContentsImpl::PreHandleDragUpdate(const DropData& drop_data,
const gfx::PointF& client_pt) {
if (delegate_) {
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index cf1b560bc7cf6d912a9000a2b9c73666e1a9f1eb..4f0a3e47bad7e58db60ea1a8f75cd3cb00956b09 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -1122,6 +1122,7 @@ class CONTENT_EXPORT WebContentsImpl
double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override;
+ bool PreHandleMouseEvent(const blink::WebMouseEvent& event) override;
void PreHandleDragUpdate(const DropData& drop_data,
const gfx::PointF& client_pt);
void PreHandleDragExit();
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc
index 6c3ac2cf54bd7c20165b552f8c26da14cab94242..ec95bd923b1d78f74f097eea687bcc4b2292ebba 100644
--- a/content/public/browser/web_contents_delegate.cc
+++ b/content/public/browser/web_contents_delegate.cc
@@ -127,6 +127,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host,
return false;
}
+bool WebContentsDelegate::PreHandleMouseEvent(
+ WebContents* source,
+ const blink::WebMouseEvent& event) {
+ return false;
+}
+
KeyboardEventProcessingResult WebContentsDelegate::PreHandleKeyboardEvent(
WebContents* source,
const input::NativeWebKeyboardEvent& event) {
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 320a7288dd87f6e9c100fcff046ddfa7f0f6e179..3cf8ee74905be5ac4ee48b6587fbf91ade462bda 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -326,6 +326,13 @@ class CONTENT_EXPORT WebContentsDelegate {
virtual bool HandleContextMenu(RenderFrameHost& render_frame_host,
const ContextMenuParams& params);
+ // Allows delegates to handle mouse events before sending to the renderer.
+ // Returns true if the event was handled, false otherwise. A true value means
+ // no more processing should happen on the event. The default return value is
+ // false.
+ virtual bool PreHandleMouseEvent(WebContents* source,
+ const blink::WebMouseEvent& event);
+
// Allows delegates to handle mouse drag events before sending to the
// renderer. Returns true if the event was handled, false otherwise. A true
// value means no more processing should happen on the event. The default