Bug 1093686 - Ignore body-level touch/mouse listeners when assessing element clickability. r=roc, a=lsblakk
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 06 Nov 2014 08:05:51 -0500
changeset 233821 8b5ef735d76cdbdd56ab1a4794f2764f65d2153c
parent 233820 569b611715e04e5f5ad84c9b75830f0e83eb1aab
child 233822 7a3c51b96a2b5ee5a8279951ca813bb1a238d25b
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs1093686
milestone35.0a2
Bug 1093686 - Ignore body-level touch/mouse listeners when assessing element clickability. r=roc, a=lsblakk When walking up the content tree to assess if an element is contained inside a clickable element, we should stop before hitting the body element. This is a heuristic based on pages in the wild, because a lot of pages have mouse/touch listeners on the body. Without this patch all elements end up getting treated as clickable which makes the event retargeting code useless.
layout/base/PositionedEventTargeting.cpp
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -330,17 +330,17 @@ GetClosest(nsIFrame* aRoot, const nsPoin
     }
 
     if (preservesAxisAlignedRectangles) {
       // Subtract from the exposed region if we have a transform that won't make
       // the bounds include a bunch of area that we don't actually cover.
       SubtractFromExposedRegion(&exposedRegion, region);
     }
 
-    if (!IsElementClickable(f)) {
+    if (!IsElementClickable(f, nsGkAtoms::body)) {
       continue;
     }
     // If our current closest frame is a descendant of 'f', skip 'f' (prefer
     // the nested frame).
     if (bestTarget && nsLayoutUtils::IsProperAncestorFrameCrossDoc(f, bestTarget, aRoot)) {
       continue;
     }
     if (!nsLayoutUtils::IsAncestorFrameCrossDoc(aRestrictToDescendants, f, aRoot)) {