mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
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>
This commit is contained in:
parent
175f28866d
commit
07aa4ce093
10 changed files with 176 additions and 230 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue