Files
ladybird/Libraries/LibWeb/Painting/ChromeWidget.h
Zaggy1024 ee45cdfb09 LibWeb: Refactor pointer event handling/dispatch to work closer to spec
Pieces of the down, move, and up handlers are moved to separate
functions. Some part actually have specs, so the ones I've found thus
far have been brought in to make things more spec-aligned. A lot of
FIXMEs are added for things that the spec mentions or implies.

Pointer events are intended to be handled per pointer device, but this
still treats them the same as legacy mouse events. However, the PREVENT
MOUSE EVENT flag is implemented to block legacy mouse events for the
duration of a drag.

Behavior changes should be minimal.

One notable change is that auxclick is now fired for all non-primary
buttons, which matches the spec and other browsers.
2026-03-17 04:01:29 -05:00

37 lines
800 B
C++

/*
* Copyright (c) 2026, the Ladybird developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/EnumBits.h>
#include <LibGC/Cell.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/Forward.h>
#include <LibWeb/PixelUnits.h>
namespace Web::Painting {
enum class MouseAction : u8 {
None = 0,
CaptureInput = 1 << 0,
SwallowEvent = 1 << 1,
};
AK_ENUM_BITWISE_OPERATORS(MouseAction);
class ChromeWidget : public JS::Cell {
GC_CELL(ChromeWidget, JS::Cell);
public:
virtual MouseAction handle_pointer_event(FlyString const& type, unsigned button, CSSPixelPoint visual_viewport_position) = 0;
virtual void mouse_enter() = 0;
virtual void mouse_leave() = 0;
virtual Optional<CSS::CursorPredefined> cursor() const { return {}; }
};
}