diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-11 16:49:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-11 16:49:25 +0200 |
commit | 54cd8dfc4db0688fbef9571137a1b45c99226b04 (patch) | |
tree | 52276d267c0e9aa7e5f954f7aedff2e6bc46942d /Userland/Services/WebContent | |
parent | e43fba0c58d9c8bb0e4bd7bf6ca915ce71fa5bd4 (diff) | |
download | serenity-54cd8dfc4db0688fbef9571137a1b45c99226b04.zip |
LibWeb+WebContent: Support image context menus in OOPWV
You can now right-click images in web content and get a context menu.
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r-- | Userland/Services/WebContent/PageHost.cpp | 7 | ||||
-rw-r--r-- | Userland/Services/WebContent/PageHost.h | 3 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebContentClient.ipc | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index e688549663..e67ba3d366 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -203,4 +203,9 @@ void PageHost::page_did_change_favicon(const Gfx::Bitmap& favicon) m_client.post_message(Messages::WebContentClient::DidChangeFavicon(favicon.to_shareable_bitmap())); } +void PageHost::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const URL& url, const String& target, unsigned modifiers, const Gfx::Bitmap* bitmap) +{ + m_client.post_message(Messages::WebContentClient::DidRequestImageContextMenu(content_position, url, target, modifiers, bitmap->to_shareable_bitmap())); +} + } diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index 315b3bc34c..38c74744b8 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,6 +78,7 @@ private: virtual bool page_did_request_confirm(const String&) override; virtual String page_did_request_prompt(const String&, const String&) override; virtual void page_did_change_favicon(const Gfx::Bitmap&) override; + virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override; explicit PageHost(ClientConnection&); diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc index baa51492ad..b78a88bef9 100644 --- a/Userland/Services/WebContent/WebContentClient.ipc +++ b/Userland/Services/WebContent/WebContentClient.ipc @@ -18,6 +18,7 @@ endpoint WebContentClient = 90 DidMiddleClickLink(URL url, String target, unsigned modifiers) =| DidRequestContextMenu(Gfx::IntPoint content_position) =| DidRequestLinkContextMenu(Gfx::IntPoint content_position, URL url, String target, unsigned modifiers) =| + DidRequestImageContextMenu(Gfx::IntPoint content_position, URL url, String target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =| DidRequestAlert(String message) => () DidRequestConfirm(String message) => (bool result) DidRequestPrompt(String message, String default_) => (String response) |