From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- widget/android/nsWindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'widget/android/nsWindow.cpp') diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index e9756c3f92..a654c8e848 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -609,6 +609,22 @@ class NPZCSupport final PostInputEvent([input = std::move(input), result](nsWindow* window) { WidgetMouseEvent mouseEvent = input.ToWidgetEvent(window); window->ProcessUntransformedAPZEvent(&mouseEvent, result); + if (MouseInput::SECONDARY_BUTTON == input.mButtonType) { + if ((StaticPrefs::ui_context_menus_after_mouseup() && + MouseInput::MOUSE_UP == input.mType) || + (!StaticPrefs::ui_context_menus_after_mouseup() && + MouseInput::MOUSE_DOWN == input.mType)) { + MouseInput contextMenu = input; + + // Actually we don't dispatch context menu event to APZ since we don't + // handle it on APZ yet. If handling it, we need to consider how to + // dispatch it on APZ thread. It may cause a race condition. + contextMenu.mType = MouseInput::MOUSE_CONTEXTMENU; + + WidgetMouseEvent contextMenuEvent = contextMenu.ToWidgetEvent(window); + window->ProcessUntransformedAPZEvent(&contextMenuEvent, result); + } + } }); switch (result.GetStatus()) { -- cgit v1.2.3