ladybird/Libraries/LibWeb/Painting/ResizeHandle.h
Andreas Kling 7445cff5e8 LibWeb: Use retained data for hit testing
Build a hit-test display list while recording paint output. Use it as
source of truth for point hit testing instead of recursively walking the
paintable tree in reverse paint order.

The retained list records target paintables, visual context indices,
border radii, caret rects, and line metadata needed by hit testing. It
also keeps a spatial index so point queries inspect nearby items before
checking containment in paint order.

Refresh scroll state before hit testing so visual context transforms use
current scroll offsets. Add text tests for rounded hit regions and
selection across non-text content.
2026-05-30 13:50:48 +02:00

35 lines
932 B
C++

/*
* Copyright (c) 2026, the Ladybird developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGC/Weak.h>
#include <LibWeb/Painting/ChromeWidget.h>
#include <LibWeb/Painting/PaintableBox.h>
namespace Web::Painting {
class ResizeHandle final : public ChromeWidget {
public:
static NonnullRefPtr<ResizeHandle> create(PaintableBox&);
virtual bool contains(CSSPixelPoint position, ChromeMetrics const&) const override;
virtual MouseAction handle_pointer_event(FlyString const& type, unsigned button, CSSPixelPoint visual_viewport_position) override;
virtual void mouse_enter() override { }
virtual void mouse_leave() override { }
virtual Optional<CSS::CursorPredefined> cursor() const override;
private:
ResizeHandle(PaintableBox&);
WeakPtr<PaintableBox> m_paintable_box;
GC::Weak<DOM::Element> m_element;
OwnPtr<ElementResizeAction> m_resize_action;
};
}