mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
LibWeb+LibWebView: Migrate Browser's input event handling to LibWebView
The Serenity chrome is the only chrome thus far that sends all input key and mouse events to WebContent, including shortcut activations. This is necessary for all chromes - we must give web pages a chance to intercept input events before handling them ourselves. To make this easier for other chromes, this patch moves Serenity's input event handling to LibWebView. To do so, we add the Web::InputEvent type, which models the event data we need within LibWeb. Chromes will then be responsible for converting between this type and their native events. This class lives in LibWeb (rather than LibWebView) because the plan is to use it wholesale throughout the Page's event handler and across IPC. Right now, we still send the individual fields of the event over IPC, but it will be an easy refactor to send the event itself. We just can't do this until all chromes have been ported to this event queueing. Also note that we now only handle key input events back in the chrome. WebContent handles all mouse events that it possibly can. If it was not able to handle a mouse event, there's nothing for the chrome to do (i.e. there is no clicking, scrolling, etc. the chrome is able to do if the WebContent couldn't).
This commit is contained in:
parent
f2204e2b3a
commit
ea682207d0
7 changed files with 191 additions and 148 deletions
|
@ -839,10 +839,9 @@ void WebContentClient::did_finish_handling_input_event(u64 page_id, bool event_w
|
|||
dbgln("Received finish handling input event for unknown page ID {}", page_id);
|
||||
return;
|
||||
}
|
||||
auto& view = *maybe_view.value();
|
||||
|
||||
if (view.on_finish_handling_input_event)
|
||||
view.on_finish_handling_input_event(event_was_accepted);
|
||||
auto& view = *maybe_view.value();
|
||||
view.did_finish_handling_input_event({}, event_was_accepted);
|
||||
}
|
||||
|
||||
void WebContentClient::did_change_theme_color(u64 page_id, Gfx::Color color)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue