mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 05:47:29 +09:00
Issue #2362 - Fix click handling according to the spec.
This removes some hackery surrounding preventing content clicks, and in general handles auxclick as it should, firing that event on secondary buttons (wheel/right on default setup for right-handed mouse).
This commit is contained in:
parent
73bf6f95f8
commit
dc253ce953
8 changed files with 82 additions and 85 deletions
|
|
@ -189,6 +189,9 @@ EditorEventListener::InstallToEditor()
|
|||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("click"),
|
||||
TrustedEventsAtCapture());
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("auxclick"),
|
||||
TrustedEventsAtSystemGroupCapture());
|
||||
// Focus event doesn't bubble so adding the listener to capturing phase.
|
||||
// Make sure this works after bug 235441 gets fixed.
|
||||
elmP->AddEventListenerByType(this,
|
||||
|
|
@ -282,6 +285,9 @@ EditorEventListener::UninstallFromEditor()
|
|||
elmP->RemoveEventListenerByType(this,
|
||||
NS_LITERAL_STRING("click"),
|
||||
TrustedEventsAtCapture());
|
||||
elmP->RemoveEventListenerByType(this,
|
||||
NS_LITERAL_STRING("auxclick"),
|
||||
TrustedEventsAtSystemGroupCapture());
|
||||
elmP->RemoveEventListenerByType(this,
|
||||
NS_LITERAL_STRING("blur"),
|
||||
TrustedEventsAtCapture());
|
||||
|
|
@ -447,6 +453,15 @@ EditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
}
|
||||
// click
|
||||
case eMouseClick: {
|
||||
WidgetMouseEvent* widgetMouseEvent = internalEvent->AsMouseEvent();
|
||||
// Don't handle non-primary click events
|
||||
if (widgetMouseEvent->button != WidgetMouseEvent::eLeftButton) {
|
||||
return NS_OK;
|
||||
}
|
||||
[[fallthrough]];
|
||||
}
|
||||
// auxclick
|
||||
case eMouseAuxClick: {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
|
||||
NS_ENSURE_TRUE(mouseEvent, NS_OK);
|
||||
// If the preceding mousedown event or mouseup event was consumed,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue