diff options
Diffstat (limited to 'ports/servoshell/desktop/app_state.rs')
-rw-r--r-- | ports/servoshell/desktop/app_state.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ports/servoshell/desktop/app_state.rs b/ports/servoshell/desktop/app_state.rs index b9ebf2e7534..3bb381bb1a0 100644 --- a/ports/servoshell/desktop/app_state.rs +++ b/ports/servoshell/desktop/app_state.rs @@ -17,9 +17,9 @@ use servo::ipc_channel::ipc::IpcSender; use servo::webrender_api::ScrollLocation; use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize}; use servo::{ - AllowOrDenyRequest, AuthenticationRequest, FilterPattern, GamepadHapticEffectType, LoadStatus, - PermissionRequest, Servo, ServoDelegate, ServoError, SimpleDialog, TouchEventType, WebView, - WebViewDelegate, + AllowOrDenyRequest, AuthenticationRequest, FilterPattern, FormControl, GamepadHapticEffectType, + LoadStatus, PermissionRequest, Servo, ServoDelegate, ServoError, SimpleDialog, TouchEventType, + WebView, WebViewDelegate, }; use url::Url; @@ -583,4 +583,19 @@ impl WebViewDelegate for RunningAppState { fn hide_ime(&self, _webview: WebView) { self.inner().window.hide_ime(); } + + fn show_form_control(&self, webview: WebView, form_control: FormControl) { + if self.servoshell_preferences.headless { + return; + } + + match form_control { + FormControl::SelectElement(prompt) => { + // FIXME: Reading the toolbar height is needed here to properly position the select dialog. + // But if the toolbar height changes while the dialog is open then the position won't be updated + let offset = self.inner().window.toolbar_height(); + self.add_dialog(webview, Dialog::new_select_element_dialog(prompt, offset)); + }, + } + } } |