/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "PositionedEventTargeting.h" #include "mozilla/EventListenerManager.h" #include "mozilla/EventStates.h" #include "mozilla/MouseEvents.h" #include "mozilla/Preferences.h" #include "nsIContentInlines.h" #include "nsLayoutUtils.h" #include "nsGkAtoms.h" #include "nsFontMetrics.h" #include "nsPrintfCString.h" #include "mozilla/dom/Element.h" #include "nsRegion.h" #include "nsDeviceContext.h" #include "nsIFrame.h" #include #include "LayersLogging.h" // If debugging this code you may wish to enable this logging, and also // uncomment the DumpFrameTree call near the bottom of the file. #define PET_LOG(...) // #define PET_LOG(...) printf_stderr("PET: " __VA_ARGS__); namespace mozilla { /* * The basic goal of FindFrameTargetedByInputEvent() is to find a good * target element that can respond to mouse events. Both mouse events and touch * events are targeted at this element. Note that even for touch events, we * check responsiveness to mouse events. We assume Web authors * designing for touch events will take their own steps to account for * inaccurate touch events. * * GetClickableAncestor() encapsulates the heuristic that determines whether an * element is expected to respond to mouse events. An element is deemed * "clickable" if it has registered listeners for "click", "mousedown" or * "mouseup", or is on a whitelist of element tags (,