script: Remove duplicate context menu trigger (#38669)

#38584 moves input event handling to new `DocumentEventHandler`, but
probably reintroduced some removed code when resolving conflict with
#38589.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-08-14 11:47:15 +08:00 committed by GitHub
parent 97a114b248
commit cd3d982a2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -589,8 +589,7 @@ impl DocumentEventHandler {
// Step 9. If mbutton is the secondary mouse button, then
// Maybe show context menu with native, target.
if let (MouseButtonAction::Down, MouseButton::Right) = (event.action, event.button)
{
if let MouseButton::Right = event.button {
self.maybe_show_context_menu(
node.upcast(),
&hit_test_result,
@ -611,12 +610,6 @@ impl DocumentEventHandler {
dom_event.dispatch(node.upcast(), false, can_gc);
},
}
// When the contextmenu event is triggered by right mouse button
// the contextmenu event MUST be dispatched after the mousedown event.
if let (MouseButtonAction::Down, MouseButton::Right) = (event.action, event.button) {
self.maybe_show_context_menu(node.upcast(), &hit_test_result, input_event, can_gc);
}
}
/// <https://www.w3.org/TR/uievents/#maybe-show-context-menu>