diff options
author | Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me> | 2025-02-05 21:02:11 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-05 12:02:11 +0000 |
commit | 07aa4ce093547974800564f8231b3530721b1de9 (patch) | |
tree | 221e8c5e2322df7b6566d43a902f7c2321b1c2e5 /ports/servoshell/egl | |
parent | 175f28866dc254a98c4a911eb38ed9b200fdc6d1 (diff) | |
download | servo-07aa4ce093547974800564f8231b3530721b1de9.tar.gz servo-07aa4ce093547974800564f8231b3530721b1de9.zip |
Simplify `RenderingContext` trait methods (#35251)
There are a few methods are still difficult to implement without
the help of surfman. To simplify the trait methods, all methods that
return surfman types are removed. They are either handled by
embedders themselves or abstract to simpler types that servo
components need. The most noticeable changes are:
- Methods related to native surface are moved to servo_glue. The
embedder should decide when to remove/replace the surface and it's
outside of servo's scope.
- Methods required by servo media now return exact media types for it.
The other major change is sevevral difficult trait methods that are
reuiqred by WebGL and Servo media have default implementation. So they
can be optional for users to implement.
Signed-off-by: Wu Wayne <yuweiwu@pm.me>
Diffstat (limited to 'ports/servoshell/egl')
-rw-r--r-- | ports/servoshell/egl/servo_glue.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ports/servoshell/egl/servo_glue.rs b/ports/servoshell/egl/servo_glue.rs index ca1397f6747..7986388b35b 100644 --- a/ports/servoshell/egl/servo_glue.rs +++ b/ports/servoshell/egl/servo_glue.rs @@ -405,7 +405,9 @@ impl ServoGlue { } pub fn pause_compositor(&mut self) { - self.active_webview().invalidate_native_surface(); + if let Err(e) = self.rendering_context.unbind_native_surface_from_context() { + warn!("Unbinding native surface from context failed ({:?})", e); + } self.maybe_perform_updates(); } @@ -413,8 +415,17 @@ impl ServoGlue { if native_surface.is_null() { panic!("null passed for native_surface"); } - self.active_webview() - .replace_native_surface(native_surface, coords.framebuffer); + let connection = self.rendering_context.connection(); + let native_widget = unsafe { + connection + .create_native_widget_from_ptr(native_surface, coords.framebuffer.to_untyped()) + }; + if let Err(e) = self + .rendering_context + .bind_native_surface_to_context(native_widget) + { + warn!("Binding native surface to context failed ({:?})", e); + } self.maybe_perform_updates() } |