From 3b1fe322f7420860ee0ce418380d543965d69ed0 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 10 Jun 2025 02:23:53 +0200 Subject: [PATCH] Issue #2721 - Simplify CheckHandleEventForAnchorsPreconditions. The special case check is no longer necessary after our changes in this issue and #2732 where no longer applies as a link inside image maps. --- dom/html/nsGenericHTMLElement.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 536701e076..e811f6b462 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -585,22 +585,10 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(EventChainVisitor& { NS_PRECONDITION(nsCOMPtr(do_QueryObject(this)), "should be called only when |this| implements |Link|"); - - if (!aVisitor.mPresContext) { - // When not in the composed document DOM, only should navigate away per - // the exception in https://html.spec.whatwg.org/#cannot-navigate - // Thanks, Google, for another ugly one. :| - return IsInComposedDoc() || IsHTMLElement(nsGkAtoms::a); - } - - //Need to check if we hit an imagemap area and if so see if we're handling - //the event on that map or on a link farther up the tree. If we're on a - //link farther up, do nothing. - nsCOMPtr target = aVisitor.mPresContext->EventStateManager()-> - GetEventTargetContent(aVisitor.mEvent); - - return !target || !target->IsHTMLElement(nsGkAtoms::area) || - IsHTMLElement(nsGkAtoms::area); + // When not in the composed document DOM, only should navigate away per + // the exception in https://html.spec.whatwg.org/#cannot-navigate + // Thanks, Google, for another ugly one. :| + return IsInComposedDoc() || IsHTMLElement(nsGkAtoms::a); } nsresult