chromium/ui/events/blink/web_input_event.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/events/blink/web_input_event.h"

#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/blink/blink_features.h"
#include "ui/events/event.h"
#include "ui/events/event_target.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/dom/keycode_converter.h"

#if BUILDFLAG(IS_WIN)
#include "ui/events/blink/web_input_event_builders_win.h"
#endif

namespace ui {

namespace {

gfx::PointF GetScreenLocationFromEvent(const LocatedEvent& event) {}

// Creates a WebGestureEvent from a GestureEvent. Note that it does not
// populate the event coordinates (i.e. |x|, |y|, |globalX|, and |globalY|). So
// the caller must populate these fields.
blink::WebGestureEvent MakeWebGestureEventFromUIEvent(
    const GestureEvent& event) {}

}  // namespace

#if BUILDFLAG(IS_WIN)
// On Windows, we can just use the builtin WebKit factory methods to fully
// construct our pre-translated events.

blink::WebMouseEvent MakeUntranslatedWebMouseEventFromNativeEvent(
    const PlatformEvent& native_event,
    const base::TimeTicks& time_stamp,
    blink::WebPointerProperties::PointerType pointer_type) {
  return WebMouseEventBuilder::Build(native_event.hwnd, native_event.message,
                                     native_event.wParam, native_event.lParam,
                                     time_stamp, pointer_type);
}

blink::WebMouseWheelEvent MakeUntranslatedWebMouseWheelEventFromNativeEvent(
    const PlatformEvent& native_event,
    const base::TimeTicks& time_stamp,
    blink::WebPointerProperties::PointerType pointer_type) {
  return WebMouseWheelEventBuilder::Build(
      native_event.hwnd, native_event.message, native_event.wParam,
      native_event.lParam, time_stamp, pointer_type);
}
#endif  // BUILDFLAG(IS_WIN)

blink::WebKeyboardEvent MakeWebKeyboardEventFromUiEvent(const KeyEvent& event) {}

blink::WebMouseWheelEvent MakeWebMouseWheelEventFromUiEvent(
    const ScrollEvent& event) {}

blink::WebGestureEvent MakeWebGestureEventFromUiEvent(
    const ScrollEvent& event) {}

blink::WebMouseEvent MakeWebMouseEventFromUiEvent(const MouseEvent& event);
blink::WebMouseWheelEvent MakeWebMouseWheelEventFromUiEvent(
    const MouseWheelEvent& event);

// General approach:
//
// Event only carries a subset of possible event data provided to UI by the host
// platform. WebKit utilizes a larger subset of that information, and includes
// some built in cracking functionality that we rely on to obtain this
// information cleanly and consistently.
//
// The only place where an Event's data differs from what the underlying
// PlatformEvent would provide is position data. We would like to provide
// coordinates relative to its hosting window, rather than the top level
// platform window. The event target is used to get the screen coordinates.
//
// The approach is to fully construct a blink::WebInputEvent from the
// Event's PlatformEvent, and then replace the coordinate fields with
// the translated values from the Event (and EventTarget).
//
// The exception is mouse events on linux. The MouseEvent contains enough
// necessary information to construct a WebMouseEvent. So instead of extracting
// the information from the XEvent, which can be tricky when supporting both
// XInput2 and XInput, the WebMouseEvent is constructed from the
// MouseEvent. This will not be necessary once only XInput2 is supported.
//

blink::WebMouseEvent MakeWebMouseEvent(const MouseEvent& event) {}

blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const MouseWheelEvent& event) {}

blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ScrollEvent& event) {}

blink::WebKeyboardEvent MakeWebKeyboardEvent(const KeyEvent& event) {}

blink::WebGestureEvent MakeWebGestureEvent(const GestureEvent& event) {}

blink::WebGestureEvent MakeWebGestureEvent(const ScrollEvent& event) {}

blink::WebGestureEvent MakeWebGestureEventFlingCancel(
    const blink::WebMouseWheelEvent& wheel_event) {}

blink::WebMouseEvent MakeWebMouseEventFromUiEvent(const MouseEvent& event) {}

blink::WebMouseWheelEvent MakeWebMouseWheelEventFromUiEvent(
    const MouseWheelEvent& event) {}

}  // namespace ui