mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
LibWeb+LibWebView+WebContent: Return a named enum from UI event handlers
UI event handlers currently return a boolean where false means the event was cancelled by a script on the page, or otherwise dropped. It has been a point of confusion for some time now, as it's not particularly clear what should be returned in some special cases, or how the UI process should handle the response. This adds an enumeration with a few states that indicate exactly how the WebContent process handled the event. This should remove all ambiguity, and let us properly handle these states going forward. There should be no behavior change with this patch. It's meant to only introduce the enum, not change any of our decisions based on the result.
This commit is contained in:
@@ -147,11 +147,11 @@ void ViewImplementation::enqueue_input_event(Web::InputEvent event)
|
||||
});
|
||||
}
|
||||
|
||||
void ViewImplementation::did_finish_handling_input_event(Badge<WebContentClient>, bool event_was_accepted)
|
||||
void ViewImplementation::did_finish_handling_input_event(Badge<WebContentClient>, Web::EventResult event_result)
|
||||
{
|
||||
auto event = m_pending_input_events.dequeue();
|
||||
|
||||
if (event_was_accepted)
|
||||
if (event_result == Web::EventResult::Handled)
|
||||
return;
|
||||
|
||||
// Here we handle events that were not consumed or cancelled by the WebContent. Propagate the event back
|
||||
|
||||
Reference in New Issue
Block a user