Wire HardwareOffscreenContext::connection() so Servo's painter constructs

This commit is contained in:
2026-05-10 22:56:03 -04:00
parent 320da3ddb5
commit 71ddadb482
@@ -17,12 +17,17 @@
//! //!
//! Scope kept deliberately narrow: //! Scope kept deliberately narrow:
//! //!
//! * Only the methods `RenderingContext` requires for software-style //! * `prepare_for_rendering`, `read_to_image`, `size`, `resize`,
//! readback are vendored (`prepare_for_rendering`, `read_to_image`, //! `present`, `make_current`, `gleam_gl_api`, `glow_gl_api`, and
//! `size`, `resize`, `present`, `make_current`, `gleam_gl_api`, //! `connection` are vendored. `connection` is mandatory:
//! `glow_gl_api`). `create_texture`/`destroy_texture`/`connection` //! `servo-paint`'s painter calls `rendering_context.connection()
//! fall through to the trait's `None` defaults — Servo uses them //! .expect("Failed to get connection")` while constructing its
//! only when sharing surfman surfaces with its own compositor. //! 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. //! * No `RefreshDriver`. The sidecar drives its own polling loop.
//! * The reading path inlines `read_framebuffer_to_image` from the //! * The reading path inlines `read_framebuffer_to_image` from the
//! same upstream file so we don't take a dependency on a private //! 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<glow::Context> { fn glow_gl_api(&self) -> Arc<glow::Context> {
self.inner.glow_gl.clone() self.inner.glow_gl.clone()
} }
fn connection(&self) -> Option<Connection> {
Some(self.inner.device.borrow().connection())
}
} }
/// Trimmed mirror of `paint_api::rendering_context::SurfmanRenderingContext`. /// Trimmed mirror of `paint_api::rendering_context::SurfmanRenderingContext`.