Truly independent web browser
LibCompositing+LibWeb+Compositor: Give every canvas and video a layer
Aliaksandr Kalenikf94b29127f79
diff --git a/Libraries/LibCompositing/Rust/src/display_list/layers.rs b/Libraries/LibCompositing/Rust/src/display_list/layers.rsindex de0ac287abe..15499e6b2f3 100644--- a/Libraries/LibCompositing/Rust/src/display_list/layers.rs+++ b/Libraries/LibCompositing/Rust/src/display_list/layers.rs@@ -78,7 +78,7 @@ impl std::fmt::Display for MediaLayerRejection {#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum UnlayeredReason {- NoActiveMedia,+ NoMedia,EmptyViewport,EmptyDisplayList,SortingContext3D,@@ -86,7 +86,6 @@ pub enum UnlayeredReason {BlendModeReadsRootGroup,CommandBlendsWithRootGroup,MaskDeclaredOutsideItsMask,- ActiveMediaNotDrawn,NoMediaCanBeLayer {first_rejected_media: LiveContent,rejection: MediaLayerRejection,@@ -107,7 +106,7 @@ impl std::fmt::Display for UnlayeredReason {"painted layers larger than {MAXIMUM_UPPER_PAINTED_LAYER_AREA_IN_VIEWPORTS} viewports");}- UnlayeredReason::NoActiveMedia => "no canvas or video keeps updating",+ UnlayeredReason::NoMedia => "no canvas, video or nested context is drawn",UnlayeredReason::EmptyViewport => "empty viewport",UnlayeredReason::EmptyDisplayList => "empty display list",UnlayeredReason::SortingContext3D => "3D sorting context",@@ -115,7 +114,6 @@ impl std::fmt::Display for UnlayeredReason {UnlayeredReason::BlendModeReadsRootGroup => "blend mode reads the root group",UnlayeredReason::CommandBlendsWithRootGroup => "command blends with the root group",UnlayeredReason::MaskDeclaredOutsideItsMask => "mask content declared outside its mask",- UnlayeredReason::ActiveMediaNotDrawn => "no updating canvas or video is drawn",};formatter.write_str(text)}@@ -240,7 +238,6 @@ pub struct LayerPlanInputs<'a> {pub tree: &'a VisualContextTree,pub scroll_offsets: &'a [FloatPoint],pub viewport_rect: IntRect,- pub active_media: &'a [LiveContent],}fn tree_has_sorting_contexts(tree: &VisualContextTree) -> bool {@@ -639,7 +636,7 @@ fn media_candidates(let mut first_rejection = None;for live_content_record in &inputs.summary.live_content_records {let content = live_content_record.content;- if matches!(content, LiveContent::ImageFrame(_)) || !inputs.active_media.contains(&content) {+ if matches!(content, LiveContent::ImageFrame(_)) {continue;}let IndexedRecord {@@ -669,7 +666,7 @@ fn media_candidates(}}if candidates.is_empty() {- return Err(first_rejection.unwrap_or(UnlayeredReason::ActiveMediaNotDrawn));+ return Err(first_rejection.unwrap_or(UnlayeredReason::NoMedia));}Ok(candidates)}@@ -797,8 +794,13 @@ fn place_records_in_layers(pub fn build_layer_plan(inputs: &LayerPlanInputs<'_>) -> Result<LayerPlan, UnlayeredReason> {let tree = inputs.tree;let command_runs = inputs.command_runs;- if inputs.active_media.is_empty() {- return Err(UnlayeredReason::NoActiveMedia);+ let draws_media = inputs+ .summary+ .live_content_records+ .iter()+ .any(|record| !matches!(record.content, LiveContent::ImageFrame(_)));+ if !draws_media {+ return Err(UnlayeredReason::NoMedia);}if inputs.viewport_rect.is_empty() {return Err(UnlayeredReason::EmptyViewport);@@ -1069,15 +1071,6 @@ mod tests {}fn plan(&self, tree: &VisualContextTree, scroll_offsets: &[FloatPoint]) -> Result<LayerPlan, UnlayeredReason> {- self.plan_with_active_media(tree, scroll_offsets, &[CANVAS])- }-- fn plan_with_active_media(- &self,- tree: &VisualContextTree,- scroll_offsets: &[FloatPoint],- active_media: &[LiveContent],- ) -> Result<LayerPlan, UnlayeredReason> {let (tape, runs) = (self.builder.bytes(), self.builder.command_runs());let summary = summarize(tape, runs);let effect_clips = EffectClipPlan::new(tree, runs).unwrap();@@ -1089,7 +1082,6 @@ mod tests {tree,scroll_offsets,viewport_rect: VIEWPORT,- active_media,})}}@@ -1317,7 +1309,7 @@ mod tests {.with(nested_context(IntRect::new(100, 100, 200, 100)), root).with(fill(IntRect::new(150, 150, 20, 20)), root).with(fill(IntRect::new(500, 400, 20, 20)), elsewhere);- let plan = list.plan_with_active_media(&tree, &[], &[NESTED_CONTEXT]).unwrap();+ let plan = list.plan(&tree, &[]).unwrap();assert_eq!(kinds(&plan), ["base", "media", "painted"]);assert_eq!(plan.layers[1].kind,@@ -1334,16 +1326,13 @@ mod tests {fn a_canvas_keeps_its_layer_when_more_nested_contexts_than_layers_are_drawn_before_it() {let tree = identity_tree();let mut list = TestList::new();- let mut active_media = Vec::new();for index in 0..=MAXIMUM_MEDIA_LAYER_COUNT {let child_context_id = CompositorContextId(10 + index as u64);let rect = IntRect::new(index as i32 * 60, 0, 50, 50);list = list.with(nested_context_with_id(rect, child_context_id), ContextRef::default());- active_media.push(LiveContent::CompositedContext(child_context_id));}list = list.with(canvas(IntRect::new(0, 300, 200, 100)), ContextRef::default());- active_media.push(CANVAS);- let plan = list.plan_with_active_media(&tree, &[], &active_media).unwrap();+ let plan = list.plan(&tree, &[]).unwrap();let media_of_layers: Vec<LiveContent> = plan.layers.iter()@@ -1366,7 +1355,7 @@ mod tests {let group = tree.append_effect_node_under(root, effects(0.5, CompositingAndBlendingOperator::Normal));let list = TestList::new().with(nested_context(IntRect::new(100, 100, 200, 100)), group);assert_eq!(- list.plan_with_active_media(&tree, &[], &[NESTED_CONTEXT]),+ list.plan(&tree, &[]),Err(UnlayeredReason::NoMediaCanBeLayer {first_rejected_media: NESTED_CONTEXT,rejection: MediaLayerRejection::InsideGroupEffect,@@ -1410,23 +1399,10 @@ mod tests {}#[test]- fn a_canvas_that_does_not_update_is_not_a_layer() {+ fn a_list_without_canvases_videos_or_nested_contexts_is_not_layered() {let tree = identity_tree();- let list = TestList::new().with(canvas(IntRect::new(100, 100, 200, 100)), ContextRef::default());- let (tape, runs) = (list.builder.bytes(), list.builder.command_runs());- let summary = summarize(tape, runs);- let effect_clips = EffectClipPlan::new(&tree, runs).unwrap();- let plan = build_layer_plan(&LayerPlanInputs {- tape,- command_runs: runs,- summary: &summary,- effect_clips: &effect_clips,- tree: &tree,- scroll_offsets: &[],- viewport_rect: VIEWPORT,- active_media: &[],- });- assert_eq!(plan, Err(UnlayeredReason::NoActiveMedia));+ let list = TestList::new().with(fill(IntRect::new(100, 100, 200, 100)), ContextRef::default());+ assert_eq!(list.plan(&tree, &[]), Err(UnlayeredReason::NoMedia));}fn list_with_scrolled_box(tree: &mut VisualContextTree) -> (TestList, SpatialNodeIndex) {diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rsindex 3297a78cc6c..42d1bbfc609 100644--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs@@ -317,7 +317,7 @@ pub unsafe extern "C" fn painting_dump(visual_context_tree.compositor_scroll_table(),options.jsonl,);- let layer_plan = dump_layers_if_every_canvas_and_video_kept_updating(+ let layer_plan = dump_layers_if_list_draws_canvas_video_or_nested_context(&mut output,&display_list,visual_context_tree,@@ -596,7 +596,7 @@ fn dump_compositor_scroll_table(}// A list that draws no canvas, video or nested context gets no section.-fn dump_layers_if_every_canvas_and_video_kept_updating(+fn dump_layers_if_list_draws_canvas_video_or_nested_context(output: &mut String,display_list: &DisplayListStorage,tree: &VisualContextTree,@@ -607,14 +607,11 @@ fn dump_layers_if_every_canvas_and_video_kept_updating() -> Option<LayerPlan> {let (tape, command_runs) = (display_list.bytes(), display_list.command_runs());let summary = summarize(tape, command_runs);- let mut active_media = Vec::new();- for live_content_record in &summary.live_content_records {- let content = live_content_record.content;- if !matches!(content, LiveContent::ImageFrame(_)) && !active_media.contains(&content) {- active_media.push(content);- }- }- if active_media.is_empty() {+ let draws_canvas_video_or_nested_context = summary+ .live_content_records+ .iter()+ .any(|live_content_record| !matches!(live_content_record.content, LiveContent::ImageFrame(_)));+ if !draws_canvas_video_or_nested_context {return None;}let effect_clips =@@ -627,7 +624,6 @@ fn dump_layers_if_every_canvas_and_video_kept_updating(tree,scroll_offsets,viewport_rect: device_viewport_rect,- active_media: &active_media,});match layer_plan {Ok(layer_plan) if jsonl => {diff --git a/Services/Compositor/CompositorState.cpp b/Services/Compositor/CompositorState.cppindex 918559ecde5..3d26bf03087 100644--- a/Services/Compositor/CompositorState.cpp+++ b/Services/Compositor/CompositorState.cpp@@ -1745,9 +1745,6 @@ RustFFI::FfiRasterHost CompositorState::raster_host(CompositorState& state).presentable_surface_painting_surface = [](void* surface) -> void* { return &static_cast<PresentableSurface*>(surface)->painting_surface(); },.live_content = [](void* host, u64 context_id, ReadonlySpan<u64> canvas_ids, void* receiver, void (*receive)(void*, RustFFI::FfiLiveContent const*)) { state_of(host).report_live_content(Context { context_id }, canvas_ids, receiver, receive); },.remote_layer_can_show = [](void* host, u64 context_id, RustFFI::MediaKind kind, u64 media_id, RustFFI::FfiSublayerPlacement const* placement, double device_pixel_ratio) { return state_of(host).remote_layer_can_show(Context { context_id }, kind, media_id, *placement, device_pixel_ratio); },- .remote_layer_can_show_high_dynamic_range = [](void* host, u64 context_id) {- auto* remote_layer = state_of(host).remote_layer_showing(Context { context_id });- return remote_layer && remote_layer->layer->can_show_high_dynamic_range(); },.build_sublayers = [](void* host, u64 context_id, ReadonlySpan<RustFFI::FfiSublayer> sublayers) -> void* {return state_of(host).build_sublayers(Context { context_id }, sublayers);},diff --git a/Services/Compositor/CoreAnimationWindowServer.h b/Services/Compositor/CoreAnimationWindowServer.hindex 320a7d3beea..5d760306dbd 100644--- a/Services/Compositor/CoreAnimationWindowServer.h+++ b/Services/Compositor/CoreAnimationWindowServer.h@@ -65,7 +65,6 @@ public:virtual Compositing::RemoteLayerHostHandle host_handle() const override;virtual bool can_show(WindowServerPlacement const&, Content const&, double device_pixel_ratio) const override;- virtual bool can_show_high_dynamic_range() const override { return true; }virtual bool show_frame(Frame) override;virtual void place_frame(Optional<Gfx::IntSize> fit_within) override;diff --git a/Services/Compositor/RemoteLayer.h b/Services/Compositor/RemoteLayer.hindex 36fd9c5913c..ad50fabb0b1 100644--- a/Services/Compositor/RemoteLayer.h+++ b/Services/Compositor/RemoteLayer.h@@ -36,7 +36,6 @@ public:using Content = Variant<NonnullRefPtr<Media::VideoFrame>, NonnullRefPtr<PresentableSurface>>;virtual bool can_show(WindowServerPlacement const&, Content const&, double device_pixel_ratio) const = 0;- virtual bool can_show_high_dynamic_range() const { return false; }struct Frame {// Without a store, the frame shown before stays, and only the sublayers change.diff --git a/Services/Compositor/Rust/src/presenting/damage.rs b/Services/Compositor/Rust/src/presenting/damage.rsindex 3c93d8541a1..ef83486b360 100644--- a/Services/Compositor/Rust/src/presenting/damage.rs+++ b/Services/Compositor/Rust/src/presenting/damage.rs@@ -6,7 +6,7 @@//! What a frame repaints of the frame painted before it, and of what each backing store holds.-use super::layers::{LayerUpdate, MediaUpdate};+use super::layers::LayerUpdate;use super::{ContextPresenting, FrameToPaint, PresentingEnvironment, rect_of_size};use crate::frame_inputs::FrameInputs;use crate::host::PendingFrame;@@ -112,7 +112,6 @@ pub struct LiveContentChangesSinceLastPaint {pub video_sinks: Vec<VideoSinkHandle>,pub image_frames: Vec<ImageFrameResourceId>,pub nested_contexts: Vec<CompositorContextId>,- pub media_updates: Vec<MediaUpdate>,pub repaints_everything: bool,}@@ -231,10 +230,6 @@ impl ContextPresenting {changes.repaints_everything = true;}changes.canvases.push(CanvasId(*canvas_id));- changes.media_updates.push(MediaUpdate {- media: LiveMedia::Canvas(CanvasId(*canvas_id)),- content_version: current_content_generation,- });}let summary = display_list.storage().summary();let image_frame_ids_of_list: HashSet<u64> = summary.image_frame_ids.iter().copied().collect();@@ -247,10 +242,6 @@ impl ContextPresenting {if current_frame_id == *frame_id {continue;}- changes.media_updates.push(MediaUpdate {- media: LiveMedia::VideoFrame(VideoSinkHandle(*video_sink_handle)),- content_version: current_frame_id.unwrap_or(0),- });// A video that no command of this list draws has no command in this list to damage.if !video_sink_handles_of_list.contains(video_sink_handle) {changes.repaints_everything = true;@@ -302,13 +293,8 @@ impl ContextPresenting {frame.frame_inputs,live_content,);- self.layers.media_activity.note_updates(- &changes.media_updates,- frame.display_list.storage().summary(),- env.now,- );- let mut layers = self.layer_update_for(env, frame, viewport_rect, live_content);+ let mut layers = self.layer_update_for(frame, viewport_rect);let shown_by_window_server = match layers.plan(&self.layers) {Some(plan) => self.window_server_can_show_media_layers_of(env, plan, live_content),None => false,@@ -433,12 +419,7 @@ impl ContextPresenting {damage}- pub(super) fn layers_keep_plan_for(- &self,- frame: &FrameToPaint<'_>,- viewport_rect: IntRect,- active_media: &[LiveMedia],- ) -> bool {+ pub(super) fn layers_keep_plan_for(&self, frame: &FrameToPaint<'_>, viewport_rect: IntRect) -> bool {let Some(painted_frame) = &self.painted_frame else {return false;};@@ -446,7 +427,6 @@ impl ContextPresenting {&& Rc::ptr_eq(&painted_frame.display_list, frame.display_list)&& painted_frame.viewport_size.width == viewport_rect.width&& painted_frame.viewport_size.height == viewport_rect.height- && self.layers.plan_active_media() == active_media&& frame.frame_inputs.places_content_like(&painted_frame.frame_inputs)}}diff --git a/Services/Compositor/Rust/src/presenting/layers.rs b/Services/Compositor/Rust/src/presenting/layers.rsindex 090c0298e5e..9c01b66b1cc 100644--- a/Services/Compositor/Rust/src/presenting/layers.rs+++ b/Services/Compositor/Rust/src/presenting/layers.rs@@ -4,8 +4,8 @@* SPDX-License-Identifier: BSD-2-Clause*/-//! The layers a frame is painted in while canvases and videos update often or it draws nested contexts, and what of-//! them the window server shows above the frame by itself.+//! The layers a frame is painted in while it draws canvases, videos or nested contexts, and what of them the window+//! server shows above the frame by itself.use super::damage::LiveContentChangesSinceLastPaint;use super::{@@ -15,16 +15,12 @@ use crate::raster_host::{FfiSublayer, FfiSublayerPlacement, LiveContent, MediaKind, PresentableSurfaceHandle, SublayerContentKind,SurfaceBlend, SurfaceHandle,};-use libcompositing_rust::display_list::commands::VideoSinkHandle;use libcompositing_rust::display_list::layers::{LayerKind, LayerPlan, LayerPlanInputs, build_layer_plan};-use libcompositing_rust::display_list::summary::{DisplayListSummary, LiveContent as LiveMedia};+use libcompositing_rust::display_list::summary::LiveContent as LiveMedia;use libcompositing_rust::display_list::window_server_placement::WindowServerPlacement;-use libcompositing_rust::time::{Duration, MonotonicTime};use libgfx_rust::{Color, IntRect, IntSize, ScalingMode};use std::collections::HashMap;-const LONGEST_TIME_BETWEEN_UPDATES_THAT_ACTIVATE_MEDIA: Duration = Duration::from_milliseconds(1000);-// The pool of presentable surfaces the overlays are shown from, apart from those of the painted layers.const COMPOSITOR_OVERLAY_SURFACE_POOL: u32 = u32::MAX;@@ -36,74 +32,6 @@ const COMPOSITOR_OVERLAY_SUBLAYER_IDENTITY: u64 = 4 << 60;// Canvas and video IDs count up from 1, and stay far below this.const MEDIA_DRAWING_INDEX_SHIFT: u32 = 44;-pub struct MediaUpdate {- pub media: LiveMedia,- pub content_version: u64,-}--struct MediaUpdates {- media: LiveMedia,- content_version: u64,- last_update: MonotonicTime,- active: bool,-}--/// Which canvases and videos update often enough to be layers of their own: those updated twice within a second, for-/// as long as the display list draws them.-#[derive(Default)]-pub struct MediaActivity {- updates: Vec<MediaUpdates>,-}--fn summary_draws(summary: &DisplayListSummary, media: LiveMedia) -> bool {- match media {- LiveMedia::Canvas(id) => summary.canvas_ids.contains(&id.0),- LiveMedia::VideoFrame(handle) => summary.video_sink_handles.contains(&handle.0),- LiveMedia::ImageFrame(_) | LiveMedia::CompositedContext(_) => false,- }-}--impl MediaActivity {- pub fn note_updates(&mut self, updates: &[MediaUpdate], summary: &DisplayListSummary, now: MonotonicTime) {- for update in updates {- self.note_update(update, now);- }- self.updates- .retain(|media_updates| summary_draws(summary, media_updates.media));- }-- fn note_update(&mut self, update: &MediaUpdate, now: MonotonicTime) {- for updates in &mut self.updates {- if updates.media != update.media {- continue;- }- if updates.content_version == update.content_version {- return;- }- if now - updates.last_update <= LONGEST_TIME_BETWEEN_UPDATES_THAT_ACTIVATE_MEDIA {- updates.active = true;- }- updates.content_version = update.content_version;- updates.last_update = now;- return;- }- self.updates.push(MediaUpdates {- media: update.media,- content_version: update.content_version,- last_update: now,- active: false,- });- }-- pub fn active_media(&self) -> Vec<LiveMedia> {- self.updates- .iter()- .filter(|updates| updates.active)- .map(|updates| updates.media)- .collect()- }-}-#[derive(Default)]struct LayerSurface {surface: Option<SurfaceHandle>,@@ -123,9 +51,7 @@ struct PaintedLayerPresentation {/// The layers of the frames of a context, and what of them the window server shows.#[derive(Default)]pub struct ContextLayers {- pub media_activity: MediaActivity,plan: Option<LayerPlan>,- plan_active_media: Vec<LiveMedia>,surfaces: Vec<LayerSurface>,last_content_version: u64,// Whether the window server shows the canvases and videos of the latest frame above it.@@ -144,10 +70,6 @@ impl ContextLayers {self.plan.as_ref()}- pub fn plan_active_media(&self) -> &[LiveMedia] {- &self.plan_active_media- }-pub fn window_server_shows_media(&self) -> bool {self.window_server_shows_media}@@ -157,7 +79,6 @@ impl ContextLayers {return;}self.plan = None;- self.plan_active_media.clear();self.surfaces.clear();for pool in 0..self.painted_layer_presentations.len() {env.raster.drop_presentable_surface_pool(env.context_id, pool as u32);@@ -171,7 +92,6 @@ impl ContextLayers {pub struct LayerUpdate {pub new_plan: Option<LayerPlan>,pub keeps_plan: bool,- pub active_media: Vec<LiveMedia>,pub painted_damage: IntRect,pub damage_of_layers: Vec<IntRect>,pub fully_repainted_layer_bits: u32,@@ -240,45 +160,19 @@ fn surface_sublayer(identity: u64, surface: &PresentableSurfaceHandle, rect: Int}impl ContextPresenting {- pub(super) fn layer_update_for(- &self,- env: &PresentingEnvironment<'_>,- frame: &FrameToPaint<'_>,- viewport_rect: IntRect,- live_content: &LiveContent,- ) -> LayerUpdate {+ pub(super) fn layer_update_for(&self, frame: &FrameToPaint<'_>, viewport_rect: IntRect) -> LayerUpdate {let mut layers = LayerUpdate::default();- layers.active_media = self.layers.media_activity.active_media();- // An HDR video is a layer from its first frame for as long as it is drawn, even while paused, so that the window- // server keeps showing it brighter than SDR white instead of it going back into the frame, which holds SDR.- if self.remote_layer_may_show_media(env.has_gpu)- && env.raster.remote_layer_can_show_high_dynamic_range(env.context_id)- && env.window_server_may_show_high_dynamic_range- {- for handle in &frame.display_list.storage().summary().video_sink_handles {- let media = LiveMedia::VideoFrame(VideoSinkHandle(*handle));- if layers.active_media.contains(&media) {- continue;- }- let holds_high_dynamic_range = live_content- .video_sinks- .get(handle)- .is_some_and(|sink| sink.has_frame && sink.frame_holds_high_dynamic_range);- if holds_high_dynamic_range {- layers.active_media.push(media);- }- }- }- for live_content_record in &frame.display_list.storage().summary().live_content_records {- let content = live_content_record.content;- if matches!(content, LiveMedia::CompositedContext(_)) && !layers.active_media.contains(&content) {- layers.active_media.push(content);- }- }- if layers.active_media.is_empty() {+ let draws_media = frame+ .display_list+ .storage()+ .summary()+ .live_content_records+ .iter()+ .any(|live_content_record| !matches!(live_content_record.content, LiveMedia::ImageFrame(_)));+ if !draws_media {return layers;}- if self.layers_keep_plan_for(frame, viewport_rect, &layers.active_media) {+ if self.layers_keep_plan_for(frame, viewport_rect) {layers.keeps_plan = true;return layers;}@@ -292,7 +186,6 @@ impl ContextPresenting {tree,scroll_offsets: frame.frame_inputs.presented_scroll_state_snapshot.device_offsets(),viewport_rect,- active_media: &layers.active_media,}).ok();layers@@ -359,7 +252,6 @@ impl ContextPresenting {if let Some(new_plan) = layer_update.new_plan {layers.plan = Some(new_plan);}- layers.plan_active_media = layer_update.active_media;}pub(super) fn paint_layered_frame(diff --git a/Services/Compositor/Rust/src/raster_host.rs b/Services/Compositor/Rust/src/raster_host.rsindex d37c65d1b64..6ea3b158dcd 100644--- a/Services/Compositor/Rust/src/raster_host.rs+++ b/Services/Compositor/Rust/src/raster_host.rs@@ -265,7 +265,6 @@ pub struct FfiRasterHost {),pub remote_layer_can_show:unsafe extern "C" fn(*mut c_void, u64, MediaKind, u64, *const FfiSublayerPlacement, f64) -> bool,- pub remote_layer_can_show_high_dynamic_range: unsafe extern "C" fn(*mut c_void, u64) -> bool,/// Resolves the content of the sublayers, which the window server then holds busy until the list is destroyed or/// shown.pub build_sublayers: unsafe extern "C" fn(*mut c_void, u64, ak::Span<'_, FfiSublayer>) -> *mut c_void,@@ -701,11 +700,6 @@ impl RasterHost {unsafe { (self.0.remote_layer_can_show)(self.host(), context_id.0, kind, id, placement, device_pixel_ratio) }}- pub fn remote_layer_can_show_high_dynamic_range(&self, context_id: CompositorContextId) -> bool {- // SAFETY: The host outlives this.- unsafe { (self.0.remote_layer_can_show_high_dynamic_range)(self.host(), context_id.0) }- }-pub fn build_sublayers(&self, context_id: CompositorContextId, sublayers: &[FfiSublayer]) -> SublayersHandle {// SAFETY: The host outlives this, and the presentable surfaces of the sublayers are live.let built = unsafe { (self.0.build_sublayers)(self.host(), context_id.0, ak::Span::new(sublayers)) };