mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Schedule input event processing on HTML event loop
Our existing coalescing mechanism for input events didn't prevent multiple mousemove/mousewheel events from being processed between paint cycles. Since handling these events can trigger style & layout updates solely for hit-testing purposes, we might end up doing work that won't be observable by a user and could be avoided by shceduling input events processing to happen right before painting the next frame.
This commit is contained in:
parent
9072a7caef
commit
d3c481f71a
Notes:
github-actions[bot]
2025-02-15 20:10:12 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: d3c481f71a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3582
10 changed files with 90 additions and 70 deletions
|
@ -47,6 +47,8 @@ public:
|
|||
|
||||
Function<void(IPC::File const&)> on_image_decoder_connection;
|
||||
|
||||
Queue<Web::QueuedInputEvent>& input_event_queue() { return m_input_event_queue; }
|
||||
|
||||
private:
|
||||
explicit ConnectionFromClient(GC::Heap&, IPC::Transport);
|
||||
|
||||
|
@ -149,26 +151,15 @@ private:
|
|||
|
||||
virtual void system_time_zone_changed() override;
|
||||
|
||||
void report_finished_handling_input_event(u64 page_id, Web::EventResult event_was_handled);
|
||||
|
||||
GC::Heap& m_heap;
|
||||
NonnullOwnPtr<PageHost> m_page_host;
|
||||
|
||||
HashMap<int, Web::FileRequest> m_requested_files {};
|
||||
int last_id { 0 };
|
||||
|
||||
struct QueuedInputEvent {
|
||||
u64 page_id { 0 };
|
||||
Web::InputEvent event;
|
||||
size_t coalesced_event_count { 0 };
|
||||
};
|
||||
void enqueue_input_event(Web::QueuedInputEvent);
|
||||
|
||||
void enqueue_input_event(QueuedInputEvent);
|
||||
void process_next_input_event();
|
||||
|
||||
Queue<QueuedInputEvent> m_input_event_queue;
|
||||
|
||||
GC::Root<Web::Platform::Timer> m_input_event_queue_timer;
|
||||
Queue<Web::QueuedInputEvent> m_input_event_queue;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue