Auto merge of #26043 - paulrouget:IMMenu, r=jdm

Context menu API

This adds an API for Servo internals to request a context menu to the embedder, along an implement for the UWP port.
This commit is contained in:
bors-servo 2020-03-30 03:08:08 -04:00 committed by GitHub
commit c3ecf2ecef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 132 additions and 10 deletions

View file

@ -43,7 +43,7 @@ void on_ime_state_changed(bool aShow) {
sServo->Delegate().OnServoIMEStateChanged(aShow);
}
void set_clipboard_contents(const char *content) {
void set_clipboard_contents(const char *) {
// FIXME
}
@ -67,6 +67,14 @@ void prompt_alert(const char *message, bool trusted) {
sServo->Delegate().OnServoPromptAlert(char2hstring(message), trusted);
}
void show_context_menu(const char *const *items_list, uint32_t items_size) {
std::vector<winrt::hstring> items;
for (uint32_t i = 0; i < items_size; i++) {
items.push_back(char2hstring(items_list[i]));
}
sServo->Delegate().OnServoShowContextMenu(items);
}
void on_devtools_started(Servo::DevtoolsServerState result,
const unsigned int port) {
sServo->Delegate().OnServoDevtoolsStarted(
@ -150,6 +158,7 @@ Servo::Servo(hstring url, hstring args, GLsizei width, GLsizei height,
c.prompt_yes_no = &prompt_yes_no;
c.prompt_input = &prompt_input;
c.on_devtools_started = &on_devtools_started;
c.show_context_menu = &show_context_menu;
capi::register_panic_handler(&on_panic);