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:
Moonchild 2023-11-30 18:56:26 +01:00 committed by roytam1
commit dc253ce953
8 changed files with 82 additions and 85 deletions

View file

@ -43,8 +43,6 @@
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
#define NS_NO_CONTENT_DISPATCH (1 << 0)
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
namespace mozilla {
@ -521,18 +519,6 @@ HTMLTextAreaElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
mHandlingSelect = true;
}
// If noContentDispatch is true we will not allow content to handle
// this event. But to allow middle mouse button paste to work we must allow
// middle clicks to go to text fields anyway.
if (aVisitor.mEvent->mFlags.mNoContentDispatch) {
aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
}
if (aVisitor.mEvent->mMessage == eMouseClick &&
aVisitor.mEvent->AsMouseEvent()->button ==
WidgetMouseEvent::eMiddleButton) {
aVisitor.mEvent->mFlags.mNoContentDispatch = false;
}
if (aVisitor.mEvent->mMessage == eBlur) {
// Set mWantsPreHandleEvent and fire change event in PreHandleEvent to
// prevent it breaks event target chain creation.
@ -596,10 +582,6 @@ HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
UpdateState(true);
}
// Reset the flag for other content besides this text field
aVisitor.mEvent->mFlags.mNoContentDispatch =
((aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH) != 0);
return NS_OK;
}