mirror of
https://github.com/servo/servo.git
synced 2025-08-19 04:15:33 +01:00
servoshell: Port desktop servoshell to use delegate API (#35284)
Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
6b12499077
commit
5f08e4fa76
15 changed files with 1109 additions and 1258 deletions
|
@ -7,15 +7,13 @@
|
|||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use arboard::Clipboard;
|
||||
use euclid::num::Zero;
|
||||
use euclid::{Box2D, Length, Point2D, Scale, Size2D};
|
||||
use servo::compositing::windowing::{AnimationState, EmbedderCoordinates, WindowMethods};
|
||||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::webrender_api::units::{DeviceIntSize, DevicePixel};
|
||||
use servo::Servo;
|
||||
|
||||
use super::webview::{WebView, WebViewManager};
|
||||
use super::app_state::RunningAppState;
|
||||
use crate::desktop::window_trait::WindowPortsMethods;
|
||||
|
||||
pub struct Window {
|
||||
|
@ -58,10 +56,6 @@ impl Window {
|
|||
|
||||
Rc::new(window)
|
||||
}
|
||||
|
||||
pub fn new_uninit() -> Rc<dyn WindowPortsMethods> {
|
||||
Self::new(Default::default(), None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl WindowPortsMethods for Window {
|
||||
|
@ -69,7 +63,11 @@ impl WindowPortsMethods for Window {
|
|||
winit::window::WindowId::dummy()
|
||||
}
|
||||
|
||||
fn request_resize(&self, webview: &WebView, size: DeviceIntSize) -> Option<DeviceIntSize> {
|
||||
fn request_resize(
|
||||
&self,
|
||||
webview: &::servo::WebView,
|
||||
size: DeviceIntSize,
|
||||
) -> Option<DeviceIntSize> {
|
||||
// Surfman doesn't support zero-sized surfaces.
|
||||
let new_size = DeviceIntSize::new(size.width.max(1), size.height.max(1));
|
||||
if self.inner_size.get() == new_size {
|
||||
|
@ -81,7 +79,7 @@ impl WindowPortsMethods for Window {
|
|||
// Because we are managing the rendering surface ourselves, there will be no other
|
||||
// notification (such as from the display manager) that it has changed size, so we
|
||||
// must notify the compositor here.
|
||||
webview.servo_webview.notify_rendering_context_resized();
|
||||
webview.notify_rendering_context_resized();
|
||||
|
||||
Some(new_size)
|
||||
}
|
||||
|
@ -114,13 +112,7 @@ impl WindowPortsMethods for Window {
|
|||
self.animation_state.get() == AnimationState::Animating
|
||||
}
|
||||
|
||||
fn handle_winit_event(
|
||||
&self,
|
||||
_: &Servo,
|
||||
_: &mut Option<Clipboard>,
|
||||
_: &mut WebViewManager,
|
||||
_: winit::event::WindowEvent,
|
||||
) {
|
||||
fn handle_winit_event(&self, _: Rc<RunningAppState>, _: winit::event::WindowEvent) {
|
||||
// Not expecting any winit events.
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue