mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
We were using a separately fired timer for auto scrolling ticks, but it makes more sense to tie this into the rendering steps of which `::run_the_scroll_steps()` is a part. Should fix the flaky `Text/input/viewport-auto-scroll.html` test. Fixes #7939.
41 lines
879 B
C++
41 lines
879 B
C++
/*
|
|
* Copyright (c) 2026, Jelle Raaijmakers <jelle@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGC/Ptr.h>
|
|
#include <LibJS/Heap/Cell.h>
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/PixelUnits.h>
|
|
|
|
namespace Web {
|
|
|
|
class AutoScrollHandler {
|
|
public:
|
|
AutoScrollHandler(HTML::Navigable&, DOM::Element& container);
|
|
|
|
void visit_edges(JS::Cell::Visitor&) const;
|
|
|
|
CSSPixelPoint process(CSSPixelPoint mouse_position);
|
|
void perform_tick();
|
|
|
|
bool is_active() const { return m_active; }
|
|
|
|
static GC::Ptr<DOM::Element> find_scrollable_ancestor(Painting::Paintable const&);
|
|
|
|
private:
|
|
void activate();
|
|
void deactivate();
|
|
|
|
GC::Ref<HTML::Navigable> m_navigable;
|
|
GC::Ref<DOM::Element> m_container_element;
|
|
CSSPixelPoint m_mouse_position;
|
|
CSSPixelPoint m_fractional_delta;
|
|
bool m_active { false };
|
|
};
|
|
|
|
}
|