#include "third_party/blink/renderer/platform/widget/input/widget_base_input_handler.h"
#include <stddef.h>
#include <stdint.h>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "cc/metrics/event_metrics.h"
#include "cc/paint/element_id.h"
#include "cc/trees/latency_info_swap_promise_monitor.h"
#include "cc/trees/layer_tree_host.h"
#include "services/tracing/public/cpp/perfetto/flow_event_utils.h"
#include "services/tracing/public/cpp/perfetto/macros.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/web_gesture_device.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/input/web_input_event_attribution.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "third_party/blink/public/common/input/web_pointer_event.h"
#include "third_party/blink/public/common/input/web_touch_event.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
#include "third_party/blink/public/platform/web_input_event_result.h"
#include "third_party/blink/renderer/platform/widget/input/ime_event_guard.h"
#include "third_party/blink/renderer/platform/widget/widget_base.h"
#include "third_party/blink/renderer/platform/widget/widget_base_client.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "ui/latency/latency_info.h"
#if BUILDFLAG(IS_ANDROID)
#include <android/keycodes.h>
#endif
ChromeLatencyInfo;
TrackEvent;
namespace blink {
namespace {
void LogPassiveEventListenersUma(WebInputEventResult result,
WebInputEvent::DispatchType dispatch_type) { … }
void LogAllPassiveEventListenersUma(const WebInputEvent& input_event,
WebInputEventResult result) { … }
WebCoalescedInputEvent GetCoalescedWebPointerEventForTouch(
const WebPointerEvent& pointer_event,
const std::vector<std::unique_ptr<WebInputEvent>>& coalesced_events,
const std::vector<std::unique_ptr<WebInputEvent>>& predicted_events,
const ui::LatencyInfo& latency) { … }
mojom::blink::InputEventResultState GetAckResult(
WebInputEventResult processed) { … }
bool IsGestureScroll(WebInputEvent::Type type) { … }
gfx::PointF PositionInWidgetFromInputEvent(const WebInputEvent& event) { … }
bool IsTouchStartOrMove(const WebInputEvent& event) { … }
}
class WidgetBaseInputHandler::HandlingState { … };
WidgetBaseInputHandler::WidgetBaseInputHandler(WidgetBase* widget)
: … { … }
WebInputEventResult WidgetBaseInputHandler::HandleTouchEvent(
const WebCoalescedInputEvent& coalesced_event) { … }
void WidgetBaseInputHandler::HandleInputEvent(
const WebCoalescedInputEvent& coalesced_event,
std::unique_ptr<cc::EventMetrics> metrics,
HandledEventCallback callback) { … }
void WidgetBaseInputHandler::InjectScrollbarGestureScroll(
const gfx::Vector2dF& delta,
ui::ScrollGranularity granularity,
cc::ElementId scrollable_area_element_id,
WebInputEvent::Type injected_type) { … }
void WidgetBaseInputHandler::HandleInjectedScrollGestures(
Vector<InjectScrollGestureParams> injected_scroll_params,
const WebInputEvent& input_event,
const ui::LatencyInfo& original_latency_info,
const cc::EventMetrics* original_metrics) { … }
bool WidgetBaseInputHandler::DidChangeCursor(const ui::Cursor& cursor) { … }
bool WidgetBaseInputHandler::ProcessTouchAction(WebTouchAction touch_action) { … }
}