Backed out changeset 5431daa798c7 (bug 1871424) for causing Bug 1873472

This commit is contained in:
Narcis Beleuzu 2024-01-12 11:52:07 +02:00
parent 29c6a9b6dd
commit 56eab566cd
4 changed files with 13 additions and 30 deletions

View File

@ -241,11 +241,6 @@ ASSERT_NODE_SIZE(Text, 120, 80);
#undef ASSERT_NODE_SIZE
#undef EXTRA_DOM_NODE_BYTES
// XXXedgar: This is a temporary hack for the link elements, which have not yet
// adopted the activation behavior defined in the specification. This should be
// removed after resolving bug 1851970.
#define LINK_ACTIVATE_EVENT (1 << 0)
} // namespace mozilla::dom
nsAtom* nsIContent::DoGetID() const {
@ -3167,7 +3162,6 @@ void Element::GetEventTargetParentForLinks(EventChainPreVisitor& aVisitor) {
case eFocus:
case eMouseOut:
case eBlur:
case eMouseClick:
break;
default:
return;
@ -3216,17 +3210,6 @@ void Element::GetEventTargetParentForLinks(EventChainPreVisitor& aVisitor) {
}
break;
}
case eMouseClick: {
// XXXedgar: This is a temporary hack for the link elements, which have
// not yet adopted the activation behavior defined in the specification.
// This should be removed after resolving bug 1851970.
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mouseEvent && mouseEvent->IsLeftClickEvent() &&
!aVisitor.mEvent->mFlags.mMultipleActivationPrevented) {
aVisitor.mItemFlags |= LINK_ACTIVATE_EVENT;
}
break;
}
default:
// switch not in sync with the optimization switch earlier in this
@ -3347,11 +3330,7 @@ nsresult Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor) {
case eMouseClick: {
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mouseEvent->IsLeftClickEvent() &&
// XXXedgar: This is a temporary hack for the link elements, which
// have not yet adopted the activation behavior defined in the
// specification. This should be removed after resolving bug 1851970.
(aVisitor.mItemFlags & LINK_ACTIVATE_EVENT)) {
if (mouseEvent->IsLeftClickEvent()) {
if (!mouseEvent->IsControl() && !mouseEvent->IsMeta() &&
!mouseEvent->IsAlt() && !mouseEvent->IsShift()) {
if (OwnerDoc()->MayHaveDOMActivateListeners()) {

View File

@ -3174,10 +3174,6 @@ void HTMLInputElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
if (CheckActivationBehaviorPreconditions(aVisitor)) {
aVisitor.mWantsActivationBehavior = true;
// XXXedgar: This is a temporary hack for elements, like <a>, which have not
// yet adopted the activation behavior defined in the specification. This
// should be removed after resolving bug 1851970.
aVisitor.mEvent->mFlags.mMultipleActivationPrevented = true;
}
// We must cache type because mType may change during JS event (bug 2369)

View File

@ -14,6 +14,18 @@
[When clicking child <LABEL><INPUT type=checkbox></INPUT><SPAN></SPAN></LABEL> of parent <FORM><INPUT type=reset></INPUT></FORM>, only child should be activated.]
expected: FAIL
[When clicking child <INPUT type=checkbox></INPUT> of parent <A></A>, only child should be activated.]
expected: FAIL
[When clicking child <INPUT type=checkbox></INPUT> of parent <AREA></AREA>, only child should be activated.]
expected: FAIL
[When clicking child <INPUT type=radio></INPUT> of parent <A></A>, only child should be activated.]
expected: FAIL
[When clicking child <INPUT type=radio></INPUT> of parent <AREA></AREA>, only child should be activated.]
expected: FAIL
[When clicking child <LABEL><INPUT type=checkbox></INPUT><SPAN></SPAN></LABEL> of parent <FORM><BUTTON type=submit></BUTTON></FORM>, only child should be activated.]
expected: FAIL

View File

@ -99,10 +99,6 @@ struct BaseEventFlags {
// the first <label> element is clicked, that one may set this true.
// Then, the second <label> element won't handle the event.
bool mMultipleActionsPrevented : 1;
// XXXedgar: This is a temporary hack for elements, like <a>, which have not
// yet adopted the activation behavior defined in the specification. This
// should be removed after resolving bug 1851970.
bool mMultipleActivationPrevented : 1;
// If mIsBeingDispatched is true, the DOM event created from the event is
// dispatching into the DOM tree and not completed.
bool mIsBeingDispatched : 1;