mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
libservo: Port desktop servoshell to use the new WebView
API (#35183)
This removes all uses of `EmbedderEvent` in the desktop servoshell to use the new `WebView` API -- filling it out when necessary. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
a1cf0cbf86
commit
9dbc942bee
15 changed files with 826 additions and 798 deletions
|
@ -7,17 +7,19 @@
|
|||
|
||||
use std::rc::Rc;
|
||||
|
||||
use arboard::Clipboard;
|
||||
use euclid::{Length, Scale};
|
||||
use servo::compositing::windowing::{EmbedderEvent, WindowMethods};
|
||||
use servo::compositing::windowing::WindowMethods;
|
||||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntSize, DevicePixel};
|
||||
use servo::Cursor;
|
||||
use servo::{Cursor, Servo};
|
||||
|
||||
use super::webview::{WebView, WebViewManager};
|
||||
|
||||
// This should vary by zoom level and maybe actual text size (focused or under cursor)
|
||||
pub const LINE_HEIGHT: f32 = 38.0;
|
||||
|
||||
pub trait WindowPortsMethods: WindowMethods {
|
||||
fn get_events(&self) -> Vec<EmbedderEvent>;
|
||||
fn id(&self) -> winit::window::WindowId;
|
||||
fn hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
self.device_pixel_ratio_override()
|
||||
|
@ -29,10 +31,18 @@ pub trait WindowPortsMethods: WindowMethods {
|
|||
) -> Option<Scale<f32, DeviceIndependentPixel, DevicePixel>>;
|
||||
fn page_height(&self) -> f32;
|
||||
fn get_fullscreen(&self) -> bool;
|
||||
fn queue_embedder_events_for_winit_event(&self, event: winit::event::WindowEvent);
|
||||
fn handle_winit_event(
|
||||
&self,
|
||||
servo: &Servo,
|
||||
clipboard: &mut Option<Clipboard>,
|
||||
webviews: &mut WebViewManager,
|
||||
event: winit::event::WindowEvent,
|
||||
);
|
||||
fn is_animating(&self) -> bool;
|
||||
fn set_title(&self, _title: &str) {}
|
||||
fn request_inner_size(&self, size: DeviceIntSize) -> Option<DeviceIntSize>;
|
||||
/// Request a new inner size for the window, not including external decorations.
|
||||
fn request_resize(&self, webview: &WebView, inner_size: DeviceIntSize)
|
||||
-> Option<DeviceIntSize>;
|
||||
fn set_position(&self, _point: DeviceIntPoint) {}
|
||||
fn set_fullscreen(&self, _state: bool) {}
|
||||
fn set_cursor(&self, _cursor: Cursor) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue