#include "components/input/render_widget_targeter.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "components/input/render_widget_host_view_input.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/blink/blink_event_util.h"
namespace input {
namespace {
gfx::PointF ComputeEventLocation(const blink::WebInputEvent& event) { … }
bool IsMouseMiddleClick(const blink::WebInputEvent& event) { … }
constexpr base::TimeDelta kAsyncHitTestTimeout = …;
}
RenderWidgetTargetResult::RenderWidgetTargetResult() = default;
RenderWidgetTargetResult::RenderWidgetTargetResult(
const RenderWidgetTargetResult&) = default;
RenderWidgetTargetResult::RenderWidgetTargetResult(
RenderWidgetHostViewInput* in_view,
bool in_should_query_view,
std::optional<gfx::PointF> in_location,
bool in_latched_target)
: … { … }
RenderWidgetTargetResult::~RenderWidgetTargetResult() = default;
RenderWidgetTargeter::TargetingRequest::TargetingRequest(
base::WeakPtr<RenderWidgetHostViewInput> root_view,
const blink::WebInputEvent& event,
const ui::LatencyInfo& latency) { … }
RenderWidgetTargeter::TargetingRequest::TargetingRequest(
base::WeakPtr<RenderWidgetHostViewInput> root_view,
const gfx::PointF& location,
RenderWidgetHostAtPointCallback callback) { … }
RenderWidgetTargeter::TargetingRequest::TargetingRequest(
TargetingRequest&& request) = default;
RenderWidgetTargeter::TargetingRequest& RenderWidgetTargeter::TargetingRequest::
operator=(TargetingRequest&&) = default;
RenderWidgetTargeter::TargetingRequest::~TargetingRequest() = default;
void RenderWidgetTargeter::TargetingRequest::RunCallback(
RenderWidgetHostViewInput* target,
std::optional<gfx::PointF> point) { … }
bool RenderWidgetTargeter::TargetingRequest::MergeEventIfPossible(
const blink::WebInputEvent& new_event) { … }
bool RenderWidgetTargeter::TargetingRequest::IsWebInputEventRequest() const { … }
blink::WebInputEvent* RenderWidgetTargeter::TargetingRequest::GetEvent() { … }
RenderWidgetHostViewInput*
RenderWidgetTargeter::TargetingRequest::GetRootView() const { … }
gfx::PointF RenderWidgetTargeter::TargetingRequest::GetLocation() const { … }
const ui::LatencyInfo& RenderWidgetTargeter::TargetingRequest::GetLatency()
const { … }
RenderWidgetTargeter::RenderWidgetTargeter(Delegate* delegate)
: … { … }
RenderWidgetTargeter::~RenderWidgetTargeter() = default;
void RenderWidgetTargeter::FindTargetAndDispatch(
RenderWidgetHostViewInput* root_view,
const blink::WebInputEvent& event,
const ui::LatencyInfo& latency) { … }
void RenderWidgetTargeter::FindTargetAndCallback(
RenderWidgetHostViewInput* root_view,
const gfx::PointF& point,
RenderWidgetHostAtPointCallback callback) { … }
void RenderWidgetTargeter::ResolveTargetingRequest(TargetingRequest request) { … }
void RenderWidgetTargeter::ViewWillBeDestroyed(
RenderWidgetHostViewInput* view) { … }
bool RenderWidgetTargeter::HasEventsPendingDispatch() const { … }
void RenderWidgetTargeter::SetIsAutoScrollInProgress(
bool autoscroll_in_progress) { … }
void RenderWidgetTargeter::QueryClient(
RenderWidgetHostViewInput* target,
const gfx::PointF& target_location,
RenderWidgetHostViewInput* last_request_target,
const gfx::PointF& last_target_location,
TargetingRequest request) { … }
void RenderWidgetTargeter::FlushEventQueue() { … }
void RenderWidgetTargeter::FoundFrameSinkId(
base::WeakPtr<RenderWidgetHostViewInput> target,
uint32_t request_id,
const gfx::PointF& target_location,
const viz::FrameSinkId& frame_sink_id,
const gfx::PointF& transformed_location) { … }
void RenderWidgetTargeter::FoundTarget(
RenderWidgetHostViewInput* target,
const std::optional<gfx::PointF>& target_location,
TargetingRequest* request) { … }
void RenderWidgetTargeter::AsyncHitTestTimedOut(
base::WeakPtr<RenderWidgetHostViewInput> current_request_target,
const gfx::PointF& current_target_location,
base::WeakPtr<RenderWidgetHostViewInput> last_request_target,
const gfx::PointF& last_target_location) { … }
void RenderWidgetTargeter::OnInputTargetDisconnect(
base::WeakPtr<RenderWidgetHostViewInput> target,
const gfx::PointF& location) { … }
}