Bug 1947446 - Part 1: Input element should always have activation behavior; r=smaug
See https://html.spec.whatwg.org/multipage/input.html#the-input-element. Differential Revision: https://phabricator.services.mozilla.com/D238780
This commit is contained in:
@@ -3152,32 +3152,18 @@ bool HTMLInputElement::IsDisabledForEvents(WidgetEvent* aEvent) {
|
||||
|
||||
bool HTMLInputElement::CheckActivationBehaviorPreconditions(
|
||||
EventChainVisitor& aVisitor) const {
|
||||
switch (mType) {
|
||||
case FormControlType::InputColor:
|
||||
case FormControlType::InputCheckbox:
|
||||
case FormControlType::InputRadio:
|
||||
case FormControlType::InputFile:
|
||||
case FormControlType::InputSubmit:
|
||||
case FormControlType::InputImage:
|
||||
case FormControlType::InputReset:
|
||||
case FormControlType::InputButton: {
|
||||
// Track whether we're in the outermost Dispatch invocation that will
|
||||
// cause activation of the input. That is, if we're a click event, or a
|
||||
// DOMActivate that was dispatched directly, this will be set, but if
|
||||
// we're a DOMActivate dispatched from click handling, it will not be set.
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
bool outerActivateEvent =
|
||||
(mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||
(aVisitor.mEvent->mMessage == eLegacyDOMActivate &&
|
||||
!mInInternalActivate);
|
||||
if (outerActivateEvent) {
|
||||
aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT;
|
||||
}
|
||||
return outerActivateEvent;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
// Track whether we're in the outermost Dispatch invocation that will
|
||||
// cause activation of the input. That is, if we're a click event, or a
|
||||
// DOMActivate that was dispatched directly, this will be set, but if
|
||||
// we're a DOMActivate dispatched from click handling, it will not be set.
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
bool outerActivateEvent =
|
||||
(mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||
(aVisitor.mEvent->mMessage == eLegacyDOMActivate && !mInInternalActivate);
|
||||
if (outerActivateEvent) {
|
||||
aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT;
|
||||
}
|
||||
return outerActivateEvent;
|
||||
}
|
||||
|
||||
void HTMLInputElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
||||
|
||||
Reference in New Issue
Block a user