mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
libservo: Integrate context menu into the show_embedder_control API (#40402)
This PR integrates showing context menus into the `WebViewDelegate::show_embedder_control` API. In addition, `ContextMenuItem` and `ContextMenuAction` data types are exposed which abstract away the different components of the context menu. Later changes will implement this API for servoshell as well as add element-specific actions such as "Select All" and "Copy Image URL". Testing: This change adds a WebView API test. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
@@ -9,7 +9,6 @@ use std::mem;
|
||||
use std::rc::Rc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use base::generic_channel;
|
||||
use constellation_traits::{KeyboardScroll, ScriptToConstellationMessage};
|
||||
use embedder_traits::{
|
||||
Cursor, EditingActionEvent, EmbedderMsg, GamepadEvent as EmbedderGamepadEvent,
|
||||
@@ -763,15 +762,10 @@ impl DocumentEventHandler {
|
||||
|
||||
// Step 4. If result is true, then show the UA context menu
|
||||
if result {
|
||||
let (sender, receiver) =
|
||||
generic_channel::channel().expect("Failed to create IPC channel.");
|
||||
self.window.send_to_embedder(EmbedderMsg::ShowContextMenu(
|
||||
self.window.webview_id(),
|
||||
sender,
|
||||
None,
|
||||
vec![],
|
||||
));
|
||||
let _ = receiver.recv().unwrap();
|
||||
self.window
|
||||
.Document()
|
||||
.embedder_controls()
|
||||
.show_context_menu(hit_test_result);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user