From 71ddadb482f0f4ffb3c94f43c9b7b965cd69e6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 10 May 2026 22:56:03 -0400 Subject: [PATCH] Wire HardwareOffscreenContext::connection() so Servo's painter constructs --- .../src/hardware_rendering_context.rs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/crates/ely_servo_host/src/hardware_rendering_context.rs b/crates/ely_servo_host/src/hardware_rendering_context.rs index ea80310..83eb980 100644 --- a/crates/ely_servo_host/src/hardware_rendering_context.rs +++ b/crates/ely_servo_host/src/hardware_rendering_context.rs @@ -17,12 +17,17 @@ //! //! Scope kept deliberately narrow: //! -//! * Only the methods `RenderingContext` requires for software-style -//! readback are vendored (`prepare_for_rendering`, `read_to_image`, -//! `size`, `resize`, `present`, `make_current`, `gleam_gl_api`, -//! `glow_gl_api`). `create_texture`/`destroy_texture`/`connection` -//! fall through to the trait's `None` defaults — Servo uses them -//! only when sharing surfman surfaces with its own compositor. +//! * `prepare_for_rendering`, `read_to_image`, `size`, `resize`, +//! `present`, `make_current`, `gleam_gl_api`, `glow_gl_api`, and +//! `connection` are vendored. `connection` is mandatory: +//! `servo-paint`'s painter calls `rendering_context.connection() +//! .expect("Failed to get connection")` while constructing its +//! painter, so a `None` default panics the compositor before the +//! first frame is ever painted. +//! * `create_texture`/`destroy_texture` still fall through to the +//! trait defaults — Servo only reaches for them when sharing +//! surfman surfaces with its compositor for WebGL/WebGPU, which +//! this readback path does not exercise. //! * No `RefreshDriver`. The sidecar drives its own polling loop. //! * The reading path inlines `read_framebuffer_to_image` from the //! same upstream file so we don't take a dependency on a private @@ -136,6 +141,10 @@ impl RenderingContext for HardwareOffscreenContext { fn glow_gl_api(&self) -> Arc { self.inner.glow_gl.clone() } + + fn connection(&self) -> Option { + Some(self.inner.device.borrow().connection()) + } } /// Trimmed mirror of `paint_api::rendering_context::SurfmanRenderingContext`.