Apply pinch zoom deltas to the compositor's visual viewport transform so the currently presented display list can respond without waiting for the WebContent main thread. Keep the normal WebContent pinch event path so the real VisualViewport state and DOM-visible events catch up after. Only take the compositor path when async scrolling is enabled and there are no blocking wheel listeners, since pinch zoom dispatches a synthetic wheel event that script may cancel. Coalesce queued pinch events in WebContent so main-thread catch-up can adopt multiple gesture deltas together. Use the compositor visual viewport transform for wheel hit testing and consume wheel deltas as visual viewport pan while zoomed. Scale the handoff to layout viewport scrolling by the inverse visual viewport scale, so touchpad momentum does not jump when the visual viewport hits an edge.
25 lines
1.4 KiB
Text
25 lines
1.4 KiB
Text
#include <AK/Optional.h>
|
|
#include <LibGfx/Point.h>
|
|
#include <LibGfx/Size.h>
|
|
#include <LibIPC/TransportHandle.h>
|
|
#include <LibWeb/Compositor/Types.h>
|
|
#include <LibWeb/Page/InputEvent.h>
|
|
|
|
endpoint CompositorControlServer
|
|
{
|
|
init_transport(int peer_pid) => (int peer_pid)
|
|
|
|
connect_web_content() => (IPC::TransportHandle handle, i32 web_content_connection_id)
|
|
|
|
create_context(Web::Compositor::CompositorContextId context_id, Optional<u64> page_id, i32 web_content_connection_id) => ()
|
|
|
|
viewport_size_updated(Web::Compositor::CompositorContextId context_id, Gfx::IntSize viewport_size, Web::Compositor::WindowResizingInProgress window_resize_in_progress) =|
|
|
set_display_metadata(Web::Compositor::CompositorContextId context_id, Optional<u64> display_id, double refresh_rate) =|
|
|
|
|
handle_mouse_event(Web::Compositor::CompositorContextId context_id, Web::MouseEvent event) => (bool handled)
|
|
dispatch_mouse_event_to_web_content(Web::Compositor::CompositorContextId context_id, Web::MouseEvent event) => (bool dispatched)
|
|
handle_pinch_event(Web::Compositor::CompositorContextId context_id, Web::PinchEvent event) => (bool handled)
|
|
async_scroll_by(Web::Compositor::CompositorContextId context_id, Gfx::FloatPoint position, Gfx::FloatPoint delta_in_device_pixels) => (bool handled)
|
|
presented_bitmap_ready_to_paint(Web::Compositor::CompositorContextId context_id, i32 bitmap_id) =|
|
|
crash() =|
|
|
}
|