Truly independent web browser
LibWebView: Let views learn how pages handled their mouse events
Luke Wilde572fd121f31f
diff --git a/Libraries/LibWebView/ViewImplementation.cpp b/Libraries/LibWebView/ViewImplementation.cppindex dbf8f1671e8..03206d2f228 100644--- a/Libraries/LibWebView/ViewImplementation.cpp+++ b/Libraries/LibWebView/ViewImplementation.cpp@@ -977,6 +977,14 @@ void ViewImplementation::did_finish_handling_input_event(Badge<WebContentPage>,pending.endpoint->give_user_activation();}+ // A view can decide what a mouse event goes on to do by whether the page handled it, such as whether the page+ // claimed the press that starts a drag.+ if (auto const* mouse_event = event.get_pointer<Web::MouseEvent>()) {+ if (on_finish_handling_mouse_event)+ on_finish_handling_mouse_event(*mouse_event, event_result);+ return;+ }+if (event_result == Web::EventResult::Handled || event_result == Web::EventResult::Cancelled)return;diff --git a/Libraries/LibWebView/ViewImplementation.h b/Libraries/LibWebView/ViewImplementation.hindex 96c2b13fdea..397a9a5d7b2 100644--- a/Libraries/LibWebView/ViewImplementation.h+++ b/Libraries/LibWebView/ViewImplementation.h@@ -519,6 +519,7 @@ public:Function<void(Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles)> on_request_file_picker;Function<void(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items)> on_request_select_dropdown;Function<void(Web::KeyEvent const&)> on_finish_handling_key_event;+ Function<void(Web::MouseEvent const&, Web::EventResult)> on_finish_handling_mouse_event;Function<void(Web::DragEvent const&)> on_finish_handling_drag_event;Function<void(String const&)> on_test_finish;Function<void(double milliseconds)> on_set_test_timeout;