From 5d78b30c42cc08b473be97bc129955f79e5f913d Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Mon, 5 Aug 2013 11:25:27 -0700 Subject: [PATCH] Bug 901117 - Positioned event targetting should fluff even if there are body event listeners. r=tn --- layout/base/PositionedEventTargeting.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 7ffcb9a108c..9bc15157316 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -125,17 +125,20 @@ HasMouseListener(nsIContent* aContent) } static bool -IsElementClickable(nsIFrame* aFrame) +IsElementClickable(nsIFrame* aFrame, nsIAtom* stopAt = nullptr) { // Input events propagate up the content tree so we'll follow the content // ancestors to look for elements accepting the click. for (nsIContent* content = aFrame->GetContent(); content; content = content->GetFlattenedTreeParent()) { + nsIAtom* tag = content->Tag(); + if (content->IsHTML() && stopAt && tag == stopAt) { + break; + } if (HasMouseListener(content)) { return true; } if (content->IsHTML()) { - nsIAtom* tag = content->Tag(); if (tag == nsGkAtoms::button || tag == nsGkAtoms::input || tag == nsGkAtoms::select || @@ -305,7 +308,7 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent, nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, flags); const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->eventStructType); - if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target))) { + if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target, nsGkAtoms::body))) { return target; }