From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- layout/base/PositionedEventTargeting.cpp | 621 +++++++++++++++++++++++++++++++ 1 file changed, 621 insertions(+) create mode 100644 layout/base/PositionedEventTargeting.cpp (limited to 'layout/base/PositionedEventTargeting.cpp') diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp new file mode 100644 index 0000000000..8251e4cfa6 --- /dev/null +++ b/layout/base/PositionedEventTargeting.cpp @@ -0,0 +1,621 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/MouseEvents.h" +#include "mozilla/Preferences.h" +#include "mozilla/PresShell.h" +#include "mozilla/StaticPrefs_dom.h" +#include "mozilla/StaticPrefs_ui.h" +#include "mozilla/ToString.h" +#include "mozilla/dom/MouseEventBinding.h" +#include "nsContainerFrame.h" +#include "nsFrameList.h" // for DEBUG_FRAME_DUMP +#include "nsHTMLParts.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 "nsIContentInlines.h" +#include "nsIFrame.h" +#include + +using namespace mozilla; +using namespace mozilla::dom; + +// If debugging this code you may wish to enable this logging, via +// the env var MOZ_LOG="event.retarget:4". For extra logging (getting +// frame dumps, use MOZ_LOG="event.retarget:5". +static mozilla::LazyLogModule sEvtTgtLog("event.retarget"); +#define PET_LOG(...) MOZ_LOG(sEvtTgtLog, LogLevel::Debug, (__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 (,