From 16bfd6e375142bd53802ea0a36c603bf3c07767b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 9 Jul 2019 16:17:56 +0000 Subject: [PATCH] Bug 1218456 - Simplify CheckHandleEventForAnchorsPreconditions. r=smaug I've checked that this doesn't change behavior in the test-case for bug 30178, which is just an imagemap inside a link. Overall it'd be weird if we needed this for area-inside-a but not for stuff like nested links. Differential Revision: https://phabricator.services.mozilla.com/D37407 --HG-- extra : moz-landing-system : lando --- dom/html/nsGenericHTMLElement.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index f4d79ab15815..b59981697e3e 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -523,21 +523,9 @@ bool nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions( EventChainVisitor& aVisitor) { MOZ_ASSERT(nsCOMPtr(do_QueryObject(this)), "should be called only when |this| implements |Link|"); - if (!aVisitor.mPresContext) { - // When disconnected, only should navigate away per - // https://html.spec.whatwg.org/#cannot-navigate - 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 disconnected, only should navigate away per + // https://html.spec.whatwg.org/#cannot-navigate + return IsInComposedDoc() || IsHTMLElement(nsGkAtoms::a); } void nsGenericHTMLElement::GetEventTargetParentForAnchors(