chore: remove WindowMethods::rendering_context (#34780)

* Create Servo without initial webview ID

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Add rendering context in App struct

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Make webview manager optional

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Move window creation to init

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Create window from external rendering context

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Resize surface in compositor

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Obey clippy

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Update Android and OHOS

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Add missing arguent on OHOS

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Show webview after focused on Android and OH

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Remove rendering_context in ServoWindowCallbacks

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Create surface before swapchain in headless mode

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

---------

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2025-01-01 17:26:23 +09:00 committed by GitHub
parent 59c7ac680e
commit d581acab3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 200 additions and 253 deletions

View file

@ -363,33 +363,13 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
composite_target: CompositeTarget,
exit_after_load: bool,
convert_mouse_to_touch: bool,
top_level_browsing_context_id: TopLevelBrowsingContextId,
version_string: String,
) -> Self {
let embedder_coordinates = window.get_coordinates();
let mut webviews = WebViewManager::default();
webviews
.add(
top_level_browsing_context_id,
WebView {
pipeline_id: None,
rect: embedder_coordinates.get_viewport().to_f32(),
},
)
.expect("Infallible with a new WebViewManager");
let msg = ConstellationMsg::WebViewOpened(top_level_browsing_context_id);
if let Err(e) = state.constellation_chan.send(msg) {
warn!("Sending event to constellation failed ({:?}).", e);
}
webviews
.show(top_level_browsing_context_id)
.expect("Infallible due to add");
let compositor = IOCompositor {
embedder_coordinates: window.get_coordinates(),
window,
port: state.receiver,
webviews,
webviews: WebViewManager::default(),
pipeline_details: HashMap::new(),
composition_request: CompositionRequest::NoCompositingNecessary,
touch_handler: TouchHandler::new(),
@ -1360,7 +1340,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
if self.embedder_coordinates.viewport != old_coords.viewport {
let mut transaction = Transaction::new();
transaction.set_document_view(self.embedder_coordinates.get_viewport());
let size = self.embedder_coordinates.get_viewport();
transaction.set_document_view(size);
if let Err(e) = self.rendering_context.resize(size.size().to_untyped()) {
warn!("Failed to resize surface: {e:?}");
}
self.webrender_api
.send_transaction(self.webrender_document, transaction);
}

View file

@ -23,7 +23,6 @@ use webrender_api::units::{
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel, DevicePoint, DeviceRect,
};
use webrender_api::ScrollLocation;
use webrender_traits::RenderingContext;
#[derive(Clone)]
pub enum MouseWindowEvent {
@ -218,8 +217,6 @@ pub trait WindowMethods {
/// will want to avoid blocking on UI events, and just
/// run the event loop at the vsync interval.
fn set_animation_state(&self, _state: AnimationState);
/// Get the [`RenderingContext`] of this Window.
fn rendering_context(&self) -> RenderingContext;
}
pub trait EmbedderMethods {