#include "third_party/blink/renderer/core/loader/anchor_element_interaction_tracker.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "third_party/blink/public/common/input/web_pointer_properties.h"
#include "third_party/blink/public/mojom/preloading/anchor_element_interaction_host.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/core/events/pointer_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/screen.h"
#include "third_party/blink/renderer/core/html/anchor_element_metrics.h"
#include "third_party/blink/renderer/core/html/anchor_element_metrics_sender.h"
#include "third_party/blink/renderer/core/pointer_type_names.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
namespace blink {
namespace {
constexpr double eps = …;
const base::TimeDelta kMousePosQueueTimeDelta{ … };
const base::TimeDelta kMouseAccelerationAndVelocityInterval{ … };
}
AnchorElementInteractionTracker::MouseMotionEstimator::MouseMotionEstimator(
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
void AnchorElementInteractionTracker::MouseMotionEstimator::Trace(
Visitor* visitor) const { … }
double AnchorElementInteractionTracker::MouseMotionEstimator::
GetMouseTangentialAcceleration() const { … }
inline void AnchorElementInteractionTracker::MouseMotionEstimator::AddDataPoint(
base::TimeTicks timestamp,
gfx::PointF position) { … }
inline void
AnchorElementInteractionTracker::MouseMotionEstimator::RemoveOldDataPoints(
base::TimeTicks now) { … }
void AnchorElementInteractionTracker::MouseMotionEstimator::Update() { … }
void AnchorElementInteractionTracker::MouseMotionEstimator::OnTimer(
TimerBase*) { … }
void AnchorElementInteractionTracker::MouseMotionEstimator::OnMouseMoveEvent(
gfx::PointF position) { … }
void AnchorElementInteractionTracker::MouseMotionEstimator::
SetTaskRunnerForTesting(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const base::TickClock* clock) { … }
AnchorElementInteractionTracker::AnchorElementInteractionTracker(
Document& document)
: … { … }
AnchorElementInteractionTracker::~AnchorElementInteractionTracker() = default;
void AnchorElementInteractionTracker::Trace(Visitor* visitor) const { … }
bool AnchorElementInteractionTracker::IsFeatureEnabled() { … }
bool AnchorElementInteractionTracker::IsMouseMotionEstimatorEnabled() { … }
base::TimeDelta AnchorElementInteractionTracker::GetHoverDwellTime() { … }
void AnchorElementInteractionTracker::OnMouseMoveEvent(
const WebMouseEvent& mouse_event) { … }
void AnchorElementInteractionTracker::OnPointerEvent(
EventTarget& target,
const PointerEvent& pointer_event) { … }
void AnchorElementInteractionTracker::OnClickEvent(
HTMLAnchorElement& anchor,
const MouseEvent& click_event) { … }
void AnchorElementInteractionTracker::OnScrollEnd() { … }
void AnchorElementInteractionTracker::HoverTimerFired(TimerBase*) { … }
void AnchorElementInteractionTracker::SetTaskRunnerForTesting(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const base::TickClock* clock) { … }
HTMLAnchorElement*
AnchorElementInteractionTracker::FirstAnchorElementIncludingSelf(Node* node) { … }
KURL AnchorElementInteractionTracker::GetHrefEligibleForPreloading(
const HTMLAnchorElement& anchor) { … }
}