mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2030 - Allow child nodes of button to participate in mouse hit tests
This is needed for web compatibility, even if standards compliance is debatable.
This commit is contained in:
@@ -143,11 +143,14 @@ namespace dom {
|
||||
#define NS_ORIGINAL_CHECKED_VALUE (1 << 10)
|
||||
#define NS_NO_CONTENT_DISPATCH (1 << 11)
|
||||
#define NS_ORIGINAL_INDETERMINATE_VALUE (1 << 12)
|
||||
#define NS_CONTROL_TYPE(bits) ((bits) & ~( \
|
||||
NS_OUTER_ACTIVATE_EVENT | NS_ORIGINAL_CHECKED_VALUE | NS_NO_CONTENT_DISPATCH | \
|
||||
NS_ORIGINAL_INDETERMINATE_VALUE))
|
||||
#define NS_PRE_HANDLE_BLUR_EVENT (1 << 13)
|
||||
#define NS_PRE_HANDLE_INPUT_EVENT (1 << 14)
|
||||
#define NS_IN_SUBMIT_CLICK (1 << 15)
|
||||
#define NS_CONTROL_TYPE(bits) \
|
||||
((bits) & ~(NS_OUTER_ACTIVATE_EVENT | NS_ORIGINAL_CHECKED_VALUE | \
|
||||
NS_NO_CONTENT_DISPATCH | NS_ORIGINAL_INDETERMINATE_VALUE | \
|
||||
NS_PRE_HANDLE_BLUR_EVENT | NS_PRE_HANDLE_INPUT_EVENT | \
|
||||
NS_IN_SUBMIT_CLICK))
|
||||
|
||||
// whether textfields should be selected once focused:
|
||||
// -1: no, 1: yes, 0: uninitialized
|
||||
@@ -3800,7 +3803,10 @@ HTMLInputElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
|
||||
case NS_FORM_INPUT_SUBMIT:
|
||||
case NS_FORM_INPUT_IMAGE:
|
||||
if (mForm) {
|
||||
if (mForm && !aVisitor.mEvent->mFlags.mMultiplePreActionsPrevented) {
|
||||
// Make sure other submit elements don't try to trigger submission.
|
||||
aVisitor.mEvent->mFlags.mMultiplePreActionsPrevented = true;
|
||||
aVisitor.mItemFlags |= NS_IN_SUBMIT_CLICK;
|
||||
// tell the form that we are about to enter a click handler.
|
||||
// that means that if there are scripted submissions, the
|
||||
// latest one will be deferred until after the exit point of the handler.
|
||||
@@ -4394,17 +4400,15 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
if (outerActivateEvent) {
|
||||
if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) && mForm) {
|
||||
switch(oldType) {
|
||||
case NS_FORM_INPUT_SUBMIT:
|
||||
case NS_FORM_INPUT_IMAGE:
|
||||
if (mForm) {
|
||||
// tell the form that we are about to exit a click handler
|
||||
// so the form knows not to defer subsequent submissions
|
||||
// the pending ones that were created during the handler
|
||||
// will be flushed or forgoten.
|
||||
mForm->OnSubmitClickEnd();
|
||||
}
|
||||
// tell the form that we are about to exit a click handler
|
||||
// so the form knows not to defer subsequent submissions
|
||||
// the pending ones that were created during the handler
|
||||
// will be flushed or forgoten.
|
||||
mForm->OnSubmitClickEnd();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -4770,7 +4774,8 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
if (outerActivateEvent) {
|
||||
if (mForm && (oldType == NS_FORM_INPUT_SUBMIT ||
|
||||
oldType == NS_FORM_INPUT_IMAGE)) {
|
||||
if (mType != NS_FORM_INPUT_SUBMIT && mType != NS_FORM_INPUT_IMAGE) {
|
||||
if (mType != NS_FORM_INPUT_SUBMIT && mType != NS_FORM_INPUT_IMAGE &&
|
||||
aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) {
|
||||
// If the type has changed to a non-submit type, then we want to
|
||||
// flush the stored submission if there is one (as if the submit()
|
||||
// was allowed to succeed)
|
||||
@@ -4809,7 +4814,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
break;
|
||||
} //switch
|
||||
} //click or outer activate event
|
||||
} else if (outerActivateEvent &&
|
||||
} else if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) &&
|
||||
(oldType == NS_FORM_INPUT_SUBMIT ||
|
||||
oldType == NS_FORM_INPUT_IMAGE) &&
|
||||
mForm) {
|
||||
|
||||
Reference in New Issue
Block a user