Skip to content

Truly independent web browser

LibCompositing+Compositor: Let the window server composite layers

Aliaksandr Kalenik4e310401f235
diff --git a/Libraries/LibCompositing/Rust/src/display_list/layers.rs b/Libraries/LibCompositing/Rust/src/display_list/layers.rs
index e4e77156fca..09800128ec1 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/layers.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/layers.rs
@@ -16,6 +16,7 @@
//! below it, that it reads, at its paint position: there, the band's records painted before the barrier go into the
//! layer below the cut and those painted after it into the layer above the cut. Elsewhere it cuts nothing.
+use crate::display_list::commands::ClipNodeIndex;
use crate::display_list::commands::{EffectNodeIndex, SpatialNodeIndex};
use crate::display_list::effect_geometry::{
LARGEST_FILTER_READ_REACH_IN_DEVICE_PIXELS, filter_may_spread_at_some_sample,
@@ -30,7 +31,10 @@ use crate::display_list::placement::{
use crate::display_list::reach::Reach;
use crate::display_list::storage::{DisplayListStorage, ListPosition, ListSpan};
use crate::display_list::summary::LiveContent;
-use crate::display_list::window_server_placement::{WhyWindowServerCannotShowMedia, WindowServerPlacement};
+use crate::display_list::window_server_placement::{
+ WhyWindowServerCannotCompositeEffect, WhyWindowServerCannotShowMedia, WindowServerPlacement,
+ WindowServerPlacementOfEffect, window_server_placement_of_effect,
+};
use crate::visual_context::queries::{NestingOfLiveEffects, backdrop_reader_by_reading_effect_index};
use crate::visual_context::{VisualContextTree, WorldTransforms, device_offset_for_index};
use libgfx_rust::{AffineTransform, CornerRadii, FloatMatrix4x4, FloatPoint, IntPoint, IntRect};
@@ -440,6 +444,73 @@ pub struct LayerStack {
innermost_composited_band_at_or_around_band: Vec<Option<BandIndex>>,
}
+/// What a window server composites by itself of the layers of a frame, besides the canvases and videos it shows.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+pub struct WindowServerCompositing {
+ /// Whether it shows each tile of a painted layer as a layer of its own, which it moves with the layer's space,
+ /// through the transform of a space the compositor animates too, clips to the layer's composite clips, and
+ /// composites inside the effects it can composite, so that a frame all of whose layers it shows needs no surface
+ /// of its own.
+ pub shows_tiles_of_painted_layers: bool,
+ /// Whether it runs what it shows below a layer through a blur and color matrices, as a backdrop filter does.
+ pub filters_what_is_below_layers: bool,
+}
+
+/// What the window server can show by itself of a stack under the values of one frame.
+pub struct WhatWindowServerShowsOfFrame<'a> {
+ pub compositing: WindowServerCompositing,
+ /// Whether it can show the canvas, video or nested context of a media layer by itself.
+ pub can_show_media_of_layer: &'a dyn Fn(LayerIndex) -> bool,
+ /// Whether it can composite the effect of a composited node by itself, around the layers the node holds.
+ pub can_composite_effect_of_node: &'a dyn Fn(PlacementNodeIndex) -> bool,
+}
+
+/// How the window server can composite each composited effect of a stack under the values of one frame, or why it
+/// cannot, by the index of the effect's node.
+#[derive(Clone, Debug, Default, PartialEq)]
+pub struct WindowServerPlacementsOfEffects {
+ placement_by_node_index: Vec<Option<Result<WindowServerPlacementOfEffect, WhyWindowServerCannotCompositeEffect>>>,
+}
+
+impl WindowServerPlacementsOfEffects {
+ /// How the window server can composite the effect of the node, or why it cannot. None for a node that is
+ /// composited inside no effect of its own.
+ pub fn of_node(
+ &self,
+ node_index: PlacementNodeIndex,
+ ) -> Option<&Result<WindowServerPlacementOfEffect, WhyWindowServerCannotCompositeEffect>> {
+ self.placement_by_node_index.get(node_index.0)?.as_ref()
+ }
+}
+
+/// Why a frame holds a layer, compositing it itself, rather than the window server showing the layer by itself.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum WhyFrameHoldsLayer {
+ ListIsOneLayer,
+ InsideAnEffectTheCompositorComposites,
+ CompositedWithinRoundedCorners,
+ InSpaceTheCompositorAnimates,
+ WindowServerCannotShowItsContent,
+ UnderALayerTheFrameHolds,
+ WindowServerShowsNoTiles,
+}
+
+impl std::fmt::Display for WhyFrameHoldsLayer {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str(match self {
+ WhyFrameHoldsLayer::ListIsOneLayer => "the list is one layer",
+ WhyFrameHoldsLayer::InsideAnEffectTheCompositorComposites => {
+ "it is inside an effect the compositor composites"
+ }
+ WhyFrameHoldsLayer::CompositedWithinRoundedCorners => "it is composited within rounded corners",
+ WhyFrameHoldsLayer::InSpaceTheCompositorAnimates => "it is in a space the compositor animates",
+ WhyFrameHoldsLayer::WindowServerCannotShowItsContent => "the window server cannot show its content",
+ WhyFrameHoldsLayer::UnderALayerTheFrameHolds => "it is under a layer the frame holds",
+ WhyFrameHoldsLayer::WindowServerShowsNoTiles => "the window server shows no tiles",
+ })
+ }
+}
+
/// Where the window server can show each canvas and video layer of a stack under the values of one frame, or why it
/// cannot, by layer index. A stack is kept while its spaces scroll and its media move with them, so each frame works
/// this out anew.
@@ -460,12 +531,14 @@ impl WindowServerPlacementsOfMedia {
}
/// Where the window server can show the canvases and videos of a stack under the values of one frame, and which layers
-/// it shows above the frame where it can show every canvas and video it has a placement for, as the dump tells them.
+/// it shows by itself where it can show every canvas and video it has a placement for, as the dump tells them.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct WindowServerPresentationOfMedia {
pub placements: WindowServerPlacementsOfMedia,
+ pub placements_of_effects: WindowServerPlacementsOfEffects,
/// By layer index.
pub shown_by_window_server_by_layer_index: Vec<bool>,
+ pub window_server_compositing: WindowServerCompositing,
}
impl WindowServerPresentationOfMedia {
@@ -475,6 +548,34 @@ impl WindowServerPresentationOfMedia {
.copied()
.unwrap_or(false)
}
+
+ /// Why the frame holds a painted layer of `stack`, which the presentation is of, where the window server shows
+ /// tiles and still does not show the layer by itself.
+ fn why_frame_holds_painted_layer(&self, stack: &LayerStack, layer_index: LayerIndex) -> Option<WhyFrameHoldsLayer> {
+ if !self.window_server_compositing.shows_tiles_of_painted_layers
+ || self.layer_is_shown_by_window_server(layer_index)
+ {
+ return None;
+ }
+ Some(self.with_what_window_server_shows_of_frame(|window_server| {
+ stack.why_frame_holds_layer(layer_index, window_server)
+ }))
+ }
+
+ /// Hands `read` what the window server shows by itself where it can show every canvas and video it has a
+ /// placement for, and composite every effect it has a placement for.
+ fn with_what_window_server_shows_of_frame<Answer>(
+ &self,
+ read: impl FnOnce(&WhatWindowServerShowsOfFrame<'_>) -> Answer,
+ ) -> Answer {
+ read(&WhatWindowServerShowsOfFrame {
+ compositing: self.window_server_compositing,
+ can_show_media_of_layer: &|layer_index| matches!(self.placements.of_layer(layer_index), Some(Ok(_))),
+ can_composite_effect_of_node: &|node_index| {
+ matches!(self.placements_of_effects.of_node(node_index), Some(Ok(_)))
+ },
+ })
+ }
}
// A band comes after the band it is in.
@@ -1079,11 +1180,19 @@ impl LayerStack {
.get(node.raster_space_index.0)
.copied()
.flatten();
+ let mut raster_space_index_of_reach = node.raster_space_index;
let reach_in_raster_space = match self.composited_bands_around_layer_innermost_first(layer_index).last() {
- _ if let Some(swept_reach) = swept_reach_of_animated_space => swept_reach,
+ _ if let Some(swept_reach) = swept_reach_of_animated_space => {
+ raster_space_index_of_reach = self.spaces[node.raster_space_index.0].parent_index;
+ swept_reach
+ }
Some(outermost_composited_band) => {
let outermost_composited_node =
&self.nodes[self.bands[outermost_composited_band.0].placement_node_index.0];
+ if let Some(node_around_outermost_composited_node) = outermost_composited_node.parent_index {
+ raster_space_index_of_reach =
+ self.nodes[node_around_outermost_composited_node.0].raster_space_index;
+ }
match outermost_composited_node.reach_in_parent_node {
Reach::Nothing => return IntRect::default(),
Reach::Within(draw_and_read_reach_of_outermost_composited_effect) => {
@@ -1094,7 +1203,7 @@ impl LayerStack {
}
None => self.layers[layer_index.0].reach,
};
- let composite_offset = composite_offsets[node.raster_space_index.0];
+ let composite_offset = composite_offsets[raster_space_index_of_reach.0];
let reach_in_viewport = reach_in_raster_space.translated(composite_offset.x, composite_offset.y);
match self.composite_clip_of_layer_in_viewport(layer_index, composite_offsets) {
Some(clip) => reach_in_viewport.intersected(clip),
@@ -1102,37 +1211,105 @@ impl LayerStack {
}
}
- /// Which layers the window server shows above the frame, rather than the frame holding them, of those above the
- /// base layer that can hold content. The frame holds every layer up to the topmost one it must hold: one inside an
- /// effect the compositor composites, or a canvas, video or nested context the window server cannot show by itself,
- /// as `window_server_can_show` says. Below that, the window server still shows a canvas or video it can show where
- /// no layer above it that the frame holds can show over it. A painted layer is the window server's to show only to
- /// stay above a canvas or video that it shows, so the frame also holds the painted layers below the lowest of
- /// those, and every layer where the window server shows no canvas or video.
+ /// Why the frame holds the layer whatever it does with the layers around it, as the window server cannot show the
+ /// layer by itself. None for a layer the window server can show.
+ fn why_frame_must_hold_layer(
+ &self,
+ layer_index: LayerIndex,
+ window_server: &WhatWindowServerShowsOfFrame<'_>,
+ ) -> Option<WhyFrameHoldsLayer> {
+ let shows_tiles_of_painted_layers = window_server.compositing.shows_tiles_of_painted_layers;
+ let window_server_composites_effects_around_layer = self
+ .composited_bands_around_layer_innermost_first(layer_index)
+ .all(|band_index| {
+ shows_tiles_of_painted_layers
+ && (window_server.can_composite_effect_of_node)(self.bands[band_index.0].placement_node_index)
+ });
+ let is_media = matches!(self.layers[layer_index.0].content, LayerContent::Media { .. });
+ if !window_server_composites_effects_around_layer {
+ Some(WhyFrameHoldsLayer::InsideAnEffectTheCompositorComposites)
+ } else if !shows_tiles_of_painted_layers && self.layer_is_composited_within_rounded_clips(layer_index) {
+ Some(WhyFrameHoldsLayer::CompositedWithinRoundedCorners)
+ } else if !shows_tiles_of_painted_layers && self.layer_is_in_animated_space(layer_index) {
+ Some(WhyFrameHoldsLayer::InSpaceTheCompositorAnimates)
+ } else if is_media && !(window_server.can_show_media_of_layer)(layer_index) {
+ Some(WhyFrameHoldsLayer::WindowServerCannotShowItsContent)
+ } else {
+ None
+ }
+ }
+
+ /// Why the frame holds a layer that `layers_the_window_server_shows` does not have the window server show.
+ pub fn why_frame_holds_layer(
+ &self,
+ layer_index: LayerIndex,
+ window_server: &WhatWindowServerShowsOfFrame<'_>,
+ ) -> WhyFrameHoldsLayer {
+ if self.replays_whole_list() {
+ return WhyFrameHoldsLayer::ListIsOneLayer;
+ }
+ self.why_frame_must_hold_layer(layer_index, window_server).unwrap_or(
+ if window_server.compositing.shows_tiles_of_painted_layers {
+ WhyFrameHoldsLayer::UnderALayerTheFrameHolds
+ } else {
+ WhyFrameHoldsLayer::WindowServerShowsNoTiles
+ },
+ )
+ }
+
+ /// Which layers the window server shows by itself, rather than the frame holding them, of the base layer and those
+ /// above it that can hold content. The frame holds every layer up to the topmost one it must hold of those that can
+ /// show in the viewport: one inside an effect the compositor composites, one composited through a transform or
+ /// within a clip the window server does not apply, or a canvas, video or nested context the window server cannot
+ /// show by itself, as `window_server` says. An effect is composited around all it holds by the frame or by the
+ /// window server, so the frame holds every layer inside an effect it holds a layer inside. Below the topmost layer
+ /// the frame holds, the window server still shows a canvas or video it can show, that is inside no composited
+ /// effect, where no layer above it that the frame holds can show over it.
+ ///
+ /// A window server that shows the tiles of painted layers shows every layer above the topmost one the frame must
+ /// hold, and the base layer too where the frame must hold none, so that the frame holds nothing. Any other shows a
+ /// painted layer only to keep it above a canvas or video that it shows, so the frame also holds the painted layers
+ /// below the lowest of those, and every layer where the window server shows no canvas or video.
pub fn layers_the_window_server_shows(
&self,
composite_offsets: &[IntPoint],
- window_server_can_show: impl Fn(LayerIndex) -> bool,
+ window_server: &WhatWindowServerShowsOfFrame<'_>,
) -> Vec<bool> {
let mut shown_by_window_server = vec![false; self.layers.len()];
let is_media = |layer: LayerIndex| matches!(self.layers[layer.0].content, LayerContent::Media { .. });
+ let shows_tiles_of_painted_layers = window_server.compositing.shows_tiles_of_painted_layers;
let has_media_above_base = (self.base_layer.0 + 1..self.layers.len()).any(|layer| is_media(LayerIndex(layer)));
- if self.replays_whole_list() || !has_media_above_base {
+ if self.replays_whole_list() || !(shows_tiles_of_painted_layers || has_media_above_base) {
return shown_by_window_server;
}
let layers_above_base_that_may_hold_content: Vec<LayerIndex> = (self.base_layer.0 + 1..self.layers.len())
.map(LayerIndex)
.filter(|&layer| self.layers[layer.0].may_hold_content)
.collect();
- let frame_must_hold = |layer: LayerIndex| {
- self.layer_is_inside_composited_effects(layer)
- || self.layer_is_composited_within_rounded_clips(layer)
- || self.layer_is_in_animated_space(layer)
- || (is_media(layer) && !window_server_can_show(layer))
+ let frame_must_hold = |layer: LayerIndex| self.why_frame_must_hold_layer(layer, window_server).is_some();
+ // A layer that shows nowhere in the viewport keeps no other layer in the frame, whoever is to show it.
+ let viewport_rect = self.spaces[RasterSpaceIndex::VIEWPORT.0].extent;
+ let can_show_in_viewport = |layer: LayerIndex| {
+ !self
+ .reach_of_layer_in_viewport(layer, composite_offsets)
+ .intersected(viewport_rect)
+ .is_empty()
};
- let position_of_topmost_layer_frame_must_hold = layers_above_base_that_may_hold_content
+ let mut position_of_topmost_layer_frame_must_hold = layers_above_base_that_may_hold_content
.iter()
- .rposition(|&layer| frame_must_hold(layer));
+ .rposition(|&layer| frame_must_hold(layer) && can_show_in_viewport(layer));
+ // The layers of a band come one after another, from its layer below all cuts on.
+ if let Some(position_of_topmost_layer) = &mut position_of_topmost_layer_frame_must_hold {
+ for position in *position_of_topmost_layer + 1..layers_above_base_that_may_hold_content.len() {
+ let topmost_layer_frame_holds = layers_above_base_that_may_hold_content[*position_of_topmost_layer];
+ let is_inside_effect_frame_holds_layer_inside = self
+ .composited_bands_around_layer_innermost_first(layers_above_base_that_may_hold_content[position])
+ .any(|band_index| self.bands[band_index.0].layer_below_all_cuts <= topmost_layer_frame_holds);
+ if is_inside_effect_frame_holds_layer_inside {
+ *position_of_topmost_layer = position;
+ }
+ }
+ }
let count_up_to_topmost_layer_frame_must_hold =
position_of_topmost_layer_frame_must_hold.map_or(0, |position| position + 1);
for &layer in &layers_above_base_that_may_hold_content[count_up_to_topmost_layer_frame_must_hold..] {
@@ -1146,6 +1323,7 @@ impl LayerStack {
let reach_in_viewport = self.reach_of_layer_in_viewport(layer, composite_offsets);
if is_media(layer)
&& !frame_must_hold(layer)
+ && !self.layer_is_inside_composited_effects(layer)
&& reach_in_viewport_of_held_layers_above
.intersected(reach_in_viewport)
.is_empty()
@@ -1155,6 +1333,10 @@ impl LayerStack {
}
reach_in_viewport_of_held_layers_above = reach_in_viewport_of_held_layers_above.united(reach_in_viewport);
}
+ if shows_tiles_of_painted_layers {
+ shown_by_window_server[self.base_layer.0] = position_of_topmost_layer_frame_must_hold.is_none();
+ return shown_by_window_server;
+ }
let lowest_media_the_window_server_shows = layers_above_base_that_may_hold_content
.iter()
.copied()
@@ -1175,6 +1357,7 @@ impl LayerStack {
tree: &VisualContextTree,
scroll_offsets: &[FloatPoint],
viewport_rect: IntRect,
+ window_server_compositing: WindowServerCompositing,
) -> WindowServerPresentationOfMedia {
let world_of_frame = std::cell::OnceCell::new();
let placements = self.window_server_placements_of_media(
@@ -1186,13 +1369,87 @@ impl LayerStack {
},
viewport_rect,
);
+ let placements_of_effects = if window_server_compositing.shows_tiles_of_painted_layers {
+ self.window_server_placements_of_composited_effects(
+ list,
+ tree,
+ || {
+ world_of_frame
+ .get_or_init(|| WorldTransforms::new(tree, scroll_offsets, Some(FloatMatrix4x4::identity())))
+ },
+ window_server_compositing,
+ )
+ } else {
+ WindowServerPlacementsOfEffects::default()
+ };
let composite_offsets = self.composite_offsets(scroll_offsets);
- let shown_by_window_server_by_layer_index = self.layers_the_window_server_shows(&composite_offsets, |layer| {
- matches!(placements.of_layer(layer), Some(Ok(_)))
- });
- WindowServerPresentationOfMedia {
+ let mut presentation = WindowServerPresentationOfMedia {
placements,
- shown_by_window_server_by_layer_index,
+ placements_of_effects,
+ shown_by_window_server_by_layer_index: Vec::new(),
+ window_server_compositing,
+ };
+ presentation.shown_by_window_server_by_layer_index =
+ presentation.with_what_window_server_shows_of_frame(|window_server| {
+ self.layers_the_window_server_shows(&composite_offsets, window_server)
+ });
+ presentation
+ }
+
+ /// Works out how the window server could composite each composited effect of the stack under the frame's values,
+ /// with the world transforms of the tree in the frame that `world_of_frame` gives, which it asks for only where the
+ /// stack has a composited effect.
+ pub fn window_server_placements_of_composited_effects<'world>(
+ &self,
+ list: &DisplayListStorage,
+ tree: &VisualContextTree,
+ world_of_frame: impl FnOnce() -> &'world WorldTransforms,
+ window_server_compositing: WindowServerCompositing,
+ ) -> WindowServerPlacementsOfEffects {
+ if self.composited_effects.is_empty() {
+ return WindowServerPlacementsOfEffects::default();
+ }
+ let world_of_frame = world_of_frame();
+ let effect_clips = list.effect_clip_plan(tree);
+ let mut effect_is_composited = vec![false; tree.effect_nodes.len()];
+ for composited in &self.composited_effects {
+ effect_is_composited[composited.effect.0 as usize] = true;
+ }
+ let mut placement_by_node_index = vec![None; self.nodes.len()];
+ for composited in &self.composited_effects {
+ let effect = composited.effect;
+ // Each composited effect is entered within the clips between its output clip and that of the nearest
+ // composited effect around it.
+ let mut effect_around = tree.effect_nodes[effect.0 as usize].parent;
+ while !effect_around.is_none() && !effect_is_composited[effect_around.0 as usize] {
+ effect_around = tree.effect_nodes[effect_around.0 as usize].parent;
+ }
+ let clip_entered_outside_effect = if effect_around.is_none() {
+ Some(ClipNodeIndex::NONE)
+ } else {
+ effect_clips.output_clip_if_participating(effect_around)
+ };
+ let placement = match (
+ effect_clips.output_clip_if_participating(effect),
+ clip_entered_outside_effect,
+ ) {
+ (Some(output_clip), Some(clip_entered_outside_effect)) => window_server_placement_of_effect(
+ tree,
+ world_of_frame,
+ effect,
+ output_clip,
+ clip_entered_outside_effect,
+ window_server_compositing.filters_what_is_below_layers,
+ ),
+ // No record of the list is inside the effect, so nothing tells the clips it is entered within.
+ _ => Err(WhyWindowServerCannotCompositeEffect::Clipped(
+ WhyWindowServerCannotShowMedia::ClippedInSpaceTreeDoesNotHave,
+ )),
+ };
+ placement_by_node_index[composited.placement_node_index.0] = Some(placement);
+ }
+ WindowServerPlacementsOfEffects {
+ placement_by_node_index,
}
}
diff --git a/Libraries/LibCompositing/Rust/src/display_list/layers/planning/lines_of_plan.rs b/Libraries/LibCompositing/Rust/src/display_list/layers/planning/lines_of_plan.rs
index 9c4ad8dda2f..cde472adf59 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/layers/planning/lines_of_plan.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/layers/planning/lines_of_plan.rs
@@ -10,7 +10,7 @@ use super::{AnimatedNode, PlacedEffect, PlannedLayers, WhyEffectIsComposited, fo
use crate::display_list::commands::EffectNodeIndex;
use crate::display_list::layers::{
CompositedEffect, LayerContent, LayerIndex, NodeNamesFromIndices, VisualContextNodeNamer,
- WindowServerPresentationOfMedia, media_name, wire,
+ WindowServerPlacementsOfEffects, WindowServerPresentationOfMedia, media_name, wire,
};
use crate::display_list::reach::Reach;
use crate::display_list::storage::ListPosition;
@@ -44,10 +44,18 @@ impl PlannedLayers {
pub fn lines_of_composited_effects<'a>(
&'a self,
node_namer: &'a dyn VisualContextNodeNamer,
+ placements_of_effects: &'a WindowServerPlacementsOfEffects,
) -> impl Iterator<Item = String> + 'a {
let stack = &self.stack;
self.composited_effects_with_why_and_backdrop_read_reach()
.map(move |(composited, why, backdrop_read_reach)| {
+ let who_composites_it = match placements_of_effects.of_node(composited.placement_node_index) {
+ Some(Ok(_)) => String::from(", can be composited by the window server"),
+ Some(Err(why_window_server_cannot_composite)) => {
+ format!(", composited by the compositor: {why_window_server_cannot_composite}")
+ }
+ None => String::new(),
+ };
let parent_node_index = stack.nodes[composited.placement_node_index.0]
.parent_index
.expect("a composited node is inside another");
@@ -57,7 +65,7 @@ impl PlannedLayers {
Reach::Anywhere => " reads=anywhere".into(),
};
format!(
- "composited {} space={}{backdrop_read_text}: {}",
+ "composited {} space={}{backdrop_read_text}: {}{who_composites_it}",
node_namer.name_of_effect_node(composited.effect),
stack.name_of_node(parent_node_index, node_namer),
why
@@ -104,8 +112,9 @@ impl PlannedLayers {
if self.stack.replays_whole_list() {
return Vec::new();
}
+ let placements_of_no_frame = WindowServerPlacementsOfEffects::default();
wire::note_lines_a_plan_holds(
- self.lines_of_composited_effects(&NodeNamesFromIndices)
+ self.lines_of_composited_effects(&NodeNamesFromIndices, &placements_of_no_frame)
.chain(self.lines_of_media_without_layers())
.chain(self.lines_of_effects_reading_only_own_layer(&NodeNamesFromIndices)),
)
@@ -130,10 +139,10 @@ impl PlannedLayers {
/// The lines of the Layers section of the dump, each with the layer it is about, if it is about one. There is one
/// line per layer, bottom to top: its index, what it holds, the space it is rastered in, what it sits above, the
- /// records `describe_records` names for it, what it is clipped to as it is composited, and for a canvas or video
- /// whether the window server shows it, as `presentation` tells. A layer below the base layer, or one that can hold
- /// nothing, is left out. Then a line for each effect the compositor composites, each canvas, video or nested context
- /// without a layer, each animation without a layer, and each effect that reads only its own layer.
+ /// records `describe_records` names for it, what it is clipped to as it is composited, and whether the window
+ /// server that `presentation` is of can show it. A layer below the base layer, or one that can hold nothing, is
+ /// left out. Then a line for each effect the compositor composites, each canvas, video or nested context without a
+ /// layer, each animation without a layer, and each effect that reads only its own layer.
pub fn layer_lines(
&self,
presentation: &WindowServerPresentationOfMedia,
@@ -182,7 +191,7 @@ impl PlannedLayers {
if matches!(layer.content, LayerContent::Media { .. }) {
match presentation.placements.of_layer(layer_index) {
Some(Ok(placement)) if presentation.layer_is_shown_by_window_server(layer_index) => {
- line.push_str(&format!(" shown by the window server: {placement}"));
+ line.push_str(&format!(" can be shown by the window server: {placement}"));
}
Some(Ok(_)) if stack.layer_is_inside_composited_effects(layer_index) => {
line.push_str(" replayed: inside an effect the compositor composites");
@@ -193,11 +202,13 @@ impl PlannedLayers {
}
None => {}
}
+ } else if let Some(why_frame_holds_layer) = presentation.why_frame_holds_painted_layer(stack, layer_index) {
+ line.push_str(&format!(" held by the frame: {why_frame_holds_layer}"));
}
lines.push((Some(layer_index), line));
}
lines.extend(
- self.lines_of_composited_effects(node_namer)
+ self.lines_of_composited_effects(node_namer, &presentation.placements_of_effects)
.chain(self.lines_of_media_without_layers())
.chain(self.lines_of_animations_without_layers(node_namer))
.chain(self.lines_of_effects_reading_only_own_layer(node_namer))
diff --git a/Libraries/LibCompositing/Rust/src/display_list/layers/wire.rs b/Libraries/LibCompositing/Rust/src/display_list/layers/wire.rs
index eb1b64b1d12..d8590da40cb 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/layers/wire.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/layers/wire.rs
@@ -917,8 +917,8 @@ mod tests {
use crate::display_list::layers::planning::{LayerStackInputs, PlannedLayers, plan_layer_stack};
use crate::display_list::layers::{
BandIndex, CutsOfCell, LARGEST_SUMMED_READ_REACH_OF_COMPOSITED_FILTERS_IN_DEVICE_PIXELS, LayerIndex,
- MAXIMUM_NESTING_OF_COMPOSITED_EFFECTS, NodeNamesFromIndices, PlacementNodeBand,
- WindowServerPresentationOfMedia,
+ MAXIMUM_NESTING_OF_COMPOSITED_EFFECTS, NodeNamesFromIndices, PlacementNodeBand, WhatWindowServerShowsOfFrame,
+ WindowServerCompositing, WindowServerPresentationOfMedia,
};
use crate::display_list::placement::{RasterSpace, RasterSpaceGeometry, WhatEverySpaceOfTreeShares};
use crate::display_list::test_fixtures::{
@@ -2208,8 +2208,28 @@ mod tests {
for band_index in (0..stack.bands.len()).map(BandIndex) {
stack.band_has_layer_at_or_above_base_layer(band_index);
}
- stack.layers_the_window_server_shows(&composite_offsets, |_| true);
- let presentation = stack.window_server_presentation_of_media(list, frame_tree, &scroll_offsets, VIEWPORT);
+ let mut presentation = WindowServerPresentationOfMedia::default();
+ for shows_tiles_of_painted_layers in [false, true] {
+ let window_server_compositing = WindowServerCompositing {
+ shows_tiles_of_painted_layers,
+ filters_what_is_below_layers: shows_tiles_of_painted_layers,
+ };
+ stack.layers_the_window_server_shows(
+ &composite_offsets,
+ &WhatWindowServerShowsOfFrame {
+ compositing: window_server_compositing,
+ can_show_media_of_layer: &|_| true,
+ can_composite_effect_of_node: &|_| true,
+ },
+ );
+ presentation = stack.window_server_presentation_of_media(
+ list,
+ frame_tree,
+ &scroll_offsets,
+ VIEWPORT,
+ window_server_compositing,
+ );
+ }
let planned_with_stack = PlannedLayers {
stack: stack.clone(),
placement: planned.placement.clone(),
diff --git a/Libraries/LibCompositing/Rust/src/display_list/replay.rs b/Libraries/LibCompositing/Rust/src/display_list/replay.rs
index 98749acf06e..9993afe3d3e 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/replay.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/replay.rs
@@ -831,7 +831,7 @@ fn plain_layer_of_bounds(content_bounds: Option<FloatRect>) -> ReplayLayer {
}
}
-fn backdrop_is_drawn_by_masks(tree: &VisualContextTree, effect: EffectNodeIndex) -> bool {
+pub(crate) fn backdrop_is_drawn_by_masks(tree: &VisualContextTree, effect: EffectNodeIndex) -> bool {
let node = &tree.effect_nodes[effect.0 as usize];
matches!(&node.data, EffectNodeData::Effects(effects) if effects.backdrop_filter.is_some())
&& !node.parent.is_none()
diff --git a/Libraries/LibCompositing/Rust/src/display_list/window_server_placement.rs b/Libraries/LibCompositing/Rust/src/display_list/window_server_placement.rs
index 8c6a2dc7b2f..d6c130525b0 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/window_server_placement.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/window_server_placement.rs
@@ -7,12 +7,26 @@
//! Where the window server can show by itself a canvas or a video that is a layer of its own. The window server places
//! an image with a 2D affine transform and clips it to rectangles, one of which can have rounded corners of a single
//! radius. A media layer drawn under any other clip has to be replayed instead.
+//!
+//! Also how the window server composites by itself an effect around the layers of what the effect holds: within
+//! rectangles, rounded or not, at an opacity, or over what it shows below the effect's box run through a blur and
+//! color matrices, as a backdrop filter of the root group reads it. An effect that does anything else to its content,
+//! or that is clipped otherwise, has to be composited by the compositor instead.
use crate::display_list::builder::{inline_clips_of, inline_transform_of, read_command};
-use crate::display_list::commands::{ClipMode, DisplayListCommandType, DrawCanvas, DrawVideoFrame, SpatialNodeIndex};
+use crate::display_list::commands::{
+ ClipMode, ClipNodeIndex, DisplayListCommandType, DrawCanvas, DrawVideoFrame, EffectNodeIndex, SpatialNodeIndex,
+};
+use crate::display_list::replay::backdrop_is_drawn_by_masks;
use crate::display_list::tape::{DisplayListCommandHeader, DisplayListCommandRun, InlineClipKind};
-use crate::visual_context::{ClipNodeData, VisualContextTree, WorldTransforms};
-use libgfx_rust::{AffineTransform, CornerRadii, CornerRadius, FloatRect, IntRect, ScalingMode, multiply_affine};
+use crate::visual_context::{ClipNodeData, EffectNodeData, VisualContextTree, WorldTransforms};
+use libgfx_rust::filter::Filter;
+use libgfx_rust::{
+ AffineTransform, ColorFilterType, CompositingAndBlendingOperator, CornerRadii, CornerRadius, FloatRect, IntRect,
+ ScalingMode, multiply_affine,
+};
+
+const UNIFORM_SCALE_TOLERANCE: f32 = 0.0001;
const RADIUS_TOLERANCE_IN_DEVICE_PIXELS: f32 = 0.01;
@@ -266,6 +280,378 @@ impl ClipsInViewport {
}
}
+/// How the window server composites an effect by itself around the layers of what the effect holds.
+#[derive(Clone, Debug, PartialEq)]
+pub struct WindowServerPlacementOfEffect {
+ /// The clips the effect is composited within, in viewport pixels, with the radii of the corners each rounds.
+ pub clips: Vec<(FloatRect, CornerRadii)>,
+ pub opacity: f32,
+ /// What the effect's backdrop filter does to what the window server shows below the effect's box, if it has one.
+ pub backdrop: Option<WindowServerBackdrop>,
+}
+
+/// What the window server does to what it shows below a box with a backdrop filter, within the box's border box.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct WindowServerBackdrop {
+ /// The border box, which the filtered backdrop fills, in viewport pixels, and the radii of its rounded corners.
+ pub region: FloatRect,
+ pub corner_radii: CornerRadii,
+ pub filters: WindowServerBackdropFilters,
+}
+
+/// The functions of a backdrop filter as the window server applies them: a color matrix, a blur and another color
+/// matrix, in that order, each of which a filter can do without. A matrix is row-major with the offsets in the fifth
+/// column, for unpremultiplied colors from 0 to 1.
+#[derive(Clone, Copy, Debug, Default, PartialEq)]
+pub struct WindowServerBackdropFilters {
+ pub color_matrix_before_blur: Option<[f32; 20]>,
+ /// The standard deviation of the blur, in viewport pixels.
+ pub blur_standard_deviation: Option<f32>,
+ pub color_matrix_after_blur: Option<[f32; 20]>,
+}
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum WhyWindowServerCannotCompositeEffect {
+ Masks,
+ BlendsWithWhatIsBelowIt,
+ Filters,
+ WindowServerFiltersNothingBelowLayers,
+ BackdropFilterFunctionWithoutWindowServerEquivalent,
+ BackdropDrawnByMasks,
+ BackdropReadInsideAnotherEffect,
+ BoxWithBackdropFilterHasOpacity,
+ BoxWithBackdropFilterIsNotUniformlyScaled,
+ Clipped(WhyWindowServerCannotShowMedia),
+}
+
+impl std::fmt::Display for WhyWindowServerCannotCompositeEffect {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str(match self {
+ WhyWindowServerCannotCompositeEffect::Masks => "it masks",
+ WhyWindowServerCannotCompositeEffect::BlendsWithWhatIsBelowIt => "it blends with what is below it",
+ WhyWindowServerCannotCompositeEffect::Filters => "it filters",
+ WhyWindowServerCannotCompositeEffect::WindowServerFiltersNothingBelowLayers => {
+ "the window server filters nothing below layers"
+ }
+ WhyWindowServerCannotCompositeEffect::BackdropFilterFunctionWithoutWindowServerEquivalent => {
+ "its backdrop filter has a function the window server has no equivalent of"
+ }
+ WhyWindowServerCannotCompositeEffect::BackdropDrawnByMasks => "its backdrop is drawn by masks",
+ WhyWindowServerCannotCompositeEffect::BackdropReadInsideAnotherEffect => {
+ "its backdrop is read inside another effect"
+ }
+ WhyWindowServerCannotCompositeEffect::BoxWithBackdropFilterHasOpacity => {
+ "its box has a backdrop filter and an opacity"
+ }
+ WhyWindowServerCannotCompositeEffect::BoxWithBackdropFilterIsNotUniformlyScaled => {
+ "its box has a backdrop filter under a transform that is not a uniform scale"
+ }
+ WhyWindowServerCannotCompositeEffect::Clipped(why) => return write!(formatter, "it is {why}"),
+ })
+ }
+}
+
+// The matrices are those of https://drafts.fxtf.org/filter-effects-1/#FilterPrimitiveRepresentation.
+#[rustfmt::skip]
+fn color_filter_matrix(kind: ColorFilterType, amount: f32) -> [f32; 20] {
+ let rest = 1.0 - amount;
+ match kind {
+ ColorFilterType::Grayscale => [
+ 0.2126 + 0.7874 * rest, 0.7152 - 0.7152 * rest, 0.0722 - 0.0722 * rest, 0.0, 0.0,
+ 0.2126 - 0.2126 * rest, 0.7152 + 0.2848 * rest, 0.0722 - 0.0722 * rest, 0.0, 0.0,
+ 0.2126 - 0.2126 * rest, 0.7152 - 0.7152 * rest, 0.0722 + 0.9278 * rest, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ],
+ ColorFilterType::Brightness => [
+ amount, 0.0, 0.0, 0.0, 0.0,
+ 0.0, amount, 0.0, 0.0, 0.0,
+ 0.0, 0.0, amount, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ],
+ ColorFilterType::Contrast => {
+ let intercept = 0.5 - 0.5 * amount;
+ [
+ amount, 0.0, 0.0, 0.0, intercept,
+ 0.0, amount, 0.0, 0.0, intercept,
+ 0.0, 0.0, amount, 0.0, intercept,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ]
+ }
+ ColorFilterType::Invert => {
+ let scale = 1.0 - 2.0 * amount;
+ [
+ scale, 0.0, 0.0, 0.0, amount,
+ 0.0, scale, 0.0, 0.0, amount,
+ 0.0, 0.0, scale, 0.0, amount,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ]
+ }
+ ColorFilterType::Opacity => [
+ 1.0, 0.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, amount, 0.0,
+ ],
+ ColorFilterType::Sepia => [
+ 0.393 + 0.607 * rest, 0.769 - 0.769 * rest, 0.189 - 0.189 * rest, 0.0, 0.0,
+ 0.349 - 0.349 * rest, 0.686 + 0.314 * rest, 0.168 - 0.168 * rest, 0.0, 0.0,
+ 0.272 - 0.272 * rest, 0.534 - 0.534 * rest, 0.131 + 0.869 * rest, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ],
+ ColorFilterType::Saturate => [
+ 0.213 + 0.787 * amount, 0.715 - 0.715 * amount, 0.072 - 0.072 * amount, 0.0, 0.0,
+ 0.213 - 0.213 * amount, 0.715 + 0.285 * amount, 0.072 - 0.072 * amount, 0.0, 0.0,
+ 0.213 - 0.213 * amount, 0.715 - 0.715 * amount, 0.072 + 0.928 * amount, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ],
+ }
+}
+
+#[rustfmt::skip]
+fn hue_rotate_matrix(angle_degrees: f32) -> [f32; 20] {
+ let (sin, cos) = ak::math::sincos(angle_degrees.to_radians());
+ [
+ 0.213 + cos * 0.787 - sin * 0.213, 0.715 - cos * 0.715 - sin * 0.715, 0.072 - cos * 0.072 + sin * 0.928, 0.0, 0.0,
+ 0.213 - cos * 0.213 + sin * 0.143, 0.715 + cos * 0.285 + sin * 0.140, 0.072 - cos * 0.072 - sin * 0.283, 0.0, 0.0,
+ 0.213 - cos * 0.213 - sin * 0.787, 0.715 - cos * 0.715 + sin * 0.715, 0.072 + cos * 0.928 + sin * 0.072, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0, 0.0,
+ ]
+}
+
+/// The one color matrix that does what `first` and then `second` do.
+fn color_matrix_applying_first_then_second(first: &[f32; 20], second: &[f32; 20]) -> [f32; 20] {
+ let mut combined = [0.0; 20];
+ for row in 0..4 {
+ for column in 0..5 {
+ let offset_of_second = if column == 4 { second[row * 5 + 4] } else { 0.0 };
+ combined[row * 5 + column] = (0..4)
+ .map(|through| second[row * 5 + through] * first[through * 5 + column])
+ .sum::<f32>()
+ + offset_of_second;
+ }
+ }
+ combined
+}
+
+impl WindowServerBackdropFilters {
+ fn add_color_matrix(&mut self, matrix: [f32; 20]) {
+ let matrix_to_add_to = if self.blur_standard_deviation.is_some() {
+ &mut self.color_matrix_after_blur
+ } else {
+ &mut self.color_matrix_before_blur
+ };
+ *matrix_to_add_to = Some(match matrix_to_add_to {
+ Some(earlier_matrix) => color_matrix_applying_first_then_second(earlier_matrix, &matrix),
+ None => matrix,
+ });
+ }
+
+ /// Adds the filter functions of a CSS filter list, which nests each function around the one before it, in the
+ /// order they apply, with lengths scaled into the viewport. Answers false for a list the window server has no
+ /// equivalent of: one with another function than blur() or a color function, or with a blur() after a color
+ /// function that follows a blur().
+ fn add_functions_of(&mut self, filter: &Filter, scale: f32) -> bool {
+ match filter {
+ Filter::Compose { outer, inner } => {
+ self.add_functions_of(inner, scale) && self.add_functions_of(outer, scale)
+ }
+ Filter::Blur {
+ radius_x,
+ radius_y,
+ mirrors_at_backdrop_edge: true,
+ input: None,
+ } if radius_x == radius_y && self.color_matrix_after_blur.is_none() => {
+ // Two blurs in a row blur as one whose variance is the sum of theirs.
+ let standard_deviation = radius_x * scale;
+ self.blur_standard_deviation = Some(match self.blur_standard_deviation {
+ Some(earlier_standard_deviation) => ak::math::hypot(earlier_standard_deviation, standard_deviation),
+ None => standard_deviation,
+ });
+ true
+ }
+ Filter::ColorFilter {
+ kind,
+ amount,
+ input: None,
+ } => {
+ self.add_color_matrix(color_filter_matrix(*kind, *amount));
+ true
+ }
+ Filter::HueRotate {
+ angle_degrees,
+ input: None,
+ } => {
+ self.add_color_matrix(hue_rotate_matrix(*angle_degrees));
+ true
+ }
+ _ => false,
+ }
+ }
+}
+
+// Whether the backdrop holds what is drawn outside every layer, as the canvas color is, which what the window server
+// shows under the box always holds. A replay adds the canvas color under a backdrop read in the root group, and reads
+// the surface itself when there is no root group, but leaves it out of a backdrop read inside any other effect.
+fn backdrop_holds_what_is_drawn_outside_every_layer(tree: &VisualContextTree, effect: EffectNodeIndex) -> bool {
+ let mut enclosing_effect = tree.effect_nodes[effect.0 as usize].parent;
+ while !enclosing_effect.is_none()
+ && matches!(
+ tree.effect_nodes[enclosing_effect.0 as usize].data,
+ EffectNodeData::BackgroundColorAnimation
+ )
+ {
+ enclosing_effect = tree.effect_nodes[enclosing_effect.0 as usize].parent;
+ }
+ match tree.root_isolation_effect {
+ Some(root) => enclosing_effect == root,
+ None => enclosing_effect.is_none(),
+ }
+}
+
+fn corner_radii_scaled_to_whole_device_pixels(corner_radii: CornerRadii, scale: f32) -> CornerRadii {
+ let scaled = |corner: CornerRadius| CornerRadius {
+ horizontal_radius: (corner.horizontal_radius as f32 * scale).round() as i32,
+ vertical_radius: (corner.vertical_radius as f32 * scale).round() as i32,
+ };
+ CornerRadii {
+ top_left: scaled(corner_radii.top_left),
+ top_right: scaled(corner_radii.top_right),
+ bottom_right: scaled(corner_radii.bottom_right),
+ bottom_left: scaled(corner_radii.bottom_left),
+ }
+}
+
+/// What the window server does to what it shows below the box of `effect`, which has a backdrop filter, or why it
+/// cannot apply the filter.
+fn window_server_backdrop_of_effect(
+ tree: &VisualContextTree,
+ world: &WorldTransforms,
+ effect: EffectNodeIndex,
+) -> Result<WindowServerBackdrop, WhyWindowServerCannotCompositeEffect> {
+ let node = &tree.effect_nodes[effect.0 as usize];
+ let EffectNodeData::Effects(effects) = &node.data else {
+ return Err(WhyWindowServerCannotCompositeEffect::Masks);
+ };
+ let Some(backdrop) = &effects.backdrop_filter else {
+ return Err(WhyWindowServerCannotCompositeEffect::BackdropFilterFunctionWithoutWindowServerEquivalent);
+ };
+ if backdrop_is_drawn_by_masks(tree, effect) {
+ return Err(WhyWindowServerCannotCompositeEffect::BackdropDrawnByMasks);
+ }
+ if !backdrop_holds_what_is_drawn_outside_every_layer(tree, effect) {
+ return Err(WhyWindowServerCannotCompositeEffect::BackdropReadInsideAnotherEffect);
+ }
+ // The box's layer composites the filtered backdrop along with its content at the box's opacity, where the window
+ // server filters what is below a group only once the group is composited.
+ if effects.opacity != 1.0 {
+ return Err(WhyWindowServerCannotCompositeEffect::BoxWithBackdropFilterHasOpacity);
+ }
+ let Some(matrix) = world.draw_matrix_if_known(node.spatial) else {
+ return Err(WhyWindowServerCannotCompositeEffect::Clipped(
+ WhyWindowServerCannotShowMedia::ClippedInSpaceTreeDoesNotHave,
+ ));
+ };
+ let elements = &matrix.elements;
+ let (scale_x, scale_y) = (elements[0][0], elements[1][1]);
+ if !matrix.is_2d_affine()
+ || elements[0][1] != 0.0
+ || elements[1][0] != 0.0
+ || scale_x <= 0.0
+ || (scale_x - scale_y).abs() > UNIFORM_SCALE_TOLERANCE * scale_x
+ {
+ return Err(WhyWindowServerCannotCompositeEffect::BoxWithBackdropFilterIsNotUniformlyScaled);
+ }
+ let mut filters = WindowServerBackdropFilters::default();
+ let filter_has_window_server_equivalent =
+ Filter::deserialize(&backdrop.filter).is_some_and(|filter| filters.add_functions_of(&filter, scale_x));
+ if !filter_has_window_server_equivalent {
+ return Err(WhyWindowServerCannotCompositeEffect::BackdropFilterFunctionWithoutWindowServerEquivalent);
+ }
+ Ok(WindowServerBackdrop {
+ region: matrix.extract_2d_affine().map_rect(backdrop.region.to_float()),
+ corner_radii: corner_radii_scaled_to_whole_device_pixels(backdrop.corner_radii, scale_x),
+ filters,
+ })
+}
+
+/// How the window server composites `effect` by itself around the layers of what the effect holds, or why it cannot.
+/// The effect is entered within the clips from `output_clip` out to `clip_entered_outside_effect`, which is none for
+/// an effect inside no other effect that is composited. A backdrop filter is the window server's to apply only where
+/// `window_server_filters_what_is_below_layers`.
+pub fn window_server_placement_of_effect(
+ tree: &VisualContextTree,
+ world: &WorldTransforms,
+ effect: EffectNodeIndex,
+ output_clip: ClipNodeIndex,
+ clip_entered_outside_effect: ClipNodeIndex,
+ window_server_filters_what_is_below_layers: bool,
+) -> Result<WindowServerPlacementOfEffect, WhyWindowServerCannotCompositeEffect> {
+ let EffectNodeData::Effects(effects) = &tree.effect_nodes[effect.0 as usize].data else {
+ return Err(WhyWindowServerCannotCompositeEffect::Masks);
+ };
+ if effects.blend_mode != CompositingAndBlendingOperator::Normal {
+ return Err(WhyWindowServerCannotCompositeEffect::BlendsWithWhatIsBelowIt);
+ }
+ if effects.filter.is_some() {
+ return Err(WhyWindowServerCannotCompositeEffect::Filters);
+ }
+ let backdrop = match &effects.backdrop_filter {
+ Some(_) if !window_server_filters_what_is_below_layers => {
+ return Err(WhyWindowServerCannotCompositeEffect::WindowServerFiltersNothingBelowLayers);
+ }
+ Some(_) => Some(window_server_backdrop_of_effect(tree, world, effect)?),
+ None => None,
+ };
+ let mut clips_in_viewport = ClipsInViewport::default();
+ let mut clip = output_clip;
+ while !clip.is_none() && clip != clip_entered_outside_effect {
+ let node = &tree.clip_nodes[clip.0 as usize];
+ match &node.data {
+ ClipNodeData::Rect(data) => clips_in_viewport
+ .add(world, node.spatial, data.rect, data.corner_radii, data.mode)
+ .map_err(WhyWindowServerCannotCompositeEffect::Clipped)?,
+ ClipNodeData::Path(_) => {
+ return Err(WhyWindowServerCannotCompositeEffect::Clipped(
+ WhyWindowServerCannotShowMedia::ClippedByPath,
+ ));
+ }
+ ClipNodeData::Dead => {}
+ }
+ clip = node.parent;
+ }
+ let mut clips = Vec::new();
+ if let Some(intersection_of_rect_clips) = clips_in_viewport
+ .rect_clips
+ .iter()
+ .copied()
+ .reduce(|intersection, rect| intersection.intersected(rect))
+ {
+ clips.push((intersection_of_rect_clips, CornerRadii::default()));
+ }
+ let whole_device_pixels = |(horizontal, vertical): (f32, f32)| CornerRadius {
+ horizontal_radius: horizontal.round() as i32,
+ vertical_radius: vertical.round() as i32,
+ };
+ clips.extend(clips_in_viewport.rounded_clips.iter().map(|rounded_clip| {
+ let [top_left, top_right, bottom_right, bottom_left] =
+ rounded_clip.horizontal_and_vertical_radii_clockwise_from_top_left;
+ (
+ rounded_clip.rect,
+ CornerRadii {
+ top_left: whole_device_pixels(top_left),
+ top_right: whole_device_pixels(top_right),
+ bottom_right: whole_device_pixels(bottom_right),
+ bottom_left: whole_device_pixels(bottom_left),
+ },
+ )
+ }));
+ Ok(WindowServerPlacementOfEffect {
+ clips,
+ opacity: effects.opacity,
+ backdrop,
+ })
+}
+
/// Where the window server can show the canvas or video that `header` and `payload` draw in `run`, within
/// `viewport_rect`, or why it cannot.
pub fn window_server_placement(
diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs
index 02d1fa4a3a1..8fded67c537 100644
--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs
+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs
@@ -14,7 +14,7 @@ use super::dump_format::{
json_float_rect, json_int_rect, json_name, path_description, push_clip_radii, push_fields, push_value,
};
use super::layers::planning::{LayerStackInputs, PlannedLayers, plan_layer_stack};
-use super::layers::{LayerIndex, VisualContextNodeNamer, WindowServerPresentationOfMedia};
+use super::layers::{LayerIndex, VisualContextNodeNamer, WindowServerCompositing, WindowServerPresentationOfMedia};
use super::nested_records::{
NestedRecordsRole, for_each_command_including_nested, for_each_nested_record_span, span_bytes,
};
@@ -405,6 +405,7 @@ pub unsafe extern "C" fn painting_dump(
visual_context_tree,
scroll_offsets,
device_viewport_rect,
+ WINDOW_SERVER_THE_DUMP_TELLS_LAYERS_FOR,
);
dump_layers(
&mut output,
@@ -682,6 +683,15 @@ fn dump_compositor_scroll_table(
}
}
+// A dump tells what the most capable window server can show of the layers, whichever window server shows the page, if
+// any does, so that it reads the same on every platform.
+const WINDOW_SERVER_THE_DUMP_TELLS_LAYERS_FOR: WindowServerCompositing = WindowServerCompositing {
+ shows_tiles_of_painted_layers: true,
+ filters_what_is_below_layers: true,
+};
+const HEADER_OF_LAYERS_SECTION: &str =
+ "Layers (for a window server that shows tiles and filters what is below layers):";
+
fn dump_layers(
output: &mut String,
names: &mut DumpNames,
@@ -713,7 +723,7 @@ fn dump_layers(
}
return;
}
- output.push_str("\nLayers:\n");
+ writeln!(output, "\n{HEADER_OF_LAYERS_SECTION}").unwrap();
let describe_records = |layer: LayerIndex| {
record_id_ranges_by_layer
.as_ref()
diff --git a/Services/Compositor/CompositorState.cpp b/Services/Compositor/CompositorState.cpp
index 3ea962e05b1..1b0944c19a7 100644
--- a/Services/Compositor/CompositorState.cpp
+++ b/Services/Compositor/CompositorState.cpp
@@ -1250,28 +1250,85 @@ Vector<RemoteSublayer>* CompositorState::build_sublayers(Web::CompositorContextI
auto sublayers = make<Vector<RemoteSublayer>>();
auto& context = presented_context(context_id);
auto& raster_targets = context.raster_targets;
+ // A sublayer without content is left out, and so are the sublayers of a group that is.
+ Vector<Optional<size_t>> index_of_built_sublayer;
+ index_of_built_sublayer.ensure_capacity(sublayers_to_build.size());
for (auto const& sublayer : sublayers_to_build) {
- Optional<Variant<NonnullRefPtr<Media::VideoFrame>, PresentableSurface::Lease>> content;
- switch (sublayer.content_kind) {
- case RustFFI::SublayerContentKind::Canvas:
- if (auto surface = raster_targets.canvas_surfaces().presentable_canvas_surface(Compositing::CanvasId { sublayer.media_id }))
- content = surface->lease();
- break;
- case RustFFI::SublayerContentKind::Video:
- if (auto frame = current_video_frame(context.web_content_client, Media::VideoSinkHandle { sublayer.media_id }); frame && frame->surface())
- content = frame.release_nonnull();
- break;
- case RustFFI::SublayerContentKind::PresentableSurface:
- content = const_cast<PresentableSurface*>(sublayer.presentable_surface)->lease();
- break;
+ Optional<size_t> group_index;
+ bool is_in_group = sublayer.group_index >= 0;
+ if (is_in_group && static_cast<size_t>(sublayer.group_index) < index_of_built_sublayer.size())
+ group_index = index_of_built_sublayer[sublayer.group_index];
+ Optional<decltype(RemoteSublayer::content)> content;
+ if (!is_in_group || group_index.has_value()) {
+ switch (sublayer.content_kind) {
+ case RustFFI::SublayerContentKind::Canvas:
+ if (auto surface = raster_targets.canvas_surfaces().presentable_canvas_surface(Compositing::CanvasId { sublayer.media_id }))
+ content = surface->lease();
+ break;
+ case RustFFI::SublayerContentKind::Video:
+ if (auto frame = current_video_frame(context.web_content_client, Media::VideoSinkHandle { sublayer.media_id }); frame && frame->surface())
+ content = frame.release_nonnull();
+ break;
+ case RustFFI::SublayerContentKind::PresentableSurface:
+ content = const_cast<PresentableSurface*>(sublayer.presentable_surface)->lease();
+ break;
+ case RustFFI::SublayerContentKind::Group: {
+ auto const* to_parent = sublayer.group.to_parent;
+ content = RemoteSublayer::Group {
+ .to_parent = { to_parent[0], to_parent[1], to_parent[2], to_parent[3], to_parent[4], to_parent[5] },
+ .clip_rect = sublayer.group.clips ? Optional<Gfx::FloatRect> { sublayer.group.clip_rect } : OptionalNone {},
+ .corner_radii = sublayer.group.corner_radii,
+ .opacity = sublayer.group.opacity,
+ };
+ break;
+ }
+ case RustFFI::SublayerContentKind::Tile:
+ content = RemoteSublayer::Tile {
+ .surface = const_cast<PresentableSurface*>(sublayer.presentable_surface)->lease(),
+ .every_pixel_is_opaque = sublayer.every_pixel_is_opaque,
+ };
+ break;
+ case RustFFI::SublayerContentKind::Color:
+ content = sublayer.color;
+ break;
+ case RustFFI::SublayerContentKind::Backdrop: {
+ auto const& backdrop = sublayer.backdrop;
+ RemoteSublayer::Backdrop built_backdrop;
+ built_backdrop.region = backdrop.region;
+ auto append_color_matrix = [&](float const* color_matrix) {
+ RemoteSublayer::Backdrop::Filter filter;
+ filter.kind = RemoteSublayer::Backdrop::Filter::Kind::ColorMatrix;
+ for (size_t index = 0; index < filter.color_matrix.size(); ++index)
+ filter.color_matrix[index] = color_matrix[index];
+ built_backdrop.filters.append(filter);
+ };
+ if (backdrop.has_color_matrix_before_blur)
+ append_color_matrix(backdrop.color_matrix_before_blur);
+ if (backdrop.has_blur) {
+ RemoteSublayer::Backdrop::Filter blur;
+ blur.kind = RemoteSublayer::Backdrop::Filter::Kind::Blur;
+ blur.blur_standard_deviation = backdrop.blur_standard_deviation;
+ built_backdrop.filters.append(blur);
+ }
+ if (backdrop.has_color_matrix_after_blur)
+ append_color_matrix(backdrop.color_matrix_after_blur);
+ content = move(built_backdrop);
+ break;
+ }
+ }
}
- if (!content.has_value())
+ if (!content.has_value()) {
+ index_of_built_sublayer.unchecked_append({});
continue;
+ }
+ index_of_built_sublayer.unchecked_append(sublayers->size());
auto const& placement = sublayer.placement;
+ bool is_placed_by_group = content->has<RemoteSublayer::Tile>() || content->has<Gfx::Color>();
sublayers->append({
.identity = sublayer.identity,
+ .group_index = group_index,
.content = content.release_value(),
- .content_rect = placement.content_rect,
+ .content_rect = is_placed_by_group ? sublayer.rect : placement.content_rect,
.content_to_frame = content_to_frame_of(placement),
.clip_rect = placement.clip_rect,
.rounded_clip = rounded_clip_of(placement),
@@ -1491,6 +1548,13 @@ RustFFI::FfiRasterHost CompositorState::raster_host(CompositorState& state)
return nullptr;
return &surface.release_value().leak_ref();
},
+ .window_server_compositing = [](void* window_server) -> RustFFI::FfiWindowServerCompositing {
+ auto const& compositing_window_server = *static_cast<WindowServer*>(window_server);
+ return {
+ .shows_tiles_of_painted_layers = compositing_window_server.shows_tiles_of_painted_layers(),
+ .filters_what_is_below_layers = compositing_window_server.filters_what_is_below_layers(),
+ };
+ },
.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, void* remote_layer, 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(*static_cast<RemoteLayer*>(remote_layer), Context { context_id }, kind, media_id, *placement, device_pixel_ratio); },
.build_sublayers = [](void* host, u64 context_id, ReadonlySpan<RustFFI::FfiSublayer> sublayers) -> void* {
@@ -1527,6 +1591,7 @@ RustFFI::FfiRasterHost CompositorState::raster_host(CompositorState& state)
auto* store = const_cast<PresentableSurface*>(frame->store);
auto shown = static_cast<RemoteLayer*>(remote_layer)->show_frame({
.store = store ? Optional<PresentableSurface::Lease> { store->lease() } : OptionalNone {},
+ .shows_no_store = frame->shows_no_store,
.painted_size = frame->painted_size,
.device_pixel_ratio = frame->device_pixel_ratio,
.fit_within = frame->has_fit_within ? Optional<Gfx::IntSize> { frame->fit_within } : OptionalNone {},
diff --git a/Services/Compositor/CoreAnimationWindowServer.h b/Services/Compositor/CoreAnimationWindowServer.h
index 5d760306dbd..687f21d0d9d 100644
--- a/Services/Compositor/CoreAnimationWindowServer.h
+++ b/Services/Compositor/CoreAnimationWindowServer.h
@@ -19,7 +19,9 @@
#include <Compositor/WindowServer.h>
#include <LibCore/Forward.h>
#include <LibCore/IOSurface.h>
+#include <LibGfx/Color.h>
#include <LibGfx/Forward.h>
+#include <LibGfx/Rect.h>
#include <LibGfx/Size.h>
#include <LibMediaCodecs/VideoFrame.h>
@@ -48,6 +50,8 @@ public:
virtual OwnPtr<RemoteLayer> try_create_remote_layer(u64 remote_layer_id) override;
virtual ErrorOr<NonnullRefPtr<PresentableSurface>> try_create_presentable_surface(Gfx::IntSize, RefPtr<Gfx::SkiaBackendContext> const&) override;
+ virtual bool shows_tiles_of_painted_layers() const override;
+ virtual bool filters_what_is_below_layers() const override;
virtual FrameHandOff frame_hand_off() const override { return FrameHandOff::OnceGpuWorkIsScheduled; }
virtual void hold_changes_on_screen() override;
virtual void release_changes_held_off_screen() override;
@@ -68,20 +72,46 @@ public:
virtual bool show_frame(Frame) override;
virtual void place_frame(Optional<Gfx::IntSize> fit_within) override;
+ enum class SublayerKind : u8 {
+ // A video frame or a surface, in a layer of its own inside the layers that clip it.
+ PlacedContent,
+ Group,
+ Tile,
+ Color,
+ Backdrop,
+ };
+
private:
CoreAnimationRemoteLayer() = default;
struct ShownSublayer {
- void* clip_layer { nullptr };
+ SublayerKind kind { SublayerKind::PlacedContent };
+ // The layer among the sublayers of the group the sublayer is in, or of the frame: the layer that clips placed
+ // content, or the one layer of a group, a tile or a color.
+ void* outermost_layer { nullptr };
void* rounded_clip_layer { nullptr };
void* content_layer { nullptr };
Variant<Empty, NonnullRefPtr<Media::VideoFrame>, PresentableSurface::Lease> content;
+ // What a group, a tile or a color was last shown with, so that a frame sets only what it changes.
+ Optional<RemoteSublayer::Group> shown_group;
+ Optional<Gfx::IntRect> shown_rect;
+ Optional<Gfx::Color> shown_color;
+ Optional<bool> shown_as_opaque;
+ Optional<RemoteSublayer::Backdrop> shown_backdrop;
+ double shown_at_device_pixel_ratio { 0 };
+ // Of a group, the sublayers in it, bottom to top.
+ Vector<u64> identities_of_sublayers;
};
void lay_out_frame(Optional<Gfx::IntSize> fit_within);
void show_sublayers(Vector<RemoteSublayer>&);
+ ShownSublayer& shown_sublayer_of_kind(u64 identity, SublayerKind);
void use_content_layer_of_kind_for(ShownSublayer&, RemoteSublayer const&);
void update_shown_sublayer(ShownSublayer&, RemoteSublayer&);
+ void update_shown_group(ShownSublayer&, RemoteSublayer::Group const&);
+ void update_shown_tile(ShownSublayer&, RemoteSublayer::Tile&, Gfx::IntRect);
+ void update_shown_color(ShownSublayer&, Gfx::Color, Gfx::IntRect);
+ void update_shown_backdrop(ShownSublayer&, RemoteSublayer::Backdrop const&);
void show_content(ShownSublayer&, RemoteSublayer&);
void stop_showing_content(ShownSublayer&);
void stop_showing_sublayer(ShownSublayer&);
@@ -95,6 +125,10 @@ private:
Gfx::IntSize m_painted_size;
double m_device_pixel_ratio { 1.0 };
HashMap<u64, ShownSublayer> m_shown_sublayers;
+ // The sublayers of the frame itself, bottom to top.
+ Vector<u64> m_identities_of_sublayers_of_frame;
+ // Whether a sublayer got another layer under the identity it had, which the layer it is in has to take.
+ bool m_sublayer_got_another_layer { false };
// A decoder decodes into the surface of a frame again once nothing holds the frame, so a replaced frame is held
// until the window server can no longer be reading it. Its surface reads as in use for as long as the decoder's
// pixel buffer lives, which is as long as the frame does, so that cannot tell.
diff --git a/Services/Compositor/CoreAnimationWindowServer.mm b/Services/Compositor/CoreAnimationWindowServer.mm
index 40637f9581d..d1e5fa7af6b 100644
--- a/Services/Compositor/CoreAnimationWindowServer.mm
+++ b/Services/Compositor/CoreAnimationWindowServer.mm
@@ -35,6 +35,11 @@
+ (id<LadybirdCoreAnimationContext>)contextWithCGSConnection:(uint32_t)connection options:(NSDictionary*)options;
@end
+// A CABackdropLayer applies CAFilters to what the window server shows under it. Neither is public API either.
+@protocol LadybirdCoreAnimationFilterClass <NSObject>
++ (id)filterWithType:(NSString*)type;
+@end
+
namespace Compositor {
using WindowServerConnectionIDFunction = uint32_t (*)();
@@ -59,6 +64,28 @@ static Class core_animation_context_class()
return context_class;
}
+static Class core_animation_backdrop_layer_class()
+{
+ static Class backdrop_layer_class = []() -> Class {
+ Class backdrop_layer_class = NSClassFromString(@"CABackdropLayer");
+ if (!backdrop_layer_class || ![backdrop_layer_class isSubclassOfClass:[CALayer class]])
+ return nil;
+ return backdrop_layer_class;
+ }();
+ return backdrop_layer_class;
+}
+
+static Class core_animation_filter_class()
+{
+ static Class filter_class = []() -> Class {
+ Class filter_class = NSClassFromString(@"CAFilter");
+ if (!filter_class || ![filter_class respondsToSelector:@selector(filterWithType:)])
+ return nil;
+ return filter_class;
+ }();
+ return filter_class;
+}
+
// Changes made outside an explicit transaction open an implicit one, which only a run loop commits, and while it is
// open it holds back the explicit ones nested in it as well. This process has no run loop, so every change is made in
// an explicit transaction, and any implicit one that something opened anyway is flushed after it.
@@ -110,6 +137,18 @@ OwnPtr<RemoteLayer> CoreAnimationWindowServer::try_create_remote_layer(u64)
return CoreAnimationRemoteLayer::try_create();
}
+bool CoreAnimationWindowServer::shows_tiles_of_painted_layers() const
+{
+ // Lets a frame composited by the window server be told apart from one composited into a store.
+ static bool is_switched_off = getenv("LADYBIRD_WINDOW_SERVER_SHOWS_NO_TILES") != nullptr;
+ return !is_switched_off;
+}
+
+bool CoreAnimationWindowServer::filters_what_is_below_layers() const
+{
+ return core_animation_backdrop_layer_class() && core_animation_filter_class();
+}
+
CoreAnimationSurface::CoreAnimationSurface(Gfx::SharedImageBuffer const& shared_image_buffer)
: m_iosurface(Core::IOSurfaceHandle::from_ref(shared_image_buffer.iosurface_handle().core_foundation_pointer()))
{
@@ -284,6 +323,11 @@ bool CoreAnimationRemoteLayer::show_frame(Frame frame)
return true;
m_painted_size = painted_size;
}
+ if (frame.shows_no_store) {
+ if (painted_size.is_empty())
+ return true;
+ m_painted_size = painted_size;
+ }
if (m_painted_size.is_empty())
return true;
m_device_pixel_ratio = device_pixel_ratio;
@@ -297,31 +341,78 @@ bool CoreAnimationRemoteLayer::show_frame(Frame frame)
lay_out_frame(fit_within);
if (buffer)
content_layer.contents = (__bridge id)buffer->core_foundation_pointer();
+ else if (frame.shows_no_store && content_layer.contents)
+ content_layer.contents = nil;
show_sublayers(sublayers);
});
release_video_frames_window_server_let_go_of();
return true;
}
+static CoreAnimationRemoteLayer::SublayerKind kind_of(RemoteSublayer const& sublayer)
+{
+ using Kind = CoreAnimationRemoteLayer::SublayerKind;
+ return sublayer.content.visit(
+ [](RemoteSublayer::Group const&) { return Kind::Group; },
+ [](RemoteSublayer::Tile const&) { return Kind::Tile; },
+ [](Gfx::Color const&) { return Kind::Color; },
+ [](RemoteSublayer::Backdrop const&) { return Kind::Backdrop; },
+ [](auto const&) { return Kind::PlacedContent; });
+}
+
+CoreAnimationRemoteLayer::ShownSublayer& CoreAnimationRemoteLayer::shown_sublayer_of_kind(u64 identity, SublayerKind kind)
+{
+ if (auto shown_sublayer = m_shown_sublayers.find(identity); shown_sublayer != m_shown_sublayers.end()) {
+ if (shown_sublayer->value.kind == kind)
+ return shown_sublayer->value;
+ stop_showing_sublayer(shown_sublayer->value);
+ m_shown_sublayers.remove(shown_sublayer);
+ m_sublayer_got_another_layer = true;
+ }
+ ShownSublayer shown_sublayer;
+ shown_sublayer.kind = kind;
+ Class class_of_outermost_layer = kind == SublayerKind::Backdrop ? core_animation_backdrop_layer_class() : [CALayer class];
+ VERIFY(class_of_outermost_layer);
+ CALayer* outermost_layer = [[class_of_outermost_layer alloc] init];
+ outermost_layer.anchorPoint = CGPointZero;
+ shown_sublayer.outermost_layer = outermost_layer;
+ // A group fades what its sublayers show together, not each of them over the ones below it.
+ if (kind == SublayerKind::Group)
+ outermost_layer.allowsGroupOpacity = YES;
+ if (kind == SublayerKind::PlacedContent) {
+ outermost_layer.masksToBounds = YES;
+ auto* content_layer = [[CALayer alloc] init];
+ content_layer.anchorPoint = CGPointZero;
+ [outermost_layer addSublayer:content_layer];
+ shown_sublayer.content_layer = content_layer;
+ }
+ m_shown_sublayers.set(identity, move(shown_sublayer));
+ return *m_shown_sublayers.get(identity);
+}
+
void CoreAnimationRemoteLayer::show_sublayers(Vector<RemoteSublayer>& sublayers)
{
HashTable<u64> shown_identities;
- auto* ordered_layers = [NSMutableArray arrayWithObject:as_layer(m_content_layer)];
- for (auto& sublayer : sublayers) {
- auto& shown_sublayer = m_shown_sublayers.ensure(sublayer.identity, [] {
- ShownSublayer shown_sublayer;
- auto* clip_layer = [[CALayer alloc] init];
- clip_layer.anchorPoint = CGPointZero;
- clip_layer.masksToBounds = YES;
- auto* content_layer = [[CALayer alloc] init];
- content_layer.anchorPoint = CGPointZero;
- [clip_layer addSublayer:content_layer];
- shown_sublayer.clip_layer = clip_layer;
- shown_sublayer.content_layer = content_layer;
- return shown_sublayer;
- });
- update_shown_sublayer(shown_sublayer, sublayer);
- [ordered_layers addObject:as_layer(shown_sublayer.clip_layer)];
+ // Per sublayer, by its index, the identities of the sublayers in it where it is a group, and after those, the
+ // identities of the sublayers of the frame itself.
+ Vector<Vector<u64>> identities_of_sublayers_by_group_index;
+ identities_of_sublayers_by_group_index.resize(sublayers.size() + 1);
+ auto index_of_frame = sublayers.size();
+ for (size_t index = 0; index < sublayers.size(); ++index) {
+ auto& sublayer = sublayers[index];
+ auto& shown_sublayer = shown_sublayer_of_kind(sublayer.identity, kind_of(sublayer));
+ sublayer.content.visit(
+ [&](RemoteSublayer::Group& group) { update_shown_group(shown_sublayer, group); },
+ [&](RemoteSublayer::Tile& tile) { update_shown_tile(shown_sublayer, tile, sublayer.content_rect); },
+ [&](Gfx::Color& color) { update_shown_color(shown_sublayer, color, sublayer.content_rect); },
+ [&](RemoteSublayer::Backdrop& backdrop) { update_shown_backdrop(shown_sublayer, backdrop); },
+ [&](auto&) { update_shown_sublayer(shown_sublayer, sublayer); });
+ shown_sublayer.shown_at_device_pixel_ratio = m_device_pixel_ratio;
+ auto group_index = sublayer.group_index.value_or(index_of_frame);
+ // A group comes before the sublayers in it.
+ if (group_index != index_of_frame && (group_index >= index || !sublayers[group_index].content.has<RemoteSublayer::Group>()))
+ group_index = index_of_frame;
+ identities_of_sublayers_by_group_index[group_index].append(sublayer.identity);
shown_identities.set(sublayer.identity);
}
@@ -335,7 +426,30 @@ void CoreAnimationRemoteLayer::show_sublayers(Vector<RemoteSublayer>& sublayers)
stop_showing_sublayer(shown_sublayer);
}
- as_layer(m_frame_layer).sublayers = ordered_layers;
+ auto layers_of = [&](Vector<u64> const& identities) {
+ auto* layers = [NSMutableArray arrayWithCapacity:identities.size() + 1];
+ for (auto identity : identities)
+ [layers addObject:as_layer(m_shown_sublayers.get(identity)->outermost_layer)];
+ return layers;
+ };
+ for (size_t index = 0; index < sublayers.size(); ++index) {
+ auto& identities_of_sublayers = identities_of_sublayers_by_group_index[index];
+ auto& shown_group = *m_shown_sublayers.get(sublayers[index].identity);
+ if (shown_group.kind != SublayerKind::Group)
+ continue;
+ if (!m_sublayer_got_another_layer && shown_group.identities_of_sublayers == identities_of_sublayers)
+ continue;
+ as_layer(shown_group.outermost_layer).sublayers = layers_of(identities_of_sublayers);
+ shown_group.identities_of_sublayers = move(identities_of_sublayers);
+ }
+ auto& identities_of_sublayers_of_frame = identities_of_sublayers_by_group_index[index_of_frame];
+ if (m_sublayer_got_another_layer || m_identities_of_sublayers_of_frame != identities_of_sublayers_of_frame) {
+ auto* layers_of_frame = layers_of(identities_of_sublayers_of_frame);
+ [layers_of_frame insertObject:as_layer(m_content_layer) atIndex:0];
+ as_layer(m_frame_layer).sublayers = layers_of_frame;
+ m_identities_of_sublayers_of_frame = move(identities_of_sublayers_of_frame);
+ }
+ m_sublayer_got_another_layer = false;
}
static CGAffineTransform to_core_graphics(Gfx::AffineTransform const& transform)
@@ -418,7 +532,7 @@ void CoreAnimationRemoteLayer::use_content_layer_of_kind_for(ShownSublayer& show
void CoreAnimationRemoteLayer::update_shown_sublayer(ShownSublayer& shown_sublayer, RemoteSublayer& sublayer)
{
auto device_pixel_ratio = m_device_pixel_ratio;
- auto* clip_layer = as_layer(shown_sublayer.clip_layer);
+ auto* clip_layer = as_layer(shown_sublayer.outermost_layer);
use_content_layer_of_kind_for(shown_sublayer, sublayer);
auto* content_layer = as_layer(shown_sublayer.content_layer);
clip_layer.frame = in_points(sublayer.clip_rect, device_pixel_ratio);
@@ -480,6 +594,198 @@ void CoreAnimationRemoteLayer::update_shown_sublayer(ShownSublayer& shown_sublay
show_content(shown_sublayer, sublayer);
}
+static CGPoint in_points(Gfx::FloatPoint point, double device_pixel_ratio)
+{
+ return CGPointMake(point.x() / device_pixel_ratio, point.y() / device_pixel_ratio);
+}
+
+static bool places_alike(RemoteSublayer::Group const& a, RemoteSublayer::Group const& b)
+{
+ auto const& transform = a.to_parent;
+ auto const& other_transform = b.to_parent;
+ return transform.a() == other_transform.a() && transform.b() == other_transform.b() && transform.c() == other_transform.c()
+ && transform.d() == other_transform.d() && transform.e() == other_transform.e() && transform.f() == other_transform.f()
+ && a.clip_rect == b.clip_rect;
+}
+
+static bool rounds_corners_alike(RemoteSublayer::Group const& a, RemoteSublayer::Group const& b)
+{
+ auto size_clipped_to = [](RemoteSublayer::Group const& group) { return group.clip_rect.map([](auto const& clip_rect) { return clip_rect.size(); }); };
+ return a.corner_radii == b.corner_radii && size_clipped_to(a) == size_clipped_to(b);
+}
+
+// The one radius that every rounded corner has, or none where two rounded corners differ or one is elliptical.
+static Optional<int> single_radius_of_rounded_corners(Gfx::CornerRadii const& corner_radii)
+{
+ Optional<int> single_radius;
+ for (auto const& corner : { corner_radii.top_left, corner_radii.top_right, corner_radii.bottom_right, corner_radii.bottom_left }) {
+ if (!corner)
+ continue;
+ if (corner.horizontal_radius != corner.vertical_radius || single_radius.value_or(corner.horizontal_radius) != corner.horizontal_radius)
+ return {};
+ single_radius = corner.horizontal_radius;
+ }
+ return single_radius.value_or(0);
+}
+
+// The outline of a rect of the size whose corners are each rounded by a quarter of an ellipse, in the coordinates of a
+// layer whose y-axis points down.
+static CGPathRef create_outline_of_rect_with_rounded_corners(CGSize size, Gfx::CornerRadii const& corner_radii, double device_pixel_ratio)
+{
+ // How far along a radius the control points of the cubic curve nearest a quarter of an ellipse are.
+ static constexpr CGFloat control_point_distance_along_radius = 0.5522847498;
+ auto radii_in_points = [&](Gfx::CornerRadius const& corner) {
+ if (!corner)
+ return CGSizeZero;
+ return CGSizeMake(min(corner.horizontal_radius / device_pixel_ratio, size.width), min(corner.vertical_radius / device_pixel_ratio, size.height));
+ };
+ auto top_left = radii_in_points(corner_radii.top_left);
+ auto top_right = radii_in_points(corner_radii.top_right);
+ auto bottom_right = radii_in_points(corner_radii.bottom_right);
+ auto bottom_left = radii_in_points(corner_radii.bottom_left);
+ auto distance_to_control_point = [](CGFloat radius) { return radius * (1 - control_point_distance_along_radius); };
+ auto* outline = CGPathCreateMutable();
+ CGPathMoveToPoint(outline, nullptr, top_left.width, 0);
+ CGPathAddLineToPoint(outline, nullptr, size.width - top_right.width, 0);
+ CGPathAddCurveToPoint(outline, nullptr, size.width - distance_to_control_point(top_right.width), 0, size.width, distance_to_control_point(top_right.height), size.width, top_right.height);
+ CGPathAddLineToPoint(outline, nullptr, size.width, size.height - bottom_right.height);
+ CGPathAddCurveToPoint(outline, nullptr, size.width, size.height - distance_to_control_point(bottom_right.height), size.width - distance_to_control_point(bottom_right.width), size.height, size.width - bottom_right.width, size.height);
+ CGPathAddLineToPoint(outline, nullptr, bottom_left.width, size.height);
+ CGPathAddCurveToPoint(outline, nullptr, distance_to_control_point(bottom_left.width), size.height, 0, size.height - distance_to_control_point(bottom_left.height), 0, size.height - bottom_left.height);
+ CGPathAddLineToPoint(outline, nullptr, 0, top_left.height);
+ CGPathAddCurveToPoint(outline, nullptr, 0, distance_to_control_point(top_left.height), distance_to_control_point(top_left.width), 0, top_left.width, 0);
+ CGPathCloseSubpath(outline);
+ return outline;
+}
+
+// A group layer has the rect the group clips to as its bounds, or no bounds at its origin, so that its sublayers are
+// laid out in the pixels of the group. It is placed by where the origin of those bounds goes, with the rest of the
+// group's transform around that point. A frame that only moves the group, as a scroll does, sets nothing else.
+void CoreAnimationRemoteLayer::update_shown_group(ShownSublayer& shown_sublayer, RemoteSublayer::Group const& group)
+{
+ auto device_pixel_ratio = m_device_pixel_ratio;
+ auto const* shown_group = shown_sublayer.shown_group.has_value() && shown_sublayer.shown_at_device_pixel_ratio == device_pixel_ratio ? &shown_sublayer.shown_group.value() : nullptr;
+ auto* group_layer = as_layer(shown_sublayer.outermost_layer);
+ auto bounds = in_points(group.clip_rect.value_or({}), device_pixel_ratio);
+ if (!shown_group || !places_alike(*shown_group, group)) {
+ auto const& to_parent = group.to_parent;
+ group_layer.bounds = bounds;
+ group_layer.position = in_points(to_parent.map(group.clip_rect.value_or({}).location()), device_pixel_ratio);
+ group_layer.affineTransform = CGAffineTransformMake(to_parent.a(), to_parent.b(), to_parent.c(), to_parent.d(), 0, 0);
+ group_layer.masksToBounds = group.clip_rect.has_value();
+ }
+ if (!shown_group || shown_group->opacity != group.opacity)
+ group_layer.opacity = group.opacity;
+ if (!shown_group || !rounds_corners_alike(*shown_group, group)) {
+ // The window server rounds the corners of a layer by one radius. Corners that differ, or that are elliptical,
+ // are cut by a mask of their outline instead, which costs it a pass of its own.
+ auto const& corner_radii = group.corner_radii;
+ auto single_radius = single_radius_of_rounded_corners(corner_radii);
+ group_layer.cornerRadius = single_radius.value_or(0) / device_pixel_ratio;
+ // The corners are named in the layer's own coordinates, whose y-axis points down here like the frame's.
+ CACornerMask masked_corners = 0;
+ if (corner_radii.top_left)
+ masked_corners |= kCALayerMinXMinYCorner;
+ if (corner_radii.top_right)
+ masked_corners |= kCALayerMaxXMinYCorner;
+ if (corner_radii.bottom_right)
+ masked_corners |= kCALayerMaxXMaxYCorner;
+ if (corner_radii.bottom_left)
+ masked_corners |= kCALayerMinXMaxYCorner;
+ group_layer.maskedCorners = masked_corners;
+ if (single_radius.has_value() || !group.clip_rect.has_value()) {
+ group_layer.mask = nil;
+ } else {
+ auto* outline_layer = [CAShapeLayer layer];
+ outline_layer.anchorPoint = CGPointZero;
+ auto* outline = create_outline_of_rect_with_rounded_corners(bounds.size, corner_radii, device_pixel_ratio);
+ outline_layer.path = outline;
+ CGPathRelease(outline);
+ group_layer.mask = outline_layer;
+ }
+ }
+ // The outline is laid out in the pixels of the group, as its sublayers are.
+ if (group_layer.mask)
+ group_layer.mask.frame = bounds;
+ shown_sublayer.shown_group = group;
+}
+
+void CoreAnimationRemoteLayer::update_shown_tile(ShownSublayer& shown_sublayer, RemoteSublayer::Tile& tile, Gfx::IntRect rect)
+{
+ auto device_pixel_ratio = m_device_pixel_ratio;
+ auto* tile_layer = as_layer(shown_sublayer.outermost_layer);
+ if (shown_sublayer.shown_rect != rect || shown_sublayer.shown_at_device_pixel_ratio != device_pixel_ratio) {
+ tile_layer.frame = in_points(rect, device_pixel_ratio);
+ shown_sublayer.shown_rect = rect;
+ }
+ if (shown_sublayer.shown_as_opaque != tile.every_pixel_is_opaque) {
+ tile_layer.opaque = tile.every_pixel_is_opaque;
+ shown_sublayer.shown_as_opaque = tile.every_pixel_is_opaque;
+ }
+ auto const* shown_lease = shown_sublayer.content.get_pointer<PresentableSurface::Lease>();
+ if (shown_lease && &shown_lease->surface() == &tile.surface.surface())
+ return;
+ auto& surface = tile.surface.surface();
+ surface.did_hand_to_window_server();
+ tile_layer.contents = (__bridge id)iosurface_of(surface).core_foundation_pointer();
+ shown_sublayer.content = move(tile.surface);
+}
+
+void CoreAnimationRemoteLayer::update_shown_color(ShownSublayer& shown_sublayer, Gfx::Color color, Gfx::IntRect rect)
+{
+ auto device_pixel_ratio = m_device_pixel_ratio;
+ auto* color_layer = as_layer(shown_sublayer.outermost_layer);
+ if (shown_sublayer.shown_rect != rect || shown_sublayer.shown_at_device_pixel_ratio != device_pixel_ratio) {
+ color_layer.frame = in_points(rect, device_pixel_ratio);
+ shown_sublayer.shown_rect = rect;
+ }
+ if (shown_sublayer.shown_color == color)
+ return;
+ auto* core_graphics_color = CGColorCreateSRGB(color.red() / 255.0, color.green() / 255.0, color.blue() / 255.0, color.alpha() / 255.0);
+ color_layer.backgroundColor = core_graphics_color;
+ CGColorRelease(core_graphics_color);
+ color_layer.opaque = color.alpha() == 255;
+ shown_sublayer.shown_color = color;
+}
+
+// The window server blurs by a standard deviation in points, and fills in what lies past the edge of a backdrop by
+// normalizing, which comes closest to mirroring at the edge. A CAColorMatrix holds the same 20 floats in the same
+// order, and the window server applies it to unpremultiplied colours as well.
+static NSArray* core_animation_filters_of(RemoteSublayer::Backdrop const& backdrop, double device_pixel_ratio)
+{
+ auto filter_class = (Class<LadybirdCoreAnimationFilterClass>)core_animation_filter_class();
+ auto* core_animation_filters = [NSMutableArray arrayWithCapacity:backdrop.filters.size()];
+ for (auto const& filter : backdrop.filters) {
+ switch (filter.kind) {
+ case RemoteSublayer::Backdrop::Filter::Kind::Blur: {
+ id blur = [filter_class filterWithType:@"gaussianBlur"];
+ [blur setValue:@(filter.blur_standard_deviation / device_pixel_ratio) forKey:@"inputRadius"];
+ [blur setValue:@YES forKey:@"inputNormalizeEdges"];
+ [core_animation_filters addObject:blur];
+ break;
+ }
+ case RemoteSublayer::Backdrop::Filter::Kind::ColorMatrix: {
+ id color_matrix = [filter_class filterWithType:@"colorMatrix"];
+ [color_matrix setValue:[NSValue valueWithBytes:filter.color_matrix.data() objCType:"{CAColorMatrix=ffffffffffffffffffff}"] forKey:@"inputColorMatrix"];
+ [core_animation_filters addObject:color_matrix];
+ break;
+ }
+ }
+ }
+ return core_animation_filters;
+}
+
+void CoreAnimationRemoteLayer::update_shown_backdrop(ShownSublayer& shown_sublayer, RemoteSublayer::Backdrop const& backdrop)
+{
+ auto device_pixel_ratio = m_device_pixel_ratio;
+ if (shown_sublayer.shown_backdrop == backdrop && shown_sublayer.shown_at_device_pixel_ratio == device_pixel_ratio)
+ return;
+ auto* backdrop_layer = as_layer(shown_sublayer.outermost_layer);
+ backdrop_layer.frame = in_points(backdrop.region, device_pixel_ratio);
+ backdrop_layer.filters = core_animation_filters_of(backdrop, device_pixel_ratio);
+ shown_sublayer.shown_backdrop = backdrop;
+}
+
// The window server converts a YCbCr surface to RGB by the matrix it is tagged with. It decodes the transfer of SDR
// video by a curve of its own whatever the transfer is tagged as, but the colour space of the surface overrides that,
// and naming it after sRGB draws the video as the frame draws it. PQ and HLG video is tagged as what it is.
@@ -675,6 +981,9 @@ void CoreAnimationRemoteLayer::show_content(ShownSublayer& shown_sublayer, Remot
content_layer.opaque = NO;
content_layer.contents = (__bridge id)iosurface.core_foundation_pointer();
shown_sublayer.content = move(lease);
+ },
+ [](auto&) {
+ VERIFY_NOT_REACHED();
});
}
@@ -689,12 +998,15 @@ void CoreAnimationRemoteLayer::stop_showing_content(ShownSublayer& shown_sublaye
void CoreAnimationRemoteLayer::stop_showing_sublayer(ShownSublayer& shown_sublayer)
{
- stop_showing_content(shown_sublayer);
- [as_layer(shown_sublayer.clip_layer) removeFromSuperlayer];
- [as_layer(shown_sublayer.content_layer) release];
+ if (shown_sublayer.kind == SublayerKind::PlacedContent)
+ stop_showing_content(shown_sublayer);
+ shown_sublayer.content = Empty {};
+ [as_layer(shown_sublayer.outermost_layer) removeFromSuperlayer];
+ if (shown_sublayer.content_layer)
+ [as_layer(shown_sublayer.content_layer) release];
if (shown_sublayer.rounded_clip_layer)
[as_layer(shown_sublayer.rounded_clip_layer) release];
- [as_layer(shown_sublayer.clip_layer) release];
+ [as_layer(shown_sublayer.outermost_layer) release];
}
void CoreAnimationRemoteLayer::keep_video_frame_until_window_server_lets_go(NonnullRefPtr<Media::VideoFrame> frame)
diff --git a/Services/Compositor/RemoteLayer.h b/Services/Compositor/RemoteLayer.h
index ad50fabb0b1..0663e0e3d4f 100644
--- a/Services/Compositor/RemoteLayer.h
+++ b/Services/Compositor/RemoteLayer.h
@@ -38,15 +38,18 @@ public:
virtual bool can_show(WindowServerPlacement const&, Content const&, double device_pixel_ratio) const = 0;
struct Frame {
- // Without a store, the frame shown before stays, and only the sublayers change.
+ // Without a store, the store shown before stays, and only the sublayers change, unless the frame shows no store.
Optional<PresentableSurface::Lease> store;
+ // Whether the sublayers are all of the frame, which then shows no store below them.
+ bool shows_no_store { false };
Gfx::IntSize painted_size;
double device_pixel_ratio { 1.0 };
Optional<Gfx::IntSize> fit_within;
Vector<RemoteSublayer> sublayers;
};
// Shows the part of the store that the frame was painted into, at the top left of the layer at its own size, or
- // scaled to fit within the size of the view given, in device pixels, with the sublayers above it, bottom to top.
+ // scaled to fit within the size of the view given, in device pixels, with the sublayers above it, bottom to top,
+ // each group with the sublayers in it.
[[nodiscard]] virtual bool show_frame(Frame) = 0;
// Places the frame on display again, as when the view that it is scaled into changes size.
virtual void place_frame(Optional<Gfx::IntSize> fit_within) = 0;
diff --git a/Services/Compositor/RemoteSublayer.h b/Services/Compositor/RemoteSublayer.h
index ffd560f7a59..defb5f7d8fe 100644
--- a/Services/Compositor/RemoteSublayer.h
+++ b/Services/Compositor/RemoteSublayer.h
@@ -6,20 +6,26 @@
#pragma once
+#include <AK/Array.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Optional.h>
#include <AK/Types.h>
#include <AK/Variant.h>
+#include <AK/Vector.h>
#include <Compositor/PresentableSurface.h>
#include <LibGfx/AffineTransform.h>
+#include <LibGfx/Color.h>
+#include <LibGfx/CornerRadii.h>
#include <LibGfx/Rect.h>
#include <LibGfx/ScalingMode.h>
+#include <LibGfx/Size.h>
#include <LibMediaCodecs/VideoFrame.h>
namespace Compositor {
-// Content that the window server shows above the frame as it is, placed and clipped as drawing it into the frame would
-// have placed and clipped it. Geometry is in device pixels.
+// Content that the window server shows of a frame by itself: a video frame or a surface placed and clipped as drawing it
+// into the frame would have placed and clipped it, or a tile or a fill of a painted layer in a group that places and
+// clips every sublayer in it. Geometry is in device pixels.
struct RemoteSublayer {
struct RoundedClip {
Gfx::FloatRect rect;
@@ -30,11 +36,55 @@ struct RemoteSublayer {
bool rounds_bottom_left { false };
};
+ // Holds the sublayers that name it as their group.
+ struct Group {
+ // From the pixels of the group to those of the group it is in, or to those of the frame.
+ Gfx::AffineTransform to_parent;
+ // Clips the sublayers of the group to this rect of its own pixels, with its corners rounded by the radii.
+ Optional<Gfx::FloatRect> clip_rect;
+ Gfx::CornerRadii corner_radii;
+ // Composites the sublayers of the group at this opacity, once they are composited with each other.
+ float opacity { 1 };
+ };
+
+ struct Tile {
+ PresentableSurface::Lease surface;
+ bool every_pixel_is_opaque { false };
+ };
+
+ // What the window server shows below the sublayer, within a rect of the pixels of its group, run through filters.
+ struct Backdrop {
+ struct Filter {
+ enum class Kind : u8 {
+ Blur,
+ ColorMatrix,
+ };
+ Kind kind { Kind::Blur };
+ // In device pixels.
+ float blur_standard_deviation { 0 };
+ // Row-major, with the offsets in the fifth column, for unpremultiplied colors from 0 to 1.
+ Array<float, 20> color_matrix {};
+
+ bool operator==(Filter const&) const = default;
+ };
+
+ Gfx::FloatRect region;
+ // Applied in order.
+ Vector<Filter, 3> filters;
+
+ bool operator==(Backdrop const&) const = default;
+ };
+
// Tells a sublayer apart from the others from one frame to the next, so that a frame changes only what moved.
u64 identity { 0 };
- Variant<NonnullRefPtr<Media::VideoFrame>, PresentableSurface::Lease> content;
- // Where the content is drawn, in its own space, which the transform maps into the frame.
+ // The index, among the sublayers of the frame, of the group the sublayer is in, which comes before it. Sublayers of
+ // one group, and those of the frame itself, which have none, are shown bottom to top.
+ Optional<size_t> group_index;
+ Variant<NonnullRefPtr<Media::VideoFrame>, PresentableSurface::Lease, Group, Tile, Gfx::Color, Backdrop> content;
+ // Where a video frame or a surface is drawn, in its own space, which the transform maps into the frame. Where a
+ // tile or a color is shown, in the pixels of its group.
Gfx::IntRect content_rect;
+ // The transform, the clips and the scaling mode place a video frame or a surface only.
Gfx::AffineTransform content_to_frame;
Gfx::FloatRect clip_rect;
Optional<RoundedClip> rounded_clip;
diff --git a/Services/Compositor/Rust/build.rs b/Services/Compositor/Rust/build.rs
index 67fe0582899..6c9be8bf323 100644
--- a/Services/Compositor/Rust/build.rs
+++ b/Services/Compositor/Rust/build.rs
@@ -55,6 +55,7 @@ fn main() -> Result<(), Box<dyn Error>> {
for (rust_name, cpp_name) in [
("Span", "AK::ReadonlySpan"),
("Color", "Gfx::Color"),
+ ("CornerRadii", "Gfx::CornerRadii"),
("FloatPoint", "Gfx::FloatPoint"),
("FloatRect", "Gfx::FloatRect"),
("IntRect", "Gfx::IntRect"),
@@ -98,6 +99,7 @@ fn main() -> Result<(), Box<dyn Error>> {
"LibCompositing/DisplayList/DisplayListCommandsGenerated.h",
"LibCompositing/DisplayList/DisplayListResourceIds.h",
"LibGfx/Color.h",
+ "LibGfx/CornerRadii.h",
"LibGfx/Point.h",
"LibGfx/Rect.h",
"LibGfx/ScalingMode.h",
diff --git a/Services/Compositor/Rust/src/core/presenting.rs b/Services/Compositor/Rust/src/core/presenting.rs
index 423ae9645a2..cb0d7c491cd 100644
--- a/Services/Compositor/Rust/src/core/presenting.rs
+++ b/Services/Compositor/Rust/src/core/presenting.rs
@@ -40,8 +40,10 @@ pub(crate) struct PendingAsyncPresent {
// A frame that started rendering before its context was bound has no published buffer to present to.
publish_to_presentation: bool,
shows_in_remote_layer: bool,
- // A frame that changes only what the window server shows above the frame on screen.
+ // A frame that changes only what the window server shows by itself.
keeps_shown_store: bool,
+ // A frame the window server shows every layer of by itself, with no store below them.
+ shows_no_store: bool,
sublayers: Option<SublayersHandle>,
}
@@ -55,6 +57,7 @@ struct Delivery {
publish_to_presentation: bool,
shows_in_remote_layer: bool,
keeps_shown_store: bool,
+ shows_no_store: bool,
sublayers: Option<SublayersHandle>,
}
@@ -475,6 +478,7 @@ impl CompositorCore {
publish_to_presentation: !shows_in_remote_layer && bound_presentation.is_some(),
shows_in_remote_layer,
keeps_shown_store: prepared_frame.rendered_surface.is_none(),
+ shows_no_store: prepared_frame.window_server_shows_every_layer,
sublayers,
});
presenting.did_submit_prepared_frame(pending_frame.viewport_rect);
@@ -511,6 +515,7 @@ impl CompositorCore {
publish_to_presentation: present.publish_to_presentation,
shows_in_remote_layer: present.shows_in_remote_layer,
keeps_shown_store: present.keeps_shown_store,
+ shows_no_store: present.shows_no_store,
sublayers: present.sublayers.take(),
})
}
@@ -638,6 +643,7 @@ impl CompositorCore {
.unwrap_or_else(|| self.raster.build_sublayers(context_id, &[]));
let frame = FfiRemoteLayerFrame {
store: store.as_ref().map_or(std::ptr::null(), |store| store.as_ffi()),
+ shows_no_store: delivery.shows_no_store,
painted_size: viewport_size,
device_pixel_ratio: delivery.device_pixel_ratio,
has_fit_within: fit_within.is_some(),
diff --git a/Services/Compositor/Rust/src/overlays.rs b/Services/Compositor/Rust/src/overlays.rs
index d345a62dd65..a9e7819998d 100644
--- a/Services/Compositor/Rust/src/overlays.rs
+++ b/Services/Compositor/Rust/src/overlays.rs
@@ -365,6 +365,25 @@ fn replay_overlay_records(records: &AlignedRecords, painter: &mut impl ReplayPai
}
impl OverlayPicture {
+ /// Whether the overlays draw over a frame what `other` draws over its frame, but for the overlay of the compositor's
+ /// layers.
+ pub fn draws_same_as(&self, other: &OverlayPicture) -> bool {
+ let picture_in_picture_controls_draw_the_same =
+ match (&self.picture_in_picture_controls, &other.picture_in_picture_controls) {
+ (Some(controls), Some(other_controls)) => {
+ controls.opacity == other_controls.opacity
+ && controls.bounds == other_controls.bounds
+ && controls.records.as_bytes() == other_controls.records.as_bytes()
+ }
+ (None, None) => true,
+ _ => false,
+ };
+ self.bounds == other.bounds
+ && self.scrollbars == other.scrollbars
+ && self.ui_overlay_records.as_bytes() == other.ui_overlay_records.as_bytes()
+ && picture_in_picture_controls_draw_the_same
+ }
+
/// Paints the overlays over a frame: the scrollbars the compositor paints, and unless they are left out, the
/// overlays of the browser.
pub fn paint(&self, painter: &mut impl ReplayPainter, paints_ui_overlays: bool) {
diff --git a/Services/Compositor/Rust/src/presenting/layer_overlay.rs b/Services/Compositor/Rust/src/presenting/layer_overlay.rs
index c356ba72d0c..48b1dc285d4 100644
--- a/Services/Compositor/Rust/src/presenting/layer_overlay.rs
+++ b/Services/Compositor/Rust/src/presenting/layer_overlay.rs
@@ -143,6 +143,22 @@ impl std::fmt::Display for MediaPresentation {
}
}
+/// Who composites a painted layer of a frame.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum PaintedLayerPresentation {
+ ShownByWindowServer,
+ HeldByFrame { why: String },
+}
+
+impl std::fmt::Display for PaintedLayerPresentation {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ PaintedLayerPresentation::ShownByWindowServer => formatter.write_str("shown by the window server"),
+ PaintedLayerPresentation::HeldByFrame { why } => write!(formatter, "held by the frame: {why}"),
+ }
+ }
+}
+
/// What a frame did to bring the tiles of its layers up to date.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct FrameWorkCounts {
@@ -191,7 +207,10 @@ pub struct ModelTile {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ModelLayerContent {
/// By cell, the tiles the layer holds, and those highlighted where it holds none.
- Painted { tiles: Vec<ModelTile> },
+ Painted {
+ tiles: Vec<ModelTile>,
+ presentation: PaintedLayerPresentation,
+ },
Media {
reach: IntRect,
presentation: MediaPresentation,
@@ -239,7 +258,7 @@ impl ModelLayer {
fn bounds_in_layer_space(&self) -> IntRect {
match &self.content {
- ModelLayerContent::Painted { tiles } => tiles
+ ModelLayerContent::Painted { tiles, .. } => tiles
.iter()
.filter_map(|tile| tile.held_part_of_cell)
.fold(IntRect::default(), IntRect::united),
@@ -344,7 +363,7 @@ fn labels_of_model<'a>(model: &'a LayerOverlayModel, marked: &MarkedLayers) -> L
.rev()
.map(|layer| {
let mut labeled_tiles = Vec::new();
- if let ModelLayerContent::Painted { tiles } = &layer.content {
+ if let ModelLayerContent::Painted { tiles, .. } = &layer.content {
let visible_rect = layer.visible_rect_in_frame(model.viewport_rect);
for tile in tiles {
if labeled_tile_count == MAXIMUM_LABELED_TILE_COUNT {
@@ -390,7 +409,7 @@ fn memory_size_text(bytes: u64) -> String {
impl LayerOverlayModel {
fn details_of_layer(layer: &ModelLayer) -> String {
match &layer.content {
- ModelLayerContent::Painted { tiles } => {
+ ModelLayerContent::Painted { tiles, presentation } => {
let held_tile_count = tiles.iter().filter(|tile| tile.held_part_of_cell.is_some()).count() as u64;
let one_color_tile_count = tiles.iter().filter(|tile| tile.is_one_color).count();
let bytes_held_by_tile_surfaces: u64 = tiles
@@ -400,7 +419,7 @@ impl LayerOverlayModel {
.map(|held_part| held_part.width.max(0) as u64 * held_part.height.max(0) as u64 * BYTES_PER_PIXEL)
.sum();
format!(
- "{} ({one_color_tile_count} of one color), {}",
+ "{} ({one_color_tile_count} of one color), {}, {presentation}",
count_with_noun(held_tile_count, "tile", "tiles"),
memory_size_text(bytes_held_by_tile_surfaces)
)
@@ -753,7 +772,7 @@ impl LayerOverlay {
let mut raster_history_of_tiles_by_layer = std::mem::take(&mut self.raster_history_of_tiles_by_layer);
let mut kept_raster_history_of_tiles_by_layer = HashMap::with_capacity(layers.len());
for layer in layers {
- let ModelLayerContent::Painted { tiles } = &mut layer.content else {
+ let ModelLayerContent::Painted { tiles, .. } = &mut layer.content else {
continue;
};
let Some(mut raster_history_of_tiles) = raster_history_of_tiles_by_layer.remove(&layer.identity) else {
@@ -935,7 +954,7 @@ impl OverlayDrawing<'_> {
layer: &ModelLayer,
viewport_rect: IntRect,
) {
- let ModelLayerContent::Painted { tiles } = &layer.content else {
+ let ModelLayerContent::Painted { tiles, .. } = &layer.content else {
return;
};
let visible_rect = layer.visible_rect_in_frame(viewport_rect);
@@ -956,7 +975,7 @@ impl OverlayDrawing<'_> {
/// The grid of the tiles the layer holds, tinting those of one color.
fn draw_tiles_held_by_layer(&self, recorder: &mut OverlayRecorder<'_>, layer: &ModelLayer, viewport_rect: IntRect) {
- let ModelLayerContent::Painted { tiles } = &layer.content else {
+ let ModelLayerContent::Painted { tiles, .. } = &layer.content else {
return;
};
let visible_rect = layer.visible_rect_in_frame(viewport_rect);
@@ -1230,6 +1249,7 @@ mod tests {
composite_clip: None,
raster_counts_since_reset: RasterCountsByCause::default(),
content: ModelLayerContent::Painted {
+ presentation: PaintedLayerPresentation::ShownByWindowServer,
tiles: held_coords
.iter()
.map(|&coord| ModelTile {
@@ -1288,7 +1308,7 @@ mod tests {
) -> (Vec<(TileCoord, bool, u32)>, Option<MonotonicTime>) {
let mut layers = [layer];
let highlights_fade_until = overlay.merge_raster_history_into(&mut layers, painted_at);
- let ModelLayerContent::Painted { tiles } = &layers[0].content else {
+ let ModelLayerContent::Painted { tiles, .. } = &layers[0].content else {
panic!("the layer is painted");
};
let tiles = tiles
diff --git a/Services/Compositor/Rust/src/presenting/layers.rs b/Services/Compositor/Rust/src/presenting/layers.rs
index a6f9b4a5bb4..57978fe2e89 100644
--- a/Services/Compositor/Rust/src/presenting/layers.rs
+++ b/Services/Compositor/Rust/src/presenting/layers.rs
@@ -9,7 +9,7 @@
use super::layer_overlay::{
FrameWorkCounts, LayerOverlayModel, MediaPresentation, ModelLayer, ModelLayerContent, NamedVisualContextNode,
- RasterCountsByCause, layers_whose_names_are_shown,
+ PaintedLayerPresentation, RasterCountsByCause, layers_whose_names_are_shown,
};
use super::tiles::{LayerTiles, LayerToRaster, TileDraw, TileShownInFrame, joined_rects_of_grid_given_row_by_row};
use super::window_server::{WhyMediaIsReplayed, WindowServerLayers};
@@ -18,7 +18,7 @@ use super::{
composite_inside_effects_of_frame, inflated, rect_of_size, replay_into, replay_with_scroll_offsets, size_of,
};
use crate::context_scene::ReceivedLayerPlan;
-use crate::raster_host::LiveContent;
+use crate::raster_host::{FfiSublayer, LiveContent};
use crate::surfaces::painting_surface::PaintingSurface;
use libcompositing_rust::display_list::commands::{
CanvasId, CompositorContextId, EffectNodeIndex, ImageFrameResourceId, SpatialNodeIndex, VideoSinkHandle,
@@ -28,8 +28,9 @@ use libcompositing_rust::display_list::effect_geometry::{
};
use libcompositing_rust::display_list::layers::{
BandIndex, LayerContent, LayerIdentity, LayerIndex, LayerStack, LayeringObstacles, NodeNamesFromIndices,
- PlacementNodeIdentity, RasterSpaceIndex, SpaceToFrame, StackLayer, VisualContextNodeNamer, WhyListIsOneLayer,
- WindowServerPlacementsOfMedia,
+ PlacementNodeIdentity, RasterSpaceIndex, SpaceToFrame, StackLayer, VisualContextNodeNamer,
+ WhatWindowServerShowsOfFrame, WhyFrameHoldsLayer, WhyListIsOneLayer, WindowServerCompositing,
+ WindowServerPlacementsOfEffects, WindowServerPlacementsOfMedia,
};
use libcompositing_rust::display_list::placement::{
RasterSpaceGeometry, RasterSpaces, WhatEverySpaceOfTreeShares, raster_scroll_offsets,
@@ -103,8 +104,8 @@ impl LiveContentVersions for LiveContentVersionsOfFrame<'_> {
}
/// Where a frame composites a layer: offset by the scroll offsets of its space's anchors, within its composite clip
-/// and the rounded composite clips inside it, and whether the frame holds it or the window server shows it above the
-/// frame.
+/// and the rounded composite clips inside it, and whether the frame holds it or the window server shows it by
+/// itself.
#[derive(Clone, Debug)]
pub struct LayerCompositingInFrame {
/// Where the layer is in the stack the frame draws with.
@@ -172,7 +173,7 @@ struct BandTileKeysOfFrame {
/// What a frame paints of its layers: where it composites them, the tiles it shows of each, and the media and composited
/// effects it draws.
pub struct LayerUpdate {
- layers: PaintedLayers,
+ pub(super) layers: PaintedLayers,
/// What each composited effect that reads past each of its pixels reads and draws as the frame places it.
read_reaches_of_composited_effects_in_frame: Vec<IntRect>,
// Per layer of the stack.
@@ -191,6 +192,23 @@ impl LayerUpdate {
self.layers.shown_by_window_server()
}
+ pub fn window_server_shows_every_layer(&self) -> bool {
+ self.layers.window_server_shows_every_layer()
+ }
+
+ /// Whether the window server shows layers of the frame tile by tile, which the frame rasters the tiles of even
+ /// where it paints nothing into a store.
+ pub fn window_server_shows_tiles(&self) -> bool {
+ self.layers.shown_by_window_server() && self.layers.window_server_compositing.shows_tiles_of_painted_layers
+ }
+
+ /// Has the frame hold every layer, as where the window server could not be given what it was to show.
+ pub(super) fn hold_every_layer_in_frame(&mut self) {
+ for compositing in &mut self.layers.compositing_of_layers {
+ compositing.shown_by_window_server = false;
+ }
+ }
+
/// The damage grown over all that a composited effect reads wherever it reaches that, as compositing the effect
/// reads what is composited below it, which the frame painted before holds only under what it composited above.
pub fn damage_grown_over_what_composited_effects_read(&self, mut damage: IntRect) -> IntRect {
@@ -405,17 +423,34 @@ pub struct PaintedLayers {
/// From the base layer up, the layers that can hold something, and where the frame composites each.
pub(super) compositing_of_layers: Vec<LayerCompositingInFrame>,
pub(super) window_server_placements_of_media: WindowServerPlacementsOfMedia,
+ pub(super) window_server_placements_of_effects: WindowServerPlacementsOfEffects,
+ /// What the window server that shows the frame composites by itself, besides canvases and videos.
+ pub(super) window_server_compositing: WindowServerCompositing,
content_hash_by_composited_node: HashMap<PlacementNodeIdentity, ContentHash>,
media_replayed_by_identity: HashMap<LayerIdentity, MediaRecordsReplayedInFrame>,
}
impl PaintedLayers {
- /// Whether the window server shows layers above the base layer of the frame.
+ /// Whether the window server shows layers of the frame by itself.
pub fn shown_by_window_server(&self) -> bool {
self.compositing_of_layers
.iter()
.any(|compositing| compositing.shown_by_window_server)
}
+
+ /// Whether the window server shows every layer of the frame by itself, so that the frame holds none and needs no
+ /// store. It shows the base layer only where it shows every layer above it.
+ pub fn window_server_shows_every_layer(&self) -> bool {
+ self.compositing_of_layers
+ .first()
+ .is_some_and(|base_layer_compositing| base_layer_compositing.shown_by_window_server)
+ }
+
+ /// Whether the window server shows the tiles of the layer by itself, so that what changes of them changes
+ /// nothing of what the frame holds.
+ fn window_server_shows_tiles_of(&self, compositing: &LayerCompositingInFrame) -> bool {
+ compositing.shown_by_window_server && self.window_server_compositing.shows_tiles_of_painted_layers
+ }
}
/// The layers of the frames of a context, their tiles, and what of them the window server shows.
@@ -736,10 +771,10 @@ fn hide_tiles_covered_by_opaque_tiles_above(
});
hidden_tile_count += tile_count_before - shown.len();
}
- let frame_holds_layer = !compositing.shown_by_window_server;
+ // A layer the window server shows is above every layer the frame holds, so it covers the layers below it
+ // whichever of the two composites it.
let is_inside_composited_effects = stack.layer_is_inside_composited_effects(layer_index);
- let covers_layers_below = frame_holds_layer
- && !is_inside_composited_effects
+ let covers_layers_below = !is_inside_composited_effects
&& compositing.rounded_composite_clips.is_empty()
&& matches!(compositing.space_to_frame, SpaceToFrame::Offset(_))
&& !is_hidden_from_view(&compositing.identity);
@@ -770,10 +805,10 @@ fn clear_color_of_layer(stack: &LayerStack, layer_index: LayerIndex, surface_cle
}
}
-/// Where a frame that composites its layers as the frame before did, except through other transforms of spaces whose
-/// anchors the compositor animates, needs painting: where those layers were in the frame before, as the tiles that frame
-/// held of them and their reach tell, and where they are now. None for a frame that composites anything else
-/// differently.
+/// Where a frame that composites the layers it holds as the frame before did, except through other transforms of
+/// spaces whose anchors the compositor animates, needs painting: where those layers were in the frame before, as the
+/// tiles that frame held of them and their reach tell, and where they are now. None for a frame that composites
+/// anything else it holds differently.
fn damage_of_layers_moved_by_animated_transforms(
compositing_of_latest_frame: &[LayerCompositingInFrame],
bounds_of_tiles_held_by: impl Fn(&LayerIdentity) -> IntRect,
@@ -791,6 +826,14 @@ fn damage_of_layers_moved_by_animated_transforms(
if latest == current {
continue;
}
+ // The window server moves and clips a layer it shows tile by tile, which changes nothing of what the frame
+ // holds.
+ let window_server_shows_layer_in_both_frames = latest.identity == current.identity
+ && latest.shown_by_window_server
+ && layer_update.layers.window_server_shows_tiles_of(current);
+ if window_server_shows_layer_in_both_frames {
+ continue;
+ }
let moved_by_animated_transform = matches!(
(latest.space_to_frame, current.space_to_frame),
(SpaceToFrame::Transform(_), SpaceToFrame::Transform(_))
@@ -882,6 +925,13 @@ fn composited_effects_of_frame(
effects
}
+/// Which layers above the base layer a pass over the layers of a frame composites.
+#[derive(Clone, Copy, PartialEq, Eq)]
+enum LayersToComposite {
+ HeldByFrame,
+ ShownByWindowServer,
+}
+
fn compositing_of_layer(
stack: &LayerStack,
layer_index: LayerIndex,
@@ -1011,6 +1061,7 @@ impl ContextPresenting {
.get_or_init(|| WorldTransforms::new(tree, scroll_offsets, Some(FloatMatrix4x4::identity())))
};
let window_server_may_show_media = self.why_window_server_shows_no_media_of_this_context(env).is_none();
+ let window_server_compositing = self.window_server_compositing(env);
let window_server_placements_of_media = if window_server_may_show_media {
stack.window_server_placements_of_media(storage, tree, world_of_frame, viewport_rect)
} else {
@@ -1018,17 +1069,36 @@ impl ContextPresenting {
};
let composite_offsets = stack.composite_offsets(scroll_offsets);
let spaces_to_frame = stack.spaces_to_frame(&composite_offsets, |anchor| world_of_frame().draw_matrix(anchor));
+ let window_server_placements_of_effects = if window_server_compositing.shows_tiles_of_painted_layers {
+ stack.window_server_placements_of_composited_effects(
+ storage,
+ tree,
+ world_of_frame,
+ window_server_compositing,
+ )
+ } else {
+ WindowServerPlacementsOfEffects::default()
+ };
let shown_by_window_server_by_layer = if window_server_may_show_media {
- stack.layers_the_window_server_shows(&composite_offsets, |layer_index| {
- self.why_window_server_does_not_show_media_layer(
- env,
- &window_server_placements_of_media,
- layer_index,
- &stack.layers[layer_index.0],
- live_content,
- )
- .is_none()
- })
+ stack.layers_the_window_server_shows(
+ &composite_offsets,
+ &WhatWindowServerShowsOfFrame {
+ compositing: window_server_compositing,
+ can_show_media_of_layer: &|layer_index| {
+ self.why_window_server_does_not_show_media_layer(
+ env,
+ &window_server_placements_of_media,
+ layer_index,
+ &stack.layers[layer_index.0],
+ live_content,
+ )
+ .is_none()
+ },
+ can_composite_effect_of_node: &|node_index| {
+ matches!(window_server_placements_of_effects.of_node(node_index), Some(Ok(_)))
+ },
+ },
+ )
} else {
vec![false; stack.layers.len()]
};
@@ -1229,6 +1299,11 @@ impl ContextPresenting {
.iter()
.filter(|tile| matches!(tile.coverage, TileCoverage::OneColor(_)))
.count() as u64;
+ // The window server shows the tiles of the layer as they are, so the frame holds nothing that goes stale
+ // with them.
+ if compositing.shown_by_window_server && window_server_compositing.shows_tiles_of_painted_layers {
+ continue;
+ }
stale_rect = stale_rect.united(self.layers.tiles.stale_rect_of_layer(
&shown_tiles_by_layer[layer_index.0],
compositing,
@@ -1241,6 +1316,8 @@ impl ContextPresenting {
stack: stack_the_frame_draws_with,
compositing_of_layers,
window_server_placements_of_media,
+ window_server_placements_of_effects,
+ window_server_compositing,
content_hash_by_composited_node: composited_effects.content_hash_by_composited_node,
media_replayed_by_identity,
},
@@ -1295,6 +1372,20 @@ impl ContextPresenting {
let content = match &layer.content {
LayerContent::Painted => ModelLayerContent::Painted {
tiles: self.layers.tiles.model_tiles_of(&compositing.identity),
+ presentation: if window_server_shows_layers && compositing.shown_by_window_server {
+ PaintedLayerPresentation::ShownByWindowServer
+ } else {
+ let why = match why_context_shows_no_media {
+ Some(why_context_shows_no_media) => why_context_shows_no_media.to_string(),
+ None if some_tiles_were_painted_straight => {
+ WhyMediaIsReplayed::TilesWerePaintedStraightIntoTheFrame.to_string()
+ }
+ None => self
+ .why_frame_holds_layer(env, &layer_update.layers, layer_index, live_content)
+ .to_string(),
+ };
+ PaintedLayerPresentation::HeldByFrame { why }
+ },
},
LayerContent::Media { .. } => ModelLayerContent::Media {
reach: layer.reach,
@@ -1370,6 +1461,38 @@ impl ContextPresenting {
}
}
+ fn why_frame_holds_layer(
+ &self,
+ env: &PresentingEnvironment<'_>,
+ painted_layers: &PaintedLayers,
+ layer_index: LayerIndex,
+ live_content: &LiveContent,
+ ) -> WhyFrameHoldsLayer {
+ let stack = &painted_layers.stack;
+ stack.why_frame_holds_layer(
+ layer_index,
+ &WhatWindowServerShowsOfFrame {
+ compositing: painted_layers.window_server_compositing,
+ can_show_media_of_layer: &|media_layer_index| {
+ self.why_window_server_does_not_show_media_layer(
+ env,
+ &painted_layers.window_server_placements_of_media,
+ media_layer_index,
+ &stack.layers[media_layer_index.0],
+ live_content,
+ )
+ .is_none()
+ },
+ can_composite_effect_of_node: &|node_index| {
+ matches!(
+ painted_layers.window_server_placements_of_effects.of_node(node_index),
+ Some(Ok(_))
+ )
+ },
+ },
+ )
+ }
+
/// Takes in which layers left the stack with the frame painted, or that shows nothing new, whose tiles stay in the
/// pool for a while, and answers what the frame did with its layers.
pub(super) fn commit_layer_update(
@@ -1396,9 +1519,10 @@ impl ContextPresenting {
painted_layers
}
- /// Paints the frame from its layers over `damage_rect`, and answers the rect it painted, which grows to the whole
- /// raster where the frame has to hold what the window server was to show above it. Unless `paints_ui_overlays`
- /// is set, the frame leaves out the overlays of the browser and of the layers.
+ /// Paints what the frame holds of its layers over `damage_rect`, and presents the layers the window server shows to
+ /// it. Answers the rect it painted, which grows to the whole raster where the frame has to hold what the window
+ /// server was to show by itself, and the sublayers the window server shows of the frame, bottom to top. Unless
+ /// `paints_ui_overlays` is set, the frame leaves out the overlays of the browser and of the layers.
#[allow(clippy::too_many_arguments)]
pub(super) fn paint_layered_frame(
&mut self,
@@ -1409,7 +1533,7 @@ impl ContextPresenting {
layer_update: &mut LayerUpdate,
live_content: &LiveContent,
paints_ui_overlays: bool,
- ) -> IntRect {
+ ) -> (IntRect, Vec<FfiSublayer>) {
env.raster.start_raster_cache_frame(env.context_id);
// A store can miss the damage of several frames, which joined can reach part of what a composited effect reads.
damage_rect = layer_update.damage_grown_over_what_composited_effects_read(damage_rect);
@@ -1428,15 +1552,20 @@ impl ContextPresenting {
live_content,
);
+ let mut sublayers = Vec::new();
if layer_update.shown_by_window_server() {
- let presented_to_window_server = rects_painted_straight.is_empty()
- && self.present_painted_layers_to_window_server(env, &layer_update.layers, surface)
- && self.present_compositor_overlays_to_window_server(env, frame, surface);
- if !presented_to_window_server {
- for compositing in &mut layer_update.layers.compositing_of_layers {
- compositing.shown_by_window_server = false;
+ let presented_sublayers = rects_painted_straight
+ .is_empty()
+ .then(|| {
+ self.present_layers_to_window_server(env, frame, &layer_update.layers, surface, live_content, false)
+ })
+ .flatten();
+ match presented_sublayers {
+ Some(presented_sublayers) => sublayers = presented_sublayers,
+ None => {
+ layer_update.hold_every_layer_in_frame();
+ damage_rect = self.raster_rect();
}
- damage_rect = self.raster_rect();
}
}
if layer_update.shown_by_window_server() != expected_shown_by_window_server {
@@ -1459,8 +1588,46 @@ impl ContextPresenting {
&rects_painted_straight,
paints_ui_overlays,
);
+ if !layer_update.shown_by_window_server() {
+ self.layers.window_server.did_paint_compositor_overlays_into_store();
+ }
+ self.layer_overlay.did_paint_frame();
+ (damage_rect, sublayers)
+ }
+
+ /// Presents to the window server the layers it shows of a frame that changes nothing of what the frame holds, or
+ /// that holds nothing, once it has rastered the tiles those layers show, and answers the sublayers the window
+ /// server then shows of the frame, bottom to top. None where the window server cannot be given the layers, which
+ /// the frame then has to hold.
+ pub(super) fn present_layers_of_frame_painted_into_no_store(
+ &mut self,
+ env: &PresentingEnvironment<'_>,
+ frame: &FrameToPaint<'_>,
+ layer_update: &mut LayerUpdate,
+ live_content: &LiveContent,
+ overlays_draw_same_as_in_latest_frame: bool,
+ ) -> Option<Vec<FfiSublayer>> {
+ let surface_tiles_are_made_like = self
+ .layers
+ .window_server
+ .surface_tiles_are_made_like_without_store(env)?;
+ env.raster.start_raster_cache_frame(env.context_id);
+ let rects_painted_straight =
+ self.raster_tiles_of_layers(env, &surface_tiles_are_made_like, frame, layer_update);
+ if !rects_painted_straight.is_empty() {
+ return None;
+ }
+ self.update_layer_overlay_with_frame(env, frame, layer_update, true, false, live_content);
+ let sublayers = self.present_layers_to_window_server(
+ env,
+ frame,
+ &layer_update.layers,
+ &surface_tiles_are_made_like,
+ live_content,
+ overlays_draw_same_as_in_latest_frame,
+ )?;
self.layer_overlay.did_paint_frame();
- damage_rect
+ Some(sublayers)
}
/// Rasters the tiles that each painted layer of the frame shows and that lack current pixels, and answers the
@@ -1546,6 +1713,11 @@ impl ContextPresenting {
),
clear_color: clear_color_of_layer(stack, layer_index, surface_clear_color),
rastered_within: (raster_space_index == RasterSpaceIndex::VIEWPORT).then_some(viewport_rect),
+ shown_by_window_server: layer_update.layers.window_server_shows_tiles_of(compositing),
+ window_server_shows_tiles: layer_update
+ .layers
+ .window_server_compositing
+ .shows_tiles_of_painted_layers,
},
&holder_count_by_content_hash,
replay_tiles,
@@ -1580,7 +1752,12 @@ impl ContextPresenting {
let raster = env.raster;
let save_count = raster.save(surface);
raster.clip_rect(surface, damage_rect);
- if let Some(base_layer_compositing) = layer_update.layers.compositing_of_layers.first() {
+ if let Some(base_layer_compositing) = layer_update
+ .layers
+ .compositing_of_layers
+ .first()
+ .filter(|base_layer_compositing| !base_layer_compositing.shown_by_window_server)
+ {
if self.layer_overlay.hides_layer(&base_layer_compositing.identity) {
raster.clear(surface, frame.surface_clear_color());
} else if self.layers.tiles.has_layer(&base_layer_compositing.identity) {
@@ -1601,7 +1778,7 @@ impl ContextPresenting {
damage_rect,
&layer_update.layers,
&layer_update.composited_filter_read_reach_by_layer,
- false,
+ LayersToComposite::HeldByFrame,
);
if !layer_update.shown_by_window_server() {
let selection_painting_straight = ReplaySelection {
@@ -1626,8 +1803,8 @@ impl ContextPresenting {
raster.restore_to_count(surface, save_count);
}
- /// Composites the layers above the base layer that the window server showed with the latest frame into the
- /// surface, which holds the rest of the frame, as for a snapshot of the frame on screen.
+ /// Composites the layers that the window server showed by itself with the latest frame into the surface, which
+ /// holds the rest of the frame, as for a snapshot of the frame on screen.
pub(super) fn composite_layers_shown_by_window_server(
&self,
env: &PresentingEnvironment<'_>,
@@ -1636,7 +1813,27 @@ impl ContextPresenting {
damage_rect: IntRect,
painted: &PaintedLayers,
) {
- self.composite_layers_above_base_of_stack(env, surface, frame, damage_rect, painted, &[], true);
+ if let Some(base_layer_compositing) = painted
+ .compositing_of_layers
+ .first()
+ .filter(|base_layer_compositing| base_layer_compositing.shown_by_window_server)
+ {
+ env.raster.clear(surface, frame.surface_clear_color());
+ if !self.layer_overlay.hides_layer(&base_layer_compositing.identity) {
+ self.layers
+ .tiles
+ .copy_into(env.raster, surface, damage_rect, base_layer_compositing);
+ }
+ }
+ self.composite_layers_above_base_of_stack(
+ env,
+ surface,
+ frame,
+ damage_rect,
+ painted,
+ &[],
+ LayersToComposite::ShownByWindowServer,
+ );
}
#[allow(clippy::too_many_arguments)]
@@ -1648,8 +1845,9 @@ impl ContextPresenting {
damage_rect: IntRect,
painted_layers: &PaintedLayers,
composited_filter_read_reach_by_layer: &[i32],
- composites_layers_the_window_server_shows: bool,
+ layers_to_composite: LayersToComposite,
) {
+ let composites_layers_the_window_server_shows = layers_to_composite == LayersToComposite::ShownByWindowServer;
let (stack, compositing_of_layers) = (&painted_layers.stack, &painted_layers.compositing_of_layers);
if compositing_of_layers
.iter()
@@ -1722,8 +1920,9 @@ impl ContextPresenting {
TileDraw::TileSurface {
surface,
rect_in_layer_space,
+ ..
} => compositing_session.draw_raster(
- surface.as_ffi().cast_mut().cast(),
+ surface.painting_surface().as_ffi().cast_mut().cast(),
rect_of_size(size_of(rect_in_layer_space)),
rect_in_layer_space.translated(layer_to_frame_offset.x, layer_to_frame_offset.y),
clips_of_layer,
@@ -2023,6 +2222,8 @@ mod tests {
stack,
compositing_of_layers,
window_server_placements_of_media: WindowServerPlacementsOfMedia::default(),
+ window_server_placements_of_effects: WindowServerPlacementsOfEffects::default(),
+ window_server_compositing: WindowServerCompositing::default(),
content_hash_by_composited_node: HashMap::new(),
media_replayed_by_identity: HashMap::new(),
},
diff --git a/Services/Compositor/Rust/src/presenting/mod.rs b/Services/Compositor/Rust/src/presenting/mod.rs
index 95c05759264..722a0b5891c 100644
--- a/Services/Compositor/Rust/src/presenting/mod.rs
+++ b/Services/Compositor/Rust/src/presenting/mod.rs
@@ -79,15 +79,17 @@ impl PresentingEnvironment<'_> {
}
}
-/// A frame drawn into a store, or for a frame that changes only what the window server shows above the frame on
-/// screen, into nothing.
+/// A frame drawn into a store, or for a frame that changes only what the window server shows by itself, into nothing.
pub struct PreparedFrame {
pub rendered_surface: Option<Rc<PaintingSurface>>,
pub bitmap_id: i32,
pub damage_rect: IntRect,
pub device_pixel_ratio: f64,
- /// What the window server shows above the frame, bottom to top, lent by the presenting state until the next frame.
+ /// What the window server shows of the frame by itself, bottom to top, lent by the presenting state until the next
+ /// frame.
pub sublayers: Vec<FfiSublayer>,
+ /// Whether the sublayers are all of the frame, so that the window server shows no store below them.
+ pub window_server_shows_every_layer: bool,
}
pub(crate) struct FrameToPaint<'a> {
@@ -205,6 +207,8 @@ pub struct ContextPresenting {
frame_without_store_in_flight: bool,
backing_stores: BackingStores,
sublayers_of_latest_frame: Vec<FfiSublayer>,
+ /// Whether the window server showed every layer of the frame presented last by itself, with no store below them.
+ latest_frame_was_presented_without_store_below_sublayers: bool,
size_of_latest_rendered_frame: IntSize,
store_damage: StoreDamage,
surplus_store_retirement_is_scheduled: bool,
@@ -244,6 +248,7 @@ impl ContextPresenting {
frame_without_store_in_flight: false,
backing_stores: BackingStores::default(),
sublayers_of_latest_frame: Vec::new(),
+ latest_frame_was_presented_without_store_below_sublayers: false,
size_of_latest_rendered_frame: IntSize::default(),
store_damage: StoreDamage::default(),
surplus_store_retirement_is_scheduled: false,
@@ -774,32 +779,88 @@ impl ContextPresenting {
};
let mut frame_damage = self.frame_damage_for(env, &pending_frame, &frame, &live_content);
let mut damage_rect = frame_damage.rect_in_raster_device_pixels;
+ let window_server_shows_every_layer = frame_damage.layers.window_server_shows_every_layer();
+ let frame_was_presented_within_same_viewport_rect = self.presented_frame == Some(pending_frame.viewport_rect);
// NB: A changed content rect must still reach the client even if the pixels are identical.
- if damage_rect.is_empty() && self.presented_frame == Some(pending_frame.viewport_rect) {
+ let frame_changes_nothing_it_holds = window_server_shows_every_layer
+ || (damage_rect.is_empty() && frame_was_presented_within_same_viewport_rect);
+ if frame_changes_nothing_it_holds {
let only_media_shown_by_window_server_changed =
frame_damage.layers.shown_by_window_server() && frame_damage.live_media_changed;
- self.remember_painted_frame(
- env,
- pending_frame.viewport_rect,
- display_list,
- frame_inputs,
- &live_content,
- frame_damage.layers,
- );
- let sublayers = self.sublayers_shown_by_window_server(&live_content);
- let media_shown_by_window_server_moved_resized_or_turned = sublayers != self.sublayers_of_latest_frame;
- if !only_media_shown_by_window_server_changed && !media_shown_by_window_server_moved_resized_or_turned {
- return None;
+ let sublayers_of_tiles_rastered_for_frame = if frame_damage.layers.window_server_shows_tiles() {
+ let overlays_draw_same_as_in_latest_frame = self.painted_frame.as_ref().is_some_and(|painted_frame| {
+ frame_inputs
+ .overlays
+ .draws_same_as(&painted_frame.frame_inputs.overlays)
+ });
+ Some(self.present_layers_of_frame_painted_into_no_store(
+ env,
+ &frame,
+ &mut frame_damage.layers,
+ &live_content,
+ overlays_draw_same_as_in_latest_frame,
+ ))
+ } else {
+ None
+ };
+ // A frame the window server cannot be given the layers of holds them all, and so is painted in full.
+ let window_server_was_given_layers = !matches!(sublayers_of_tiles_rastered_for_frame, Some(None));
+ if window_server_was_given_layers {
+ self.remember_painted_frame(
+ env,
+ pending_frame.viewport_rect,
+ display_list,
+ frame_inputs,
+ &live_content,
+ frame_damage.layers,
+ );
+ let sublayers = match sublayers_of_tiles_rastered_for_frame {
+ Some(Some(sublayers)) => sublayers,
+ _ => self.painted_frame.as_ref().map_or_else(Vec::new, |painted_frame| {
+ self.sublayers_shown_by_window_server(&painted_frame.layers, &live_content)
+ }),
+ };
+ let window_server_shows_other_sublayers = sublayers != self.sublayers_of_latest_frame;
+ // A frame made to repaint, as one shown in another remote layer than the frame before, is presented
+ // even where the window server already shows its sublayers.
+ let frame_is_made_to_repaint = !pending_frame.forced_damage_rect.is_empty();
+ let hides_store_shown_with_latest_frame =
+ window_server_shows_every_layer && !self.latest_frame_was_presented_without_store_below_sublayers;
+ if !only_media_shown_by_window_server_changed
+ && !window_server_shows_other_sublayers
+ && !frame_is_made_to_repaint
+ && !hides_store_shown_with_latest_frame
+ && frame_was_presented_within_same_viewport_rect
+ {
+ return None;
+ }
+ self.frame_without_store_in_flight = true;
+ self.sublayers_of_latest_frame = sublayers.clone();
+ if window_server_shows_every_layer {
+ // No store holds what the frame shows, so each is painted in full once a frame holds layers again,
+ // and a snapshot of the frame on screen is composited from the layers.
+ self.latest_frame_was_presented_without_store_below_sublayers = true;
+ self.store_damage.forget_every_store();
+ self.size_of_latest_rendered_frame = IntSize {
+ width: pending_frame.viewport_rect.width,
+ height: pending_frame.viewport_rect.height,
+ };
+ }
+ return Some(PreparedFrame {
+ rendered_surface: None,
+ bitmap_id: -1,
+ damage_rect: if window_server_shows_other_sublayers {
+ self.raster_rect()
+ } else {
+ IntRect::default()
+ },
+ device_pixel_ratio: self.device_pixel_ratio,
+ sublayers,
+ window_server_shows_every_layer,
+ });
}
- self.frame_without_store_in_flight = true;
- self.sublayers_of_latest_frame = sublayers.clone();
- return Some(PreparedFrame {
- rendered_surface: None,
- bitmap_id: -1,
- damage_rect: IntRect::default(),
- device_pixel_ratio: self.device_pixel_ratio,
- sublayers,
- });
+ frame_damage.layers.hold_every_layer_in_frame();
+ damage_rect = self.raster_rect();
}
let Some((bitmap_id, store)) = self.backing_stores.acquire_render_target() else {
self.queue_present_frame(pending_frame);
@@ -807,7 +868,7 @@ impl ContextPresenting {
};
let store_rect = rect_of_size(store.size());
let repaint_rect = self.store_damage.take(bitmap_id, damage_rect, store_rect);
- let painted_rect = self.paint_layered_frame(
+ let (painted_rect, sublayers) = self.paint_layered_frame(
env,
&store,
&frame,
@@ -832,14 +893,15 @@ impl ContextPresenting {
&live_content,
frame_damage.layers,
);
- let sublayers = self.sublayers_shown_by_window_server(&live_content);
self.sublayers_of_latest_frame = sublayers.clone();
+ self.latest_frame_was_presented_without_store_below_sublayers = false;
Some(PreparedFrame {
rendered_surface: Some(store),
bitmap_id,
damage_rect,
device_pixel_ratio: self.device_pixel_ratio,
sublayers,
+ window_server_shows_every_layer: false,
})
}
@@ -951,7 +1013,7 @@ impl ContextPresenting {
let live_content = this.live_content(env, frame.display_list);
let pending_frame = PendingFrame::repainting_everything(rect_of_size(target_size));
let mut frame_damage = this.frame_damage_for(env, &pending_frame, frame, &live_content);
- this.paint_layered_frame(
+ let _ = this.paint_layered_frame(
env,
target,
frame,
@@ -1012,18 +1074,12 @@ impl ContextPresenting {
&self,
env: &PresentingEnvironment<'_>,
) -> Option<Rc<PaintingSurface>> {
- let mut source = self.backing_stores.latest_rendered_surface()?;
- if let Some(painted_frame) = self
+ let painted_frame_shown_by_window_server = self
.painted_frame
.as_ref()
- .filter(|painted_frame| painted_frame.layers.shown_by_window_server())
- {
- let source_size = source.size();
- let composited = env.raster.create_surface(source_size, Some(&source), false);
- if let Some(composited) = composited {
- let source_rect = rect_of_size(source_size);
- env.raster
- .draw_surface(&composited, &source, source_rect, source_rect, SurfaceBlend::Source);
+ .filter(|painted_frame| painted_frame.layers.shown_by_window_server());
+ let composite_layers_shown_by_window_server =
+ |composited: &Rc<PaintingSurface>, painted_frame: &PaintedFrame| {
let frame = FrameToPaint {
display_list: &painted_frame.display_list,
frame_inputs: &painted_frame.frame_inputs,
@@ -1033,14 +1089,35 @@ impl ContextPresenting {
remote_layer: env.remote_layer.clone(),
..*env
};
+ let rect_of_surface = rect_of_size(composited.size());
self.composite_layers_shown_by_window_server(
&snapshot_env,
- &composited,
+ composited,
&frame,
- source_rect,
+ rect_of_surface,
&painted_frame.layers,
);
- self.paint_overlays(&snapshot_env, &composited, &painted_frame.frame_inputs, true);
+ self.paint_overlays(&snapshot_env, composited, &painted_frame.frame_inputs, true);
+ };
+ // No store holds a frame the window server shows every layer of, so the frame is composited from its layers.
+ if let Some(painted_frame) = painted_frame_shown_by_window_server
+ .filter(|painted_frame| painted_frame.layers.window_server_shows_every_layer())
+ {
+ let composited = env
+ .raster
+ .create_surface(self.size_of_latest_rendered_frame, None, false)?;
+ composite_layers_shown_by_window_server(&composited, painted_frame);
+ return Some(composited);
+ }
+ let mut source = self.backing_stores.latest_rendered_surface()?;
+ if let Some(painted_frame) = painted_frame_shown_by_window_server {
+ let source_size = source.size();
+ let composited = env.raster.create_surface(source_size, Some(&source), false);
+ if let Some(composited) = composited {
+ let source_rect = rect_of_size(source_size);
+ env.raster
+ .draw_surface(&composited, &source, source_rect, source_rect, SurfaceBlend::Source);
+ composite_layers_shown_by_window_server(&composited, painted_frame);
source = composited;
}
}
diff --git a/Services/Compositor/Rust/src/presenting/tiles.rs b/Services/Compositor/Rust/src/presenting/tiles.rs
index c90e927878c..01ea89cf619 100644
--- a/Services/Compositor/Rust/src/presenting/tiles.rs
+++ b/Services/Compositor/Rust/src/presenting/tiles.rs
@@ -14,6 +14,7 @@ use super::{PresentingEnvironment, inflated, rect_of_size, size_of};
use crate::host::ContextTimer;
use crate::raster_host::{RasterHost, SurfaceBlend};
use crate::surfaces::painting_surface::PaintingSurface;
+use crate::surfaces::presentable_surface::PresentableSurface;
use libcompositing_rust::display_list::layers::{BarrierCutsOfCell, LayerIdentity, SpaceToFrame};
use libcompositing_rust::display_list::tile_keys::{ContentHash, TileCoverage};
use libcompositing_rust::display_list::tiles::{CellRange, TileCoord, entries_within};
@@ -24,6 +25,9 @@ use std::rc::Rc;
const RASTER_SCRATCH_SURFACE_RELEASE_DELAY: Duration = Duration::from_milliseconds(3000);
const TIME_SPARE_TILE_STAYS_POOLED_FOR_CONTENT_THAT_COMES_BACK: Duration = Duration::from_milliseconds(3000);
+const TIME_SPARE_SURFACE_IS_KEPT_FOR_NEXT_TILE: Duration = Duration::from_milliseconds(3000);
+// About the tiles of two rows of a wide viewport, which a scroll lets go of and needs anew with each row it passes.
+const MAXIMUM_SPARE_SURFACE_COUNT: usize = 32;
pub(super) struct TileShownInFrame {
pub(super) coord: TileCoord,
@@ -45,18 +49,61 @@ struct PooledTile {
enum TilePixels {
Surface {
- surface: Rc<PaintingSurface>,
+ surface: Rc<PresentableSurface>,
every_pixel_is_opaque: bool,
},
OneColor(Color),
}
+/// The surfaces of tiles that left the pool, kept for a while for the tiles rastered next, as a surface the window
+/// server can show takes long to make. A tile takes one only once the window server no longer reads it.
+#[derive(Default)]
+struct SpareSurfaces {
+ least_recently_spared_first: Vec<(Rc<PresentableSurface>, IntSize, MonotonicTime)>,
+}
+
+impl SpareSurfaces {
+ fn keep(&mut self, surface: Rc<PresentableSurface>, size: IntSize, now: MonotonicTime) {
+ self.least_recently_spared_first.push((surface, size, now));
+ if self.least_recently_spared_first.len() > MAXIMUM_SPARE_SURFACE_COUNT {
+ self.least_recently_spared_first.remove(0);
+ }
+ }
+
+ fn keep_surface_of(&mut self, tile: PooledTile, now: MonotonicTime) {
+ if let TilePixels::Surface { surface, .. } = tile.pixels {
+ self.keep(surface, size_of(tile.held_part_of_cell), now);
+ }
+ }
+
+ fn take(
+ &mut self,
+ size: IntSize,
+ is_usable: impl Fn(&Rc<PresentableSurface>) -> bool,
+ ) -> Option<Rc<PresentableSurface>> {
+ let position = self
+ .least_recently_spared_first
+ .iter()
+ .position(|(surface, surface_size, _)| *surface_size == size && !surface.is_busy() && is_usable(surface))?;
+ Some(self.least_recently_spared_first.remove(position).0)
+ }
+
+ /// Drops the surfaces spared too long ago, and answers how long the least recently spared one left is still kept.
+ fn drop_surfaces_spared_too_long_ago(&mut self, now: MonotonicTime) -> Option<Duration> {
+ self.least_recently_spared_first
+ .retain(|(_, _, spared_at)| now - *spared_at < TIME_SPARE_SURFACE_IS_KEPT_FOR_NEXT_TILE);
+ self.least_recently_spared_first
+ .first()
+ .map(|(_, _, spared_at)| TIME_SPARE_SURFACE_IS_KEPT_FOR_NEXT_TILE - (now - *spared_at))
+ }
+}
+
impl PooledTile {
fn holds_current_pixels_over_ignoring_backend(&self, part_of_cell_needed: IntRect) -> bool {
self.holds_current_pixels && self.held_part_of_cell.contains_rect(part_of_cell_needed)
}
- fn surface(&self) -> Option<&Rc<PaintingSurface>> {
+ fn surface(&self) -> Option<&Rc<PresentableSurface>> {
match &self.pixels {
TilePixels::Surface { surface, .. } => Some(surface),
TilePixels::OneColor(_) => None,
@@ -98,7 +145,9 @@ fn pooled_held_tiles<'a>(
pub(super) enum TileDraw<'a> {
TileSurface {
- surface: &'a Rc<PaintingSurface>,
+ coord: TileCoord,
+ surface: &'a Rc<PresentableSurface>,
+ every_pixel_is_opaque: bool,
rect_in_layer_space: IntRect,
},
FillOfJoinedOneColorTiles {
@@ -116,6 +165,11 @@ pub(super) struct LayerToRaster<'a> {
pub(super) clear_color: Color,
/// What a raster of several tiles at once stays within, for a layer of the viewport's space: the viewport.
pub(super) rastered_within: Option<IntRect>,
+ /// Whether the window server shows the tiles of the layer, which their surfaces then have to let it.
+ pub(super) shown_by_window_server: bool,
+ /// Whether the window server that shows the context shows tiles, so that the surface of a new tile is one it can
+ /// show, whoever shows the layer in this frame.
+ pub(super) window_server_shows_tiles: bool,
}
pub(super) struct RasteredLayer {
@@ -133,6 +187,7 @@ pub(super) struct LayerTiles {
/// evicted.
changed_since_eviction: bool,
raster_scratch_surface: Option<Rc<PaintingSurface>>,
+ spare_surfaces: SpareSurfaces,
}
impl LayerTiles {
@@ -257,7 +312,7 @@ impl LayerTiles {
let mut one_color_fills = Vec::new();
// A transform can map the area to many more cells than the layer holds tiles at.
let area_in_layer_space = compositing.space_to_frame.rect_in_space(area_in_frame);
- for (_, content_hash) in entries_within(&held.by_cell, CellRange::touched_by(area_in_layer_space)) {
+ for (coord, content_hash) in entries_within(&held.by_cell, CellRange::touched_by(area_in_layer_space)) {
let Some(tile) = self.pool.get(content_hash) else {
continue;
};
@@ -269,8 +324,13 @@ impl LayerTiles {
}
let rect_in_layer_space = tile.held_part_of_cell;
match &tile.pixels {
- TilePixels::Surface { surface, .. } => draws.push(TileDraw::TileSurface {
+ TilePixels::Surface {
surface,
+ every_pixel_is_opaque,
+ } => draws.push(TileDraw::TileSurface {
+ coord: *coord,
+ surface,
+ every_pixel_is_opaque: *every_pixel_is_opaque,
rect_in_layer_space,
}),
TilePixels::OneColor(color) => one_color_fills.push((rect_in_layer_space, *color)),
@@ -308,10 +368,11 @@ impl LayerTiles {
TileDraw::TileSurface {
surface,
rect_in_layer_space,
+ ..
} => {
raster.draw_surface(
target,
- surface,
+ surface.painting_surface(),
rect_of_size(size_of(rect_in_layer_space)),
rect_in_layer_space.translated(composite_offset.x, composite_offset.y),
SurfaceBlend::Source,
@@ -359,7 +420,9 @@ impl LayerTiles {
}
}
- /// Evicts spare tiles as of `now`, and answers how long the least recently held spare tile left stays pooled.
+ /// Evicts spare tiles as of `now`, whose surfaces are kept for a while for the tiles rastered next, and answers how
+ /// long the least recently held spare tile left stays pooled, or the least recently spared surface left is kept,
+ /// whichever is shorter.
fn evict_spare_tiles_at(&mut self, now: MonotonicTime) -> Option<Duration> {
let held_content_hashes: HashSet<ContentHash> = self
.held_by_layer
@@ -374,11 +437,12 @@ impl LayerTiles {
};
let mut pixel_count_of_held_tiles = 0u64;
let mut spare_tiles: Vec<(MonotonicTime, ContentHash, u64)> = Vec::new();
- self.pool.retain(|content_hash, tile| {
+ let mut content_hashes_of_tiles_to_evict: Vec<ContentHash> = Vec::new();
+ for (content_hash, tile) in &mut self.pool {
if held_content_hashes.contains(content_hash) {
tile.held_at_latest_eviction = true;
pixel_count_of_held_tiles += surface_pixel_count_of(tile);
- return true;
+ continue;
}
// A frame that lets go of tiles evicts spare tiles as it is committed, so a tile let go since the latest
// eviction was held until now.
@@ -388,11 +452,11 @@ impl LayerTiles {
if !tile.holds_current_pixels
|| now - tile.last_held_at >= TIME_SPARE_TILE_STAYS_POOLED_FOR_CONTENT_THAT_COMES_BACK
{
- return false;
+ content_hashes_of_tiles_to_evict.push(*content_hash);
+ continue;
}
spare_tiles.push((tile.last_held_at, *content_hash, surface_pixel_count_of(tile)));
- true
- });
+ }
self.changed_since_eviction = false;
let spare_tiles_least_recently_held_first = {
spare_tiles.sort_unstable();
@@ -408,15 +472,28 @@ impl LayerTiles {
if pixel_count_of_spare_tiles <= spare_pixel_budget {
break;
}
- self.pool.remove(content_hash);
+ content_hashes_of_tiles_to_evict.push(*content_hash);
pixel_count_of_spare_tiles -= pixel_count;
evicted_count += 1;
}
- spare_tiles_least_recently_held_first
+ for content_hash in content_hashes_of_tiles_to_evict {
+ if let Some(evicted_tile) = self.pool.remove(&content_hash) {
+ self.spare_surfaces.keep_surface_of(evicted_tile, now);
+ }
+ }
+ let time_least_recently_held_spare_tile_stays_pooled = spare_tiles_least_recently_held_first
.get(evicted_count)
.map(|(least_recently_held_at, _, _)| {
TIME_SPARE_TILE_STAYS_POOLED_FOR_CONTENT_THAT_COMES_BACK - (now - *least_recently_held_at)
- })
+ });
+ let time_least_recently_spared_surface_is_kept = self.spare_surfaces.drop_surfaces_spared_too_long_ago(now);
+ [
+ time_least_recently_held_spare_tile_stays_pooled,
+ time_least_recently_spared_surface_is_kept,
+ ]
+ .into_iter()
+ .flatten()
+ .min()
}
pub(super) fn release_raster_scratch_surface(&mut self) {
@@ -442,6 +519,8 @@ impl LayerTiles {
kept_tile_rect,
clear_color,
rastered_within,
+ shown_by_window_server,
+ window_server_shows_tiles,
} = layer;
let raster = env.raster;
let records_rasters = record_raster.is_some();
@@ -453,6 +532,11 @@ impl LayerTiles {
let mut rects_painted_straight = Vec::new();
let held = self.held_by_layer.entry(identity).or_default();
let tile_pool = &mut self.pool;
+ let spare_surfaces = &mut self.spare_surfaces;
+ let surface_can_be_drawn_and_shown = |surface: &Rc<PresentableSurface>| {
+ surface.painting_surface().shares_backend_with(like)
+ && (!shown_by_window_server || surface.can_be_shown_by_window_server())
+ };
let held_tile_count_before = held.by_cell.len();
debug_assert!(shown.is_sorted_by_key(|tile| tile.coord));
@@ -474,7 +558,11 @@ impl LayerTiles {
held_content_hash == tile.content_hash,
))
});
- raster_cause_of(tile_held_at_cell, tile.part_of_cell_needed, like)
+ raster_cause_of(
+ tile_held_at_cell,
+ tile.part_of_cell_needed,
+ surface_can_be_drawn_and_shown,
+ )
});
if held_content_hash != Some(tile.content_hash) {
held.by_cell.insert(tile.coord, tile.content_hash);
@@ -482,7 +570,7 @@ impl LayerTiles {
}
let pooled_tile_holds_needed_part_drawable_into_frame = |pooled: &PooledTile| {
pooled.held_part_of_cell.contains_rect(tile.part_of_cell_needed)
- && pooled.surface().is_none_or(|surface| surface.shares_backend_with(like))
+ && pooled.surface().is_none_or(surface_can_be_drawn_and_shown)
};
if tile_pool.get(&tile.content_hash).is_some_and(|pooled| {
pooled_tile_holds_needed_part_drawable_into_frame(pooled) && pooled.holds_current_pixels
@@ -490,7 +578,7 @@ impl LayerTiles {
continue;
}
if let TileCoverage::OneColor(color) = tile.coverage {
- tile_pool.insert(
+ let replaced_tile = tile_pool.insert(
tile.content_hash,
PooledTile {
pixels: TilePixels::OneColor(color),
@@ -500,13 +588,19 @@ impl LayerTiles {
held_at_latest_eviction: false,
},
);
+ if let Some(replaced_tile) = replaced_tile {
+ spare_surfaces.keep_surface_of(replaced_tile, env.now);
+ }
held_tiles_changed = true;
continue;
}
let every_pixel_is_opaque = tile.coverage == TileCoverage::Opaque;
match tile_pool.get_mut(&tile.content_hash) {
+ // Nothing is painted into a surface the window server shows or still reads, as it would show the
+ // painting under way, and ahead of the frame the painting is for.
Some(pooled)
- if pooled.surface().is_some() && pooled_tile_holds_needed_part_drawable_into_frame(pooled) =>
+ if pooled.surface().is_some_and(|surface| !surface.is_busy())
+ && pooled_tile_holds_needed_part_drawable_into_frame(pooled) =>
{
if let TilePixels::Surface {
every_pixel_is_opaque: pooled_every_pixel_is_opaque,
@@ -530,9 +624,9 @@ impl LayerTiles {
<= 1
&& tile_pool.get(held_content_hash).is_some_and(|held_tile| {
held_tile.held_part_of_cell == tile.part_of_cell_needed
- && held_tile
- .surface()
- .is_some_and(|surface| surface.shares_backend_with(like))
+ && held_tile.surface().is_some_and(|surface| {
+ surface_can_be_drawn_and_shown(surface) && !surface.is_busy()
+ })
})
})
.and_then(|held_content_hash| tile_pool.remove(&held_content_hash))
@@ -540,8 +634,13 @@ impl LayerTiles {
TilePixels::Surface { surface, .. } => Some(surface),
TilePixels::OneColor(_) => None,
});
+ let surface_size = size_of(tile.part_of_cell_needed);
let surface = surface_held_by_this_layer_alone
- .or_else(|| create_surface_on_backend_of(raster, size_of(tile.part_of_cell_needed), like));
+ .or_else(|| spare_surfaces.take(surface_size, surface_can_be_drawn_and_shown))
+ .or_else(|| {
+ create_tile_surface_on_backend_of(raster, surface_size, like, window_server_shows_tiles)
+ .filter(surface_can_be_drawn_and_shown)
+ });
let Some(surface) = surface else {
held.by_cell.remove(&tile.coord);
held_tiles_changed = true;
@@ -553,7 +652,7 @@ impl LayerTiles {
);
continue;
};
- tile_pool.insert(
+ let replaced_tile = tile_pool.insert(
tile.content_hash,
PooledTile {
pixels: TilePixels::Surface {
@@ -566,6 +665,9 @@ impl LayerTiles {
held_at_latest_eviction: false,
},
);
+ if let Some(replaced_tile) = replaced_tile {
+ spare_surfaces.keep_surface_of(replaced_tile, env.now);
+ }
}
}
tiles_to_raster.push(TileToRaster {
@@ -590,7 +692,7 @@ impl LayerTiles {
.get(&tile.content_hash)
.expect("a tile to raster is in the pool");
let surface = pooled.surface().expect("a tile to raster has a surface");
- (surface.clone(), pooled.held_part_of_cell)
+ (surface.painting_surface().clone(), pooled.held_part_of_cell)
};
let bounds_held_by = |tile_pool: &TilePool, tiles: &[&TileShownInFrame]| {
tiles
@@ -751,10 +853,28 @@ fn create_surface_on_backend_of(
.filter(|surface| surface.shares_backend_with(like))
}
+/// A surface for a tile, which the window server can show as it is where it shows tiles and such a surface can be
+/// made.
+fn create_tile_surface_on_backend_of(
+ raster: &RasterHost,
+ size: IntSize,
+ like: &Rc<PaintingSurface>,
+ window_server_shows_tiles: bool,
+) -> Option<Rc<PresentableSurface>> {
+ let surface_window_server_can_show = window_server_shows_tiles
+ .then(|| raster.create_presentable_surface(size, like))
+ .flatten()
+ .filter(|surface| {
+ surface.can_be_shown_by_window_server() && surface.painting_surface().shares_backend_with(like)
+ });
+ surface_window_server_can_show
+ .or_else(|| create_surface_on_backend_of(raster, size, like).map(PresentableSurface::shown_by_no_window_server))
+}
+
fn raster_cause_of(
tile_held_at_cell: Option<(&PooledTile, bool)>,
part_of_cell_needed: IntRect,
- like: &Rc<PaintingSurface>,
+ surface_can_be_drawn_and_shown: impl Fn(&Rc<PresentableSurface>) -> bool,
) -> RasterCause {
let Some((held_tile, held_content_hash_is_needed)) = tile_held_at_cell else {
return RasterCause::NewlyShown;
@@ -764,7 +884,7 @@ fn raster_cause_of(
}
if held_tile
.surface()
- .is_some_and(|surface| !surface.shares_backend_with(like))
+ .is_some_and(|surface| !surface_can_be_drawn_and_shown(surface))
{
return RasterCause::HeldOnAnotherBackend;
}
diff --git a/Services/Compositor/Rust/src/presenting/window_server.rs b/Services/Compositor/Rust/src/presenting/window_server.rs
index 49faafdbfcf..b714775d675 100644
--- a/Services/Compositor/Rust/src/presenting/window_server.rs
+++ b/Services/Compositor/Rust/src/presenting/window_server.rs
@@ -4,29 +4,91 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-//! What the window server shows above a frame by itself: the media layers it can show, and the surfaces it shows
-//! painted layers and the overlays of the compositor from.
+//! What the window server shows of a frame by itself: the media layers it can show, the painted layers it shows tile by
+//! tile, each in the groups that place and clip it, and the surfaces it shows the overlays of the compositor from. A
+//! window server that does not show tiles shows a painted layer from one surface that the tiles are copied into.
use super::layers::{LayerCompositingInFrame, PaintedLayers};
+use super::tiles::TileDraw;
use super::{ContextPresenting, FrameToPaint, PresentingEnvironment, rect_of_size, size_of};
-use crate::raster_host::{FfiSublayer, FfiSublayerPlacement, LiveContent, MediaKind, SublayerContentKind};
+use crate::raster_host::{
+ FfiSublayer, FfiSublayerBackdrop, FfiSublayerGroup, FfiSublayerPlacement, LiveContent, MediaKind,
+ SublayerContentKind,
+};
use crate::surfaces::painting_surface::PaintingSurface;
use crate::surfaces::presentable_surface::{PresentableSurface, PresentableSurfacePool};
use libcompositing_rust::display_list::layers::{
- LayerContent, LayerIdentity, LayerIndex, StackLayer, WindowServerPlacementsOfMedia,
+ BandIndex, LayerContent, LayerIdentity, LayerIndex, SpaceToFrame, StackLayer, WindowServerCompositing,
+ WindowServerPlacementsOfMedia,
};
use libcompositing_rust::display_list::summary::LiveContent as LiveMedia;
use libcompositing_rust::display_list::window_server_placement::{
WhyWindowServerCannotShowMedia, WindowServerPlacement,
};
-use libgfx_rust::{Color, IntRect, ScalingMode};
+use libgfx_rust::{Color, CornerRadii, FloatRect, IntRect, IntSize, ScalingMode};
use std::collections::{HashMap, HashSet};
+use std::hash::{Hash, Hasher};
use std::rc::Rc;
const CANVAS_SUBLAYER_IDENTITY_TAG: u64 = 1 << 60;
const VIDEO_SUBLAYER_IDENTITY_TAG: u64 = 2 << 60;
const PAINTED_LAYER_SUBLAYER_IDENTITY_TAG: u64 = 3 << 60;
const COMPOSITOR_OVERLAY_SUBLAYER_IDENTITY: u64 = 4 << 60;
+const SUBLAYER_OF_TILED_LAYER_IDENTITY_TAG: u64 = 5 << 60;
+const SUBLAYER_IDENTITY_BITS_BELOW_TAG: u64 = (1 << 60) - 1;
+
+// The window server composites each sublayer on its own, so a frame with more of them than this is composited by the
+// compositor instead. Pages show a few hundred tiles at most.
+const MAXIMUM_SUBLAYERS_THE_WINDOW_SERVER_SHOWS_OF_FRAME: usize = 1024;
+
+/// What a sublayer is of a painted layer the window server shows tile by tile.
+#[derive(Hash)]
+enum PartOfTiledLayer {
+ GroupClippingToCompositeClip,
+ GroupClippingToRoundedCompositeClip { ordinal: usize },
+ GroupOfSpace,
+ Tile { column: i32, row: i32 },
+ FillOfJoinedOneColorTiles { ordinal: usize },
+}
+
+/// What a sublayer is of a band of a composited effect the window server composites.
+#[derive(Hash)]
+enum PartOfCompositedBand {
+ GroupClippingToClipAroundEffect { ordinal: usize },
+ GroupOfEffect,
+ GroupClippingToRoundedBackdropRegion,
+ Backdrop,
+}
+
+fn identity_of_sublayer_that_is(part: impl Hash, of_layer_or_composited_band: impl Hash) -> u64 {
+ let mut hasher = std::collections::hash_map::DefaultHasher::new();
+ of_layer_or_composited_band.hash(&mut hasher);
+ part.hash(&mut hasher);
+ SUBLAYER_OF_TILED_LAYER_IDENTITY_TAG | (hasher.finish() & SUBLAYER_IDENTITY_BITS_BELOW_TAG)
+}
+
+fn group(identity: u64, group_index: i32, group: FfiSublayerGroup) -> FfiSublayer {
+ FfiSublayer {
+ group_index,
+ group,
+ ..FfiSublayer::of_kind(identity, SublayerContentKind::Group)
+ }
+}
+
+/// A group that clips its sublayers to a rect of the pixels it shares with the group it is in.
+fn group_clipping_to(identity: u64, group_index: i32, clip_rect: FloatRect, corner_radii: CornerRadii) -> FfiSublayer {
+ group(
+ identity,
+ group_index,
+ FfiSublayerGroup {
+ clips: true,
+ clip_rect,
+ corner_radii,
+ ..FfiSublayerGroup::default()
+ },
+ )
+}
+
// The checks of a plan keep the ordinal of a media layer below the most media layers a plan makes, so it stays clear of
// the tag.
const MEDIA_ORDINAL_SHIFT_PAST_CANVAS_AND_VIDEO_IDS: u32 = 44;
@@ -89,7 +151,12 @@ pub(super) struct WindowServerLayers {
presentation_by_layer: HashMap<LayerIdentity, PaintedLayerPresentation>,
compositor_overlays_surface_pool: PresentableSurfacePool,
latest_compositor_overlays_surface_and_rect: Option<(Rc<PresentableSurface>, IntRect)>,
+ /// Whether the surface holds the overlays of the frame painted last, rather than those of a frame before it whose
+ /// overlays went into the frame's store since.
+ compositor_overlays_surface_holds_overlays_of_latest_frame: bool,
next_sublayer_ordinal: u32,
+ /// A surface on the GPU the compositor renders with, which tiles are made like for a frame painted into no store.
+ surface_tiles_are_made_like_without_store: Option<Rc<PaintingSurface>>,
}
impl WindowServerLayers {
@@ -97,6 +164,24 @@ impl WindowServerLayers {
self.presentation_by_layer
.retain(|identity, _| identities_in_stack.contains(identity));
}
+
+ /// Tells that the overlays of a frame were painted into the frame's store, so that the surface the window server
+ /// shows overlays from holds those of an earlier frame.
+ pub(super) fn did_paint_compositor_overlays_into_store(&mut self) {
+ self.compositor_overlays_surface_holds_overlays_of_latest_frame = false;
+ }
+
+ /// A surface that tiles are made like for a frame painted into no store, or none where it cannot be made.
+ pub(super) fn surface_tiles_are_made_like_without_store(
+ &mut self,
+ env: &PresentingEnvironment<'_>,
+ ) -> Option<Rc<PaintingSurface>> {
+ if self.surface_tiles_are_made_like_without_store.is_none() {
+ self.surface_tiles_are_made_like_without_store =
+ env.raster.create_surface(IntSize { width: 1, height: 1 }, None, false);
+ }
+ self.surface_tiles_are_made_like_without_store.clone()
+ }
}
fn sublayer_placement_of(placement: &WindowServerPlacement) -> FfiSublayerPlacement {
@@ -122,9 +207,6 @@ fn unclipped_untransformed_surface_sublayer(
rect_in_frame: IntRect,
) -> FfiSublayer {
FfiSublayer {
- identity,
- content_kind: SublayerContentKind::PresentableSurface,
- media_id: 0,
presentable_surface: surface.as_ffi(),
placement: FfiSublayerPlacement {
content_rect: rect_in_frame,
@@ -133,6 +215,7 @@ fn unclipped_untransformed_surface_sublayer(
scaling_mode: ScalingMode::NearestNeighbor,
..Default::default()
},
+ ..FfiSublayer::of_kind(identity, SublayerContentKind::PresentableSurface)
}
}
@@ -153,6 +236,24 @@ impl ContextPresenting {
None
}
+ /// What the window server composites by itself of the layers of this context's frames, besides canvases and
+ /// videos. It shows no tiles of a frame it scales to fit a view, as it would filter each tile apart from the tiles
+ /// beside it.
+ pub(super) fn window_server_compositing(&self, env: &PresentingEnvironment<'_>) -> WindowServerCompositing {
+ let compositing_of_window_server = env
+ .window_server_showing_context()
+ .map(|window_server| env.raster.window_server_compositing(window_server))
+ .unwrap_or_default();
+ let shows_tiles_of_painted_layers = self.why_window_server_shows_no_media_of_this_context(env).is_none()
+ && !self.scales_frames_to_fit
+ && compositing_of_window_server.shows_tiles_of_painted_layers;
+ WindowServerCompositing {
+ shows_tiles_of_painted_layers,
+ filters_what_is_below_layers: shows_tiles_of_painted_layers
+ && compositing_of_window_server.filters_what_is_below_layers,
+ }
+ }
+
pub(super) fn why_window_server_does_not_show_media_layer(
&self,
env: &PresentingEnvironment<'_>,
@@ -287,19 +388,42 @@ impl ContextPresenting {
true
}
+ /// Paints the overlays of the frame into a surface the window server shows them from, unless the surface holds
+ /// them already: it holds those of the frame painted last, which `overlays_draw_same_as_in_latest_frame` says draw
+ /// the same. Answers false where no surface could be had.
pub(super) fn present_compositor_overlays_to_window_server(
&mut self,
env: &PresentingEnvironment<'_>,
frame: &FrameToPaint<'_>,
like: &Rc<PaintingSurface>,
+ overlays_draw_same_as_in_latest_frame: bool,
) -> bool {
let raster = env.raster;
let mut overlays_rect = frame.frame_inputs.overlays.bounds;
- if self.layer_overlay.latest_frame().is_some() {
+ let draws_overlay_of_layers = self.layer_overlay.latest_frame().is_some();
+ if draws_overlay_of_layers {
overlays_rect = overlays_rect.united(self.raster_rect());
}
if overlays_rect.is_empty() {
self.layers.window_server.latest_compositor_overlays_surface_and_rect = None;
+ self.layers
+ .window_server
+ .compositor_overlays_surface_holds_overlays_of_latest_frame = true;
+ return true;
+ }
+ let surface_holds_overlays_of_frame = overlays_draw_same_as_in_latest_frame
+ && !draws_overlay_of_layers
+ && self
+ .layers
+ .window_server
+ .compositor_overlays_surface_holds_overlays_of_latest_frame
+ && self
+ .layers
+ .window_server
+ .latest_compositor_overlays_surface_and_rect
+ .as_ref()
+ .is_some_and(|(_, rect)| *rect == overlays_rect);
+ if surface_holds_overlays_of_frame {
return true;
}
let overlays_size = size_of(overlays_rect);
@@ -320,29 +444,243 @@ impl ContextPresenting {
self.paint_overlays(env, target, frame.frame_inputs, true);
raster.restore_to_count(target, save_count);
self.layers.window_server.latest_compositor_overlays_surface_and_rect = Some((presentable, overlays_rect));
+ // An overlay of the layers shows what the frame did, which the next frame does not repeat.
+ self.layers
+ .window_server
+ .compositor_overlays_surface_holds_overlays_of_latest_frame = !draws_overlay_of_layers;
true
}
- pub(super) fn sublayers_shown_by_window_server(&self, live_content: &LiveContent) -> Vec<FfiSublayer> {
+ /// Presents to the window server what it shows of the frame besides canvases and videos, once the tiles of the
+ /// frame are rastered, and answers the sublayers it then shows, bottom to top. None where a surface could not be
+ /// had, or where the frame has more sublayers than the window server shows of one.
+ pub(super) fn present_layers_to_window_server(
+ &mut self,
+ env: &PresentingEnvironment<'_>,
+ frame: &FrameToPaint<'_>,
+ painted_layers: &PaintedLayers,
+ like: &Rc<PaintingSurface>,
+ live_content: &LiveContent,
+ overlays_draw_same_as_in_latest_frame: bool,
+ ) -> Option<Vec<FfiSublayer>> {
+ if !painted_layers.window_server_compositing.shows_tiles_of_painted_layers
+ && !self.present_painted_layers_to_window_server(env, painted_layers, like)
+ {
+ return None;
+ }
+ if !self.present_compositor_overlays_to_window_server(env, frame, like, overlays_draw_same_as_in_latest_frame) {
+ return None;
+ }
+ let sublayers = self.sublayers_shown_by_window_server(painted_layers, live_content);
+ (sublayers.len() <= MAXIMUM_SUBLAYERS_THE_WINDOW_SERVER_SHOWS_OF_FRAME).then_some(sublayers)
+ }
+
+ /// Appends the sublayers of a painted layer the window server shows tile by tile, in the group of `group_index`,
+ /// whose pixels are the frame's: a group per clip the layer is composited within, each in the one before, and in
+ /// the innermost, the group of the layer's space, which holds the tiles of the layer that reach into the viewport,
+ /// and a fill per run of tiles of one color.
+ fn append_sublayers_of_tiled_layer(
+ &self,
+ sublayers: &mut Vec<FfiSublayer>,
+ compositing: &LayerCompositingInFrame,
+ viewport_rect: IntRect,
+ group_index: i32,
+ ) {
+ let draws = self.layers.tiles.draws_reaching_into(compositing, viewport_rect);
+ if draws.is_empty() {
+ return;
+ }
+ let identity_of = |part: PartOfTiledLayer| identity_of_sublayer_that_is(part, compositing.identity);
+ let mut innermost_group_index = group_index;
+ if let Some(composite_clip) = compositing.composite_clip {
+ sublayers.push(group_clipping_to(
+ identity_of(PartOfTiledLayer::GroupClippingToCompositeClip),
+ innermost_group_index,
+ composite_clip.to_float(),
+ CornerRadii::default(),
+ ));
+ innermost_group_index = sublayers.len() as i32 - 1;
+ }
+ for (ordinal, (rounded_clip_rect, corner_radii)) in compositing.rounded_composite_clips.iter().enumerate() {
+ sublayers.push(group_clipping_to(
+ identity_of(PartOfTiledLayer::GroupClippingToRoundedCompositeClip { ordinal }),
+ innermost_group_index,
+ rounded_clip_rect.to_float(),
+ *corner_radii,
+ ));
+ innermost_group_index = sublayers.len() as i32 - 1;
+ }
+ sublayers.push(group(
+ identity_of(PartOfTiledLayer::GroupOfSpace),
+ innermost_group_index,
+ FfiSublayerGroup {
+ to_parent: match compositing.space_to_frame {
+ SpaceToFrame::Offset(offset) => [1.0, 0.0, 0.0, 1.0, offset.x as f32, offset.y as f32],
+ SpaceToFrame::Transform(transform) => transform.values,
+ },
+ ..FfiSublayerGroup::default()
+ },
+ ));
+ let index_of_group_of_space = sublayers.len() as i32 - 1;
+ let mut ordinal_of_fill = 0;
+ for draw in draws {
+ match draw {
+ TileDraw::TileSurface {
+ coord,
+ surface,
+ every_pixel_is_opaque,
+ rect_in_layer_space,
+ } => sublayers.push(FfiSublayer {
+ group_index: index_of_group_of_space,
+ presentable_surface: surface.as_ffi(),
+ rect: rect_in_layer_space,
+ every_pixel_is_opaque,
+ ..FfiSublayer::of_kind(
+ identity_of(PartOfTiledLayer::Tile {
+ column: coord.column,
+ row: coord.row,
+ }),
+ SublayerContentKind::Tile,
+ )
+ }),
+ TileDraw::FillOfJoinedOneColorTiles {
+ rect_in_layer_space,
+ color,
+ } => {
+ if color.alpha() == 0 {
+ continue;
+ }
+ sublayers.push(FfiSublayer {
+ group_index: index_of_group_of_space,
+ rect: rect_in_layer_space,
+ color,
+ ..FfiSublayer::of_kind(
+ identity_of(PartOfTiledLayer::FillOfJoinedOneColorTiles {
+ ordinal: ordinal_of_fill,
+ }),
+ SublayerContentKind::Color,
+ )
+ });
+ ordinal_of_fill += 1;
+ }
+ }
+ }
+ }
+
+ /// Appends the groups of a band of a composited effect the window server composites, in the group of
+ /// `group_index`, whose pixels are the frame's: a group per clip the effect is entered within, each in the one
+ /// before, and in the innermost, the group of the effect, which composites the layers of the band at the effect's
+ /// opacity. Answers the index of the group of the effect, whose pixels are the frame's too.
+ fn append_groups_of_composited_band(
+ sublayers: &mut Vec<FfiSublayer>,
+ painted: &PaintedLayers,
+ band_index: BandIndex,
+ group_index: i32,
+ ) -> i32 {
+ let band = &painted.stack.bands[band_index.0];
+ let node_index = band.placement_node_index;
+ // The frame holds the layers inside an effect the window server cannot composite.
+ let Some(Ok(placement)) = painted.window_server_placements_of_effects.of_node(node_index) else {
+ return group_index;
+ };
+ let composited_band = (painted.stack.nodes[node_index.0].identity, band.band_ordinal_in_node);
+ let identity_of = |part: PartOfCompositedBand| identity_of_sublayer_that_is(part, composited_band);
+ let mut innermost_group_index = group_index;
+ for (ordinal, (clip_rect, corner_radii)) in placement.clips.iter().enumerate() {
+ sublayers.push(group_clipping_to(
+ identity_of(PartOfCompositedBand::GroupClippingToClipAroundEffect { ordinal }),
+ innermost_group_index,
+ *clip_rect,
+ *corner_radii,
+ ));
+ innermost_group_index = sublayers.len() as i32 - 1;
+ }
+ sublayers.push(group(
+ identity_of(PartOfCompositedBand::GroupOfEffect),
+ innermost_group_index,
+ FfiSublayerGroup {
+ opacity: placement.opacity.clamp(0.0, 1.0),
+ ..FfiSublayerGroup::default()
+ },
+ ));
+ let index_of_group_of_effect = sublayers.len() as i32 - 1;
+ // The filtered backdrop is below all the effect holds.
+ if let Some(backdrop) = &placement.backdrop {
+ let mut index_of_group_of_backdrop = index_of_group_of_effect;
+ if backdrop.corner_radii.has_any_radius() {
+ sublayers.push(group_clipping_to(
+ identity_of(PartOfCompositedBand::GroupClippingToRoundedBackdropRegion),
+ index_of_group_of_effect,
+ backdrop.region,
+ backdrop.corner_radii,
+ ));
+ index_of_group_of_backdrop = sublayers.len() as i32 - 1;
+ }
+ let filters = &backdrop.filters;
+ sublayers.push(FfiSublayer {
+ group_index: index_of_group_of_backdrop,
+ backdrop: FfiSublayerBackdrop {
+ region: backdrop.region,
+ has_color_matrix_before_blur: filters.color_matrix_before_blur.is_some(),
+ color_matrix_before_blur: filters.color_matrix_before_blur.unwrap_or_default(),
+ has_blur: filters.blur_standard_deviation.is_some(),
+ blur_standard_deviation: filters.blur_standard_deviation.unwrap_or_default(),
+ has_color_matrix_after_blur: filters.color_matrix_after_blur.is_some(),
+ color_matrix_after_blur: filters.color_matrix_after_blur.unwrap_or_default(),
+ },
+ ..FfiSublayer::of_kind(
+ identity_of(PartOfCompositedBand::Backdrop),
+ SublayerContentKind::Backdrop,
+ )
+ });
+ }
+ index_of_group_of_effect
+ }
+
+ /// The sublayers the window server shows of a frame that did `painted` with its layers, bottom to top, each group
+ /// before the sublayers in it.
+ pub(super) fn sublayers_shown_by_window_server(
+ &self,
+ painted: &PaintedLayers,
+ live_content: &LiveContent,
+ ) -> Vec<FfiSublayer> {
let layers = &self.layers.window_server;
let mut sublayers = Vec::new();
- let Some(painted) = self
- .painted_frame
- .as_ref()
- .map(|painted_frame| &painted_frame.layers)
- .filter(|painted| painted.shown_by_window_server())
- else {
+ if !painted.shown_by_window_server() {
return sublayers;
- };
+ }
+ let viewport_rect = self.raster_rect();
+ let mut entered_composited_bands_and_their_groups: Vec<(BandIndex, i32)> = Vec::new();
+ let mut composited_bands_around_layer: Vec<BandIndex> = Vec::new();
for compositing in painted
.compositing_of_layers
.iter()
- .skip(1)
.filter(|compositing| compositing.shown_by_window_server)
.filter(|compositing| !self.layer_overlay.hides_layer(&compositing.identity))
{
let layer_index = compositing.layer_index;
let layer = compositing.layer_in(&painted.stack);
+ composited_bands_around_layer.clear();
+ composited_bands_around_layer
+ .extend(painted.stack.composited_bands_around_layer_innermost_first(layer_index));
+ composited_bands_around_layer.reverse();
+ let count_of_bands_still_entered = entered_composited_bands_and_their_groups
+ .iter()
+ .zip(&composited_bands_around_layer)
+ .take_while(|((entered_band, _), band_around_layer)| entered_band == *band_around_layer)
+ .count();
+ entered_composited_bands_and_their_groups.truncate(count_of_bands_still_entered);
+ for &band_index in &composited_bands_around_layer[count_of_bands_still_entered..] {
+ let index_of_group_around = entered_composited_bands_and_their_groups
+ .last()
+ .map_or(-1, |(_, group_index)| *group_index);
+ let index_of_group_of_effect =
+ Self::append_groups_of_composited_band(&mut sublayers, painted, band_index, index_of_group_around);
+ entered_composited_bands_and_their_groups.push((band_index, index_of_group_of_effect));
+ }
+ let group_index = entered_composited_bands_and_their_groups
+ .last()
+ .map_or(-1, |(_, group_index)| *group_index);
if let LayerIdentity::Media { content, ordinal } = layer.identity {
let Some(Ok(placement)) = painted.window_server_placements_of_media.of_layer(layer_index) else {
continue;
@@ -372,15 +710,21 @@ impl ContextPresenting {
continue;
}
sublayers.push(FfiSublayer {
- identity: sublayer_identity_of_media
- | (u64::from(ordinal) << MEDIA_ORDINAL_SHIFT_PAST_CANVAS_AND_VIDEO_IDS),
- content_kind: kind,
+ group_index,
media_id: id,
- presentable_surface: std::ptr::null(),
placement: sublayer_placement_of(placement),
+ ..FfiSublayer::of_kind(
+ sublayer_identity_of_media
+ | (u64::from(ordinal) << MEDIA_ORDINAL_SHIFT_PAST_CANVAS_AND_VIDEO_IDS),
+ kind,
+ )
});
continue;
}
+ if painted.window_server_compositing.shows_tiles_of_painted_layers {
+ self.append_sublayers_of_tiled_layer(&mut sublayers, compositing, viewport_rect, group_index);
+ continue;
+ }
let Some(presentation) = layers.presentation_by_layer.get(&compositing.identity) else {
continue;
};
diff --git a/Services/Compositor/Rust/src/raster_host.rs b/Services/Compositor/Rust/src/raster_host.rs
index e114ce1432b..724f9fef2f7 100644
--- a/Services/Compositor/Rust/src/raster_host.rs
+++ b/Services/Compositor/Rust/src/raster_host.rs
@@ -29,7 +29,7 @@ use libcompositing_rust::ipc_types::{
};
use libcompositing_rust::time::MonotonicTime;
use libcompositing_rust::webgl::ImageSource;
-use libgfx_rust::{Color, FloatRect, IntRect, IntSize, ScalingMode};
+use libgfx_rust::{Color, CornerRadii, FloatRect, IntRect, IntSize, ScalingMode};
use std::collections::HashMap;
use std::ffi::{CStr, c_char, c_void};
use std::ptr::NonNull;
@@ -136,25 +136,112 @@ pub enum SublayerContentKind {
Canvas,
Video,
PresentableSurface,
+ /// Holds the sublayers that name it as their group, which the window server places and clips together.
+ Group,
+ /// The surface of a tile of a painted layer, shown at `rect` of the group it is in.
+ Tile,
+ /// A fill of `rect` of the group it is in with `color`.
+ Color,
+ /// What the window server shows below the sublayer, within a rect of the group it is in, run through filters.
+ Backdrop,
}
-/// A sublayer the window server shows above a frame: a canvas of the context by its id, a video by the handle of its
-/// sink, or a surface.
+/// What the window server shows below a sublayer, within `region` of the group the sublayer is in, run through a color
+/// matrix, a blur and another color matrix, in that order, each of which can be left out. A matrix is row-major with
+/// the offsets in the fifth column, for unpremultiplied colors from 0 to 1.
+#[derive(Clone, Copy, Debug, Default, PartialEq)]
+#[repr(C)]
+pub struct FfiSublayerBackdrop {
+ pub region: FloatRect,
+ pub has_color_matrix_before_blur: bool,
+ pub color_matrix_before_blur: [f32; 20],
+ pub has_blur: bool,
+ /// In device pixels.
+ pub blur_standard_deviation: f32,
+ pub has_color_matrix_after_blur: bool,
+ pub color_matrix_after_blur: [f32; 20],
+}
+
+/// Where the window server places the sublayers of a group, how it clips them, and how it fades them together, in
+/// device pixels.
+#[derive(Clone, Copy, Debug, PartialEq)]
+#[repr(C)]
+pub struct FfiSublayerGroup {
+ /// The a, b, c, d, e and f of the affine transform from the pixels of the group to those of the group it is in, or
+ /// to those of the frame.
+ pub to_parent: [f32; 6],
+ /// Whether the group clips its sublayers to `clip_rect`, in its own pixels, with the corners of the rect rounded
+ /// by the radii.
+ pub clips: bool,
+ pub clip_rect: FloatRect,
+ pub corner_radii: CornerRadii,
+ /// The opacity the group composites its sublayers at, once they are composited with each other.
+ pub opacity: f32,
+}
+
+impl Default for FfiSublayerGroup {
+ fn default() -> Self {
+ Self {
+ to_parent: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
+ clips: false,
+ clip_rect: FloatRect::default(),
+ corner_radii: CornerRadii::default(),
+ opacity: 1.0,
+ }
+ }
+}
+
+/// A sublayer the window server shows of a frame: a canvas of the context by its id, a video by the handle of its sink,
+/// a surface, a tile, a fill, or a group of other sublayers.
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(C)]
pub struct FfiSublayer {
pub identity: u64,
+ /// The index, among the sublayers of the frame, of the group the sublayer is in, or -1 for one in the frame itself.
+ /// A group comes before the sublayers in it, and sublayers of one group are shown bottom to top.
+ pub group_index: i32,
pub content_kind: SublayerContentKind,
pub media_id: u64,
+ /// Of a surface or a tile.
pub presentable_surface: *const PresentableSurface,
+ /// Of a canvas, a video or a surface.
pub placement: FfiSublayerPlacement,
+ pub group: FfiSublayerGroup,
+ /// Of a tile or a fill, in the pixels of the group it is in.
+ pub rect: IntRect,
+ pub color: Color,
+ /// Of a tile.
+ pub every_pixel_is_opaque: bool,
+ pub backdrop: FfiSublayerBackdrop,
+}
+
+impl FfiSublayer {
+ /// A sublayer of the frame itself that shows nothing, for the fields of each kind of content to be set on.
+ pub fn of_kind(identity: u64, content_kind: SublayerContentKind) -> Self {
+ Self {
+ identity,
+ group_index: -1,
+ content_kind,
+ media_id: 0,
+ presentable_surface: std::ptr::null(),
+ placement: FfiSublayerPlacement::default(),
+ group: FfiSublayerGroup::default(),
+ rect: IntRect::default(),
+ color: Color::TRANSPARENT,
+ every_pixel_is_opaque: false,
+ backdrop: FfiSublayerBackdrop::default(),
+ }
+ }
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct FfiRemoteLayerFrame {
- /// Lent for the call. Without the store, the frame shown before stays, and only the sublayers change.
+ /// Lent for the call. Without the store, the store shown before stays, and only the sublayers change, unless the
+ /// frame shows no store.
pub store: *const PresentableSurface,
+ /// Whether the sublayers are all of the frame, which then shows no store below them.
+ pub shows_no_store: bool,
pub painted_size: IntSize,
pub device_pixel_ratio: f64,
/// Where the frame is scaled to fit within the view, in device pixels, rather than shown at its own size.
@@ -171,6 +258,17 @@ pub struct FfiRemoteLayerHostHandle {
pub id: u64,
}
+/// What the window server that shows a context composites by itself of the layers of its frames, besides the canvases
+/// and videos it shows.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+#[repr(C)]
+pub struct FfiWindowServerCompositing {
+ /// Whether it shows each tile of a painted layer as a sublayer of its own, in a group it places and clips.
+ pub shows_tiles_of_painted_layers: bool,
+ /// Whether it runs what it shows below a sublayer through a blur and color matrices.
+ pub filters_what_is_below_layers: bool,
+}
+
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FfiCanvas2DPainter {
@@ -225,6 +323,8 @@ pub struct FfiRasterHost {
/// where none could be made.
pub create_presentable_surface:
unsafe extern "C" fn(*mut c_void, IntSize, *const PaintingSurface) -> *const PresentableSurface,
+ /// What the window server composites by itself of the layers of the frames its remote layers show.
+ pub window_server_compositing: unsafe extern "C" fn(*mut c_void) -> FfiWindowServerCompositing,
pub live_content: unsafe extern "C" fn(
*mut c_void,
@@ -649,6 +749,11 @@ impl RasterHost {
}
}
+ pub fn window_server_compositing(&self, window_server: &WindowServerObject) -> FfiWindowServerCompositing {
+ // SAFETY: The window server is live.
+ unsafe { (self.0.window_server_compositing)(window_server.as_ptr()) }
+ }
+
pub fn live_content(&self, context_id: CompositorContextId, canvas_ids: &[u64]) -> LiveContent {
unsafe extern "C" fn receive(receiver: *mut c_void, content: *const FfiLiveContent<'_>) {
// SAFETY: The receiver is the content below, and the host lends what it found for the call.
diff --git a/Services/Compositor/Rust/src/surfaces/presentable_surface.rs b/Services/Compositor/Rust/src/surfaces/presentable_surface.rs
index 25b7f60a645..57cedcc80be 100644
--- a/Services/Compositor/Rust/src/surfaces/presentable_surface.rs
+++ b/Services/Compositor/Rust/src/surfaces/presentable_surface.rs
@@ -52,6 +52,21 @@ impl PresentableSurface {
Rc::as_ptr(self)
}
+ /// A surface over the painting surface that draws into memory the window server cannot read.
+ pub fn shown_by_no_window_server(painting_surface: Rc<PaintingSurface>) -> Rc<PresentableSurface> {
+ Rc::new(PresentableSurface {
+ painting_surface,
+ content_is_upside_down: false,
+ window_server_surface: None,
+ was_handed_to_window_server: Cell::new(false),
+ lease_count: Cell::new(0),
+ })
+ }
+
+ pub fn can_be_shown_by_window_server(&self) -> bool {
+ self.window_server_surface.is_some()
+ }
+
/// # Safety
///
/// `surface` must be a surface whose one reference the caller hands over, or null.
diff --git a/Services/Compositor/WindowServer.h b/Services/Compositor/WindowServer.h
index 35e7bf93611..6353efa2532 100644
--- a/Services/Compositor/WindowServer.h
+++ b/Services/Compositor/WindowServer.h
@@ -40,6 +40,13 @@ public:
// None where no window server shows surfaces above the frames.
static ErrorOr<RefPtr<PresentableSurface>> try_create_presentable_surface_for_sublayers(Gfx::IntSize, Gfx::SkiaBackendContext&);
+ // Whether a remote layer of this window server shows each tile of a painted layer as a sublayer of its own, in a
+ // group that places and clips the tiles of the layer, so that it can show every layer of a frame by itself.
+ virtual bool shows_tiles_of_painted_layers() const { return false; }
+ // Whether a remote layer of this window server runs what it shows below a sublayer through a blur and color
+ // matrices, as a backdrop filter does.
+ virtual bool filters_what_is_below_layers() const { return false; }
+
enum class FrameHandOff : u8 {
OnceGpuWorkIsScheduled,
OnceGpuWorkIsFinished,
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-region-hit-testing.txt b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-region-hit-testing.txt
index 06da6db8466..fc0e7f684bf 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-region-hit-testing.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-region-hit-testing.txt
@@ -18,7 +18,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[20,160 100x100] min_scroll_offset=[0,0] max_scroll_offset=[100,0] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt
index 5560a4d9303..39f70404d41 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt
@@ -36,7 +36,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[0,0 200x200] min_scroll_offset=[0,0] max_scroll_offset=[800,900] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt
index ccb4483344f..f12d4a29193 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1413] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] single layer replaying the whole list: empty display list
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt b/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt
index c0924b040e2..fb99cd44fcb 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt
@@ -13,8 +13,8 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1413] is_viewport=true
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L2] composited context #0 space=document region=[37,37 166x126]
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt b/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt
index 96ac1e8c04c..ef4f53f8521 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt
@@ -15,7 +15,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1513] is_viewport=true
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[0,400] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt
index 6695d4dba3e..3331036b8fe 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt
@@ -18,7 +18,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1513] is_viewport=true
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[400,400] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L2] painted space=sticky@s2 in document
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt
index 42e98717d13..664ede8a461 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt
@@ -19,7 +19,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1513] is_viewport=true
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[400,400] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/sticky-areas.txt b/Tests/LibWeb/Text/expected/async-scrolling/sticky-areas.txt
index 34c8cca7993..b0017187c45 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/sticky-areas.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/sticky-areas.txt
@@ -18,7 +18,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1429] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L2] painted space=sticky@s2 in document
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt b/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt
index ef8d9b57086..a6156d1022c 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt
@@ -17,7 +17,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1513] is_viewport=true
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[0,400] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt b/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt
index 4a9403bfc94..0d53e7d3fda 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt
@@ -23,7 +23,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[0,0 200x200] min_scroll_offset=[0,0] max_scroll_offset=[800,900] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/css/text-underline-position.txt b/Tests/LibWeb/Text/expected/css/text-underline-position.txt
index db86baf6031..f2cbc5d70d5 100644
--- a/Tests/LibWeb/Text/expected/css/text-underline-position.txt
+++ b/Tests/LibWeb/Text/expected/css/text-underline-position.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/abspos-escaping-overflow-clip-inside-opacity.txt b/Tests/LibWeb/Text/expected/display_list/abspos-escaping-overflow-clip-inside-opacity.txt
index 39d0106a3f1..5d2c2d1ff00 100644
--- a/Tests/LibWeb/Text/expected/display_list/abspos-escaping-overflow-clip-inside-opacity.txt
+++ b/Tests/LibWeb/Text/expected/display_list/abspos-escaping-overflow-clip-inside-opacity.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[opacity=0.5] (BlockContainer<DIV>#group)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/abspos-inside-nested-opacity-inside-relpos.txt b/Tests/LibWeb/Text/expected/display_list/abspos-inside-nested-opacity-inside-relpos.txt
index 583eb4abe13..e5cdb8e2ad7 100644
--- a/Tests/LibWeb/Text/expected/display_list/abspos-inside-nested-opacity-inside-relpos.txt
+++ b/Tests/LibWeb/Text/expected/display_list/abspos-inside-nested-opacity-inside-relpos.txt
@@ -9,7 +9,7 @@ AccumulatedVisualContext Tree:
[e1 in s1 out=c0] effects=[opacity=0.5] (BlockContainer<DIV>.outer-opacity)
[e2 in s1 out=c0] effects=[opacity=0.3] (BlockContainer<DIV>.inner-opacity)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/abspos-inside-opacity-inside-relpos.txt b/Tests/LibWeb/Text/expected/display_list/abspos-inside-opacity-inside-relpos.txt
index 0a3361abcdd..17378959a01 100644
--- a/Tests/LibWeb/Text/expected/display_list/abspos-inside-opacity-inside-relpos.txt
+++ b/Tests/LibWeb/Text/expected/display_list/abspos-inside-opacity-inside-relpos.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1 out=c0] effects=[opacity=0.5] (BlockContainer<DIV>.opacity)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/abspos-under-clipped-transformed-opacity.txt b/Tests/LibWeb/Text/expected/display_list/abspos-under-clipped-transformed-opacity.txt
index 869ffa7bef3..605a7ca88c2 100644
--- a/Tests/LibWeb/Text/expected/display_list/abspos-under-clipped-transformed-opacity.txt
+++ b/Tests/LibWeb/Text/expected/display_list/abspos-under-clipped-transformed-opacity.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s2] effects=[opacity=0.5] (BlockContainer<DIV>#clipped)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/animated-clip-path-visual-context-update.txt b/Tests/LibWeb/Text/expected/display_list/animated-clip-path-visual-context-update.txt
index fdd46d7d9ba..5c669764c27 100644
--- a/Tests/LibWeb/Text/expected/display_list/animated-clip-path-visual-context-update.txt
+++ b/Tests/LibWeb/Text/expected/display_list/animated-clip-path-visual-context-update.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/animated-transform-visual-context-update.txt b/Tests/LibWeb/Text/expected/display_list/animated-transform-visual-context-update.txt
index 6f639c92731..ee7860e09a6 100644
--- a/Tests/LibWeb/Text/expected/display_list/animated-transform-visual-context-update.txt
+++ b/Tests/LibWeb/Text/expected/display_list/animated-transform-visual-context-update.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -22,7 +22,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/backdrop-filter-effect-node.txt b/Tests/LibWeb/Text/expected/display_list/backdrop-filter-effect-node.txt
index fc9d11d06c9..09212e8fa1d 100644
--- a/Tests/LibWeb/Text/expected/display_list/backdrop-filter-effect-node.txt
+++ b/Tests/LibWeb/Text/expected/display_list/backdrop-filter-effect-node.txt
@@ -12,7 +12,7 @@ AccumulatedVisualContext Tree:
[e2 in s1] effects=[opacity=0.5] (BlockContainer<DIV>#plain)
[e3 in s1] effects=[backdrop-filter=[region=[400,20 50x50] filter=[blur(2,2)]]] (BlockContainer<DIV>#empty)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
e1 is not composited: it reads only its own layer
e3 is not composited: it reads only its own layer
diff --git a/Tests/LibWeb/Text/expected/display_list/background-attachment-change-repaints.txt b/Tests/LibWeb/Text/expected/display_list/background-attachment-change-repaints.txt
index 7e9a1b4ccfd..928a57c0441 100644
--- a/Tests/LibWeb/Text/expected/display_list/background-attachment-change-repaints.txt
+++ b/Tests/LibWeb/Text/expected/display_list/background-attachment-change-repaints.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -19,7 +19,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/background-attachment-fixed.txt b/Tests/LibWeb/Text/expected/display_list/background-attachment-fixed.txt
index c63ce33a8bd..57649c7e7cf 100644
--- a/Tests/LibWeb/Text/expected/display_list/background-attachment-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/background-attachment-fixed.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,613] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/background-blend-mode-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/background-blend-mode-invalidation.txt
index 03447bf3f86..38dcc5e9da7 100644
--- a/Tests/LibWeb/Text/expected/display_list/background-blend-mode-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/background-blend-mode-invalidation.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -22,7 +22,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/background-blend-mode-isolated-group.txt b/Tests/LibWeb/Text/expected/display_list/background-blend-mode-isolated-group.txt
index ee6fb72b9fe..50399713efb 100644
--- a/Tests/LibWeb/Text/expected/display_list/background-blend-mode-isolated-group.txt
+++ b/Tests/LibWeb/Text/expected/display_list/background-blend-mode-isolated-group.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/background-clip-text-color-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/background-clip-text-color-invalidation.txt
index ad3278ac2c6..9d074dfb3eb 100644
--- a/Tests/LibWeb/Text/expected/display_list/background-clip-text-color-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/background-clip-text-color-invalidation.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -20,7 +20,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/block-in-inline-no-border-for-phantom-inline-box.txt b/Tests/LibWeb/Text/expected/display_list/block-in-inline-no-border-for-phantom-inline-box.txt
index 1206abff141..30db6d3e9aa 100644
--- a/Tests/LibWeb/Text/expected/display_list/block-in-inline-no-border-for-phantom-inline-box.txt
+++ b/Tests/LibWeb/Text/expected/display_list/block-in-inline-no-border-for-phantom-inline-box.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/border-inner-corner-right-angle-all-edges.txt b/Tests/LibWeb/Text/expected/display_list/border-inner-corner-right-angle-all-edges.txt
index ec5b5928e3e..c2a85576fb7 100644
--- a/Tests/LibWeb/Text/expected/display_list/border-inner-corner-right-angle-all-edges.txt
+++ b/Tests/LibWeb/Text/expected/display_list/border-inner-corner-right-angle-all-edges.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/border-radius-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/border-radius-invalidation.txt
index f438b4233bd..b33a2d249c1 100644
--- a/Tests/LibWeb/Text/expected/display_list/border-radius-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/border-radius-invalidation.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -25,7 +25,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt b/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt
index 85c71bffddc..ab3fb796173 100644
--- a/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt
+++ b/Tests/LibWeb/Text/expected/display_list/button-with-text-decoration.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/canvas-compositor-surface.txt b/Tests/LibWeb/Text/expected/display_list/canvas-compositor-surface.txt
index ad5fbe1aff1..81a0ffec019 100644
--- a/Tests/LibWeb/Text/expected/display_list/canvas-compositor-surface.txt
+++ b/Tests/LibWeb/Text/expected/display_list/canvas-compositor-surface.txt
@@ -5,9 +5,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[5,5 38x38] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[5,5 38x38] can be shown by the window server: clip=[0,0 800x600]
DisplayList:
L1 DrawCanvas@s1/e0 dst_rect=[8,8 32x32] canvas_id=canvas1 scaling_mode=Bilinear owner=CanvasBox<CANVAS>#canvas phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/canvas-drawn-on-after-layout-reached-it.txt b/Tests/LibWeb/Text/expected/display_list/canvas-drawn-on-after-layout-reached-it.txt
index 7ecb829e9e5..292b3575b9f 100644
--- a/Tests/LibWeb/Text/expected/display_list/canvas-drawn-on-after-layout-reached-it.txt
+++ b/Tests/LibWeb/Text/expected/display_list/canvas-drawn-on-after-layout-reached-it.txt
@@ -5,9 +5,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[5,5 206x126] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[5,5 206x126] can be shown by the window server: clip=[0,0 800x600]
DisplayList:
L1 DrawCanvas@s1/e0 dst_rect=[8,8 200x120] canvas_id=canvas1 scaling_mode=Bilinear owner=CanvasBox<CANVAS>#canvas phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/clip-auto-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/clip-auto-invalidation.txt
index c6b06f572bd..91102b4585d 100644
--- a/Tests/LibWeb/Text/expected/display_list/clip-auto-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/clip-auto-invalidation.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -22,7 +22,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/clip-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/clip-invalidation.txt
index 688da73f92a..f5baa6efd26 100644
--- a/Tests/LibWeb/Text/expected/display_list/clip-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/clip-invalidation.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -25,7 +25,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/clip-path-empty-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/clip-path-empty-invalidation.txt
index be43ab231f0..fefbb1d7b84 100644
--- a/Tests/LibWeb/Text/expected/display_list/clip-path-empty-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/clip-path-empty-invalidation.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -24,7 +24,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/clip-path-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/clip-path-invalidation.txt
index 716a51534a0..a61f02b063f 100644
--- a/Tests/LibWeb/Text/expected/display_list/clip-path-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/clip-path-invalidation.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -25,7 +25,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt b/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt
index a8d77984af4..3a44bc57809 100644
--- a/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt
+++ b/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/color-and-file-input-appearance.txt b/Tests/LibWeb/Text/expected/display_list/color-and-file-input-appearance.txt
index d72869d329d..51a83f795c4 100644
--- a/Tests/LibWeb/Text/expected/display_list/color-and-file-input-appearance.txt
+++ b/Tests/LibWeb/Text/expected/display_list/color-and-file-input-appearance.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-3d-sorting-context.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-3d-sorting-context.txt
index 5088d659fe2..7df1ec348f8 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-3d-sorting-context.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-3d-sorting-context.txt
@@ -8,9 +8,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[5,5 206x126] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[5,5 206x126] can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-filter-that-moves-it.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-filter-that-moves-it.txt
index 021f860367e..c463d22510d 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-filter-that-moves-it.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-filter-that-moves-it.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
[e1 in s1] effects=[filter=[crop([-70.4,-2 940.80005x120.00001] input=[offset(40,0 input=[crop([-70.4,-2 940.80005x120.00001])])])]] (BlockContainer<DIV>)
[e2 in s1] effects=[backdrop-filter=[region=[8,8 100x100] filter=[drop-shadow(4,4,0,rgb(0, 0, 0))]]] (BlockContainer<DIV>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] single layer replaying the whole list: filter that moves what it filters is composited
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-opacity-group-over-canvas.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-opacity-group-over-canvas.txt
index 0922f1b020c..670cbf768ab 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-opacity-group-over-canvas.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-in-opacity-group-over-canvas.txt
@@ -7,9 +7,9 @@ AccumulatedVisualContext Tree:
[e1 in s1] effects=[opacity=0.9] (BlockContainer<DIV>#group)
[e2 in s1] effects=[backdrop-filter=[region=[60,60 100x40] filter=[blur(4,4)]]] (BlockContainer<DIV>#frosted)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[17,17 206x126] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1
e2 is not composited: it reads only its own layer
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-canvas.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-canvas.txt
index 5a8a659fe04..7d25e5b2226 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-canvas.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-canvas.txt
@@ -6,11 +6,11 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[backdrop-filter=[region=[60,60 100x40] filter=[blur(4,4)]]] (BlockContainer<DIV>#frosted)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[17,17 206x126] replayed: under a layer the frame holds
+ [L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L3] painted space=viewport inside e1
- composited e1 space=viewport reads=[33,33 154x94]: it reads what its own layer does not hold
+ composited e1 space=viewport reads=[33,33 154x94]: it reads what its own layer does not hold, can be composited by the window server
DisplayList:
L1 DrawCanvas@s1/e0 dst_rect=[20,20 200x120] canvas_id=canvas1 scaling_mode=Bilinear owner=CanvasBox<CANVAS>#canvas phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-content-over-canvas.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-content-over-canvas.txt
index 845167dd19c..0b009fed19a 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-content-over-canvas.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-over-content-over-canvas.txt
@@ -6,9 +6,9 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[backdrop-filter=[region=[540,120 60x40] filter=[Grayscale(1)]]] (BlockContainer<DIV>#frosted)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[17,17 206x126] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1
e1 is not composited: it reads only its own layer
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-without-window-server-equivalent.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-without-window-server-equivalent.txt
new file mode 100644
index 00000000000..51a09d52b0f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filter-without-window-server-equivalent.txt
@@ -0,0 +1,22 @@
+AccumulatedVisualContext Tree:
+ spatial:
+ [s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
+ [s1] scroll (Viewport<#document>)
+ [s2] scroll (BlockContainer<DIV>#scroller)
+ clips:
+ [c0 in s1] clip=[20,20 200x100] (BlockContainer<DIV>#scroller)
+ effects:
+ [e0 in s0] effects=[]
+ [e1 in s0] effects=[backdrop-filter=[region=[100,40 200x40] filter=[drop-shadow(4,4,4,rgb(0, 0, 0))]]] (BlockContainer<DIV>#shadowing)
+
+ScrollNodes:
+ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,2420] is_viewport=true
+ScrollNode scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[20,20 200x100] min_scroll_offset=[0,0] max_scroll_offset=[0,300] is_viewport=false
+
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L1] base space=document held by the frame: it is under a layer the frame holds
+ [L2] painted space=scroller@s2 in document composited within [20,20 200x100] of document held by the frame: it is under a layer the frame holds
+ [L3] painted space=document above band 0 of scroller@s2 in document held by the frame: it is under a layer the frame holds
+ [L5] painted space=viewport inside e1 held by the frame: it is inside an effect the compositor composites
+ composited e1 space=viewport reads=[65,5 270x110]: its backdrop filter reads past the edge of the frame, composited by the compositor: its backdrop filter has a function the window server has no equivalent of
+
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filters-beside-canvases.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filters-beside-canvases.txt
index 709a2608055..8dc9f69980b 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filters-beside-canvases.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-backdrop-filters-beside-canvases.txt
@@ -7,14 +7,14 @@ AccumulatedVisualContext Tree:
[e1 in s1] effects=[backdrop-filter=[region=[240,60 100x40] filter=[Grayscale(1)]]] (BlockContainer<DIV>#grayscale-beside-left.frosted)
[e2 in s1] effects=[backdrop-filter=[region=[610,60 100x40] filter=[blur(8,8)]]] (BlockContainer<DIV>#blur-reaching-into-right.frosted)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[17,17 206x126] shown by the window server: clip=[0,0 800x600]
- [L3] canvas #0 space=viewport region=[397,17 206x126] replayed: under a layer the frame holds
+ [L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[0,0 800x600]
+ [L3] canvas #0 space=viewport region=[397,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L5] painted space=viewport inside e1
[L7] painted space=viewport inside e2
- composited e1 space=viewport reads=[237,57 106x46]: it reads what its own layer does not hold
- composited e2 space=viewport reads=[559,9 202x142]: it reads what its own layer does not hold
+ composited e1 space=viewport reads=[237,57 106x46]: it reads what its own layer does not hold, can be composited by the window server
+ composited e2 space=viewport reads=[559,9 202x142]: it reads what its own layer does not hold, can be composited by the window server
DisplayList:
L1 DrawCanvas@s1/e0 dst_rect=[20,20 200x120] canvas_id=canvas1 scaling_mode=Bilinear owner=CanvasBox<CANVAS>#left phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-filter-that-moves-it.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-filter-that-moves-it.txt
index ed3a85d555c..bfb95760c28 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-filter-that-moves-it.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-filter-that-moves-it.txt
@@ -7,10 +7,10 @@ AccumulatedVisualContext Tree:
[e1 in s1] effects=[filter=[crop([-70.4,-4.3 940.80005x147.6] input=[offset(40,0 input=[crop([-70.4,-4.3 940.80005x147.6])])])]] (BlockContainer<DIV>)
[e2 in s1] effects=[filter=[drop-shadow(10,10,0,rgb(0, 0, 0))]] (BlockContainer<DIV>)
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L2] canvas #0 space=viewport inside e2 region=[5,128 216x136] replayed: inside an effect the compositor composites
- composited e2 space=viewport: it holds a canvas with a layer of its own
+ composited e2 space=viewport: it holds a canvas with a layer of its own, composited by the compositor: it filters
no layer for canvas: inside a filter that moves what it filters
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-nested-scroller.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-nested-scroller.txt
index 7043d7610eb..9436b0d931a 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-nested-scroller.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-nested-scroller.txt
@@ -12,9 +12,9 @@ ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1413] is_viewport=true
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[20,300 300x200] min_scroll_offset=[0,0] max_scroll_offset=[0,1200] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L3] canvas #0 space=scroller@s2 in document region=[20,697 203x126] composited within [20,300 300x200] of document shown by the window server: clip=[20,300 300x200]
+ [L3] canvas #0 space=scroller@s2 in document region=[20,697 203x126] composited within [20,300 300x200] of document can be shown by the window server: clip=[20,300 300x200]
[L4] painted space=scroller@s2 in document above L3 composited within [20,300 300x200] of document
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-opacity-group.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-opacity-group.txt
index 1a404087f8d..8e3e42f5a09 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-opacity-group.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-opacity-group.txt
@@ -6,10 +6,10 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[opacity=0.5] (BlockContainer<DIV>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L2] canvas #0 space=viewport inside e1 region=[5,5 206x126] replayed: inside an effect the compositor composites
- composited e1 space=viewport: it holds a canvas with a layer of its own
+ [L2] canvas #0 space=viewport inside e1 region=[5,5 206x126] can be shown by the window server: clip=[0,0 800x600]
+ composited e1 space=viewport: it holds a canvas with a layer of its own, can be composited by the window server
DisplayList:
L2 DrawCanvas@s1/e1 dst_rect=[8,8 200x120] canvas_id=canvas1 scaling_mode=Bilinear owner=CanvasBox<CANVAS>#canvas phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-scrolling-document.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-scrolling-document.txt
index 93deb2bcef6..da21362a07c 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-scrolling-document.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-in-scrolling-document.txt
@@ -8,9 +8,9 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1413] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L2] canvas #0 space=document region=[17,897 206x126] shown by the window server: clip=[0,0 800x600]
+ [L2] canvas #0 space=document region=[17,897 206x126] can be shown by the window server: clip=[0,0 800x600]
[L3] painted space=document above L2
[L4] painted space=viewport above band 0 of document
[L5] painted space=document band=1
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-outside-viewport.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-outside-viewport.txt
index 874b5479095..6ad3b502d0c 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-outside-viewport.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-outside-viewport.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
no layer for canvas: draws nothing visible
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-clip-path.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-clip-path.txt
index a940d1efa41..a4599b20721 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-clip-path.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-clip-path.txt
@@ -7,8 +7,8 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] canvas #0 space=viewport region=[67,27 106x106] replayed: clipped by a path
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-perspective-transform.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-perspective-transform.txt
index f8dd576062c..3f5a693e325 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-perspective-transform.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-perspective-transform.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
no layer for canvas: under a transform that is not 2D affine
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-translucent-box.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-translucent-box.txt
index db616e0f010..078d628f9f0 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-translucent-box.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-canvas-under-translucent-box.txt
@@ -5,9 +5,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[17,17 206x126] shown by the window server: clip=[20,20 200x120] rounded=[20,20 200x120] radius=12
+ [L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[20,20 200x120] rounded=[20,20 200x120] radius=12
[L2] painted space=viewport above L1
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-effect-out-of-view-holds-no-layer-in-frame.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-effect-out-of-view-holds-no-layer-in-frame.txt
new file mode 100644
index 00000000000..94ae0e1a6f9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-effect-out-of-view-holds-no-layer-in-frame.txt
@@ -0,0 +1,18 @@
+With the blending box below the viewport:
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L1] base space=document
+ [L2] painted space=scroller@s2 in document composited within [20,20 200x100] of document
+ [L3] painted space=document above band 0 of scroller@s2 in document
+ [L4] canvas #0 space=document region=[17,1497 206x126] can be shown by the window server: clip=[0,0 800x600]
+ [L6] painted space=document inside e1
+ composited e1 space=document reads=[57,1537 106x46]: it reads what its own layer does not hold, composited by the compositor: it blends with what is below it
+
+With the blending box in the viewport:
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L1] base space=document held by the frame: it is under a layer the frame holds
+ [L2] painted space=scroller@s2 in document composited within [20,20 200x100] of document held by the frame: it is under a layer the frame holds
+ [L3] painted space=document above band 0 of scroller@s2 in document held by the frame: it is under a layer the frame holds
+ [L4] canvas #0 space=document region=[17,1497 206x126] replayed: under a layer the frame holds
+ [L6] painted space=document inside e1 held by the frame: it is inside an effect the compositor composites
+ composited e1 space=document reads=[57,1537 106x46]: it reads what its own layer does not hold, composited by the compositor: it blends with what is below it
+
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-fixed-header-over-scrolling-text.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-fixed-header-over-scrolling-text.txt
index 57907011444..9f31d745eb3 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-fixed-header-over-scrolling-text.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-fixed-header-over-scrolling-text.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,1420] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
[L2] painted space=viewport above band 0 of document
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-frosted-sticky-header.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-frosted-sticky-header.txt
new file mode 100644
index 00000000000..ac8f51290ff
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-frosted-sticky-header.txt
@@ -0,0 +1,23 @@
+AccumulatedVisualContext Tree:
+ spatial:
+ [s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
+ [s1] scroll (Viewport<#document>)
+ [s2] scroll (BlockContainer<DIV>#scroller)
+ [s3] sticky scroller=s1 position_relative_to_scroller=[0,0] border_box_origin=[0,0] border_box_size=[800x40] scrollport_size=[800x600] containing_block_region=[0,0 800x3000] needs_parent_offset_adjustment=true insets=[top=0] (BlockContainer<DIV>#header)
+ clips:
+ [c0 in s1] clip=[20,60 200x100] radii=(12,12,12,12) (BlockContainer<DIV>#scroller)
+ effects:
+ [e0 in s0] effects=[]
+ [e1 in s3] effects=[backdrop-filter=[region=[0,0 800x40] filter=[blur(8,8) Saturate(1.5)]]] (BlockContainer<DIV>#header)
+
+ScrollNodes:
+ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,2400] is_viewport=true
+ScrollNode scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[20,60 200x100] min_scroll_offset=[0,0] max_scroll_offset=[0,300] is_viewport=false
+
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L1] base space=document
+ [L2] painted space=scroller@s2 in document composited within [20,60 200x100] radii=(12,12,12,12) of document
+ [L3] painted space=document above band 0 of scroller@s2 in document
+ [L5] painted space=sticky@s3 in document inside e1
+ composited e1 space=sticky@s3 in document reads=[-51,-51 902x142]: it reads what its own layer does not hold, can be composited by the window server
+
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-and-canvas.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-and-canvas.txt
index bc3dda4c193..d457e32668d 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-and-canvas.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-and-canvas.txt
@@ -5,11 +5,11 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] composited context #0 space=viewport region=[17,17 206x126]
[L2] painted space=viewport above L1
- [L3] canvas #0 space=viewport region=[517,17 206x126] shown by the window server: clip=[0,0 800x600]
+ [L3] canvas #0 space=viewport region=[517,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L4] painted space=viewport above L3
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-in-opacity-group.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-in-opacity-group.txt
index 19763462c6c..cfdada42068 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-in-opacity-group.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-in-opacity-group.txt
@@ -6,10 +6,10 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[opacity=0.5] (BlockContainer<DIV>#group)
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L2] composited context #0 space=viewport inside e1 region=[0,0 203x123]
- composited e1 space=viewport: it holds a composited context with a layer of its own
+ composited e1 space=viewport: it holds a composited context with a layer of its own, can be composited by the window server
DisplayList:
L0 CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s0 rect=[0,0 800x600] owner=Viewport<#document> phase=scroll-metadata
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-under-content.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-under-content.txt
index 22b9aa42c7b..25043befa12 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-under-content.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-iframe-under-content.txt
@@ -5,8 +5,8 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] composited context #0 space=viewport region=[17,17 206x126]
[L2] painted space=viewport above L1
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-root-blend-mode.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-root-blend-mode.txt
index ab37389df81..e28c6eca12c 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-root-blend-mode.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-root-blend-mode.txt
@@ -6,11 +6,11 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[blend_mode=Multiply] (BlockContainer<DIV>)
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] canvas #0 space=viewport region=[5,5 206x126] replayed: under a layer the frame holds
- [L3] painted space=viewport inside e1
- composited e1 space=viewport reads=[5,128 56x56]: it reads what its own layer does not hold
+ [L3] painted space=viewport inside e1 held by the frame: it is inside an effect the compositor composites
+ composited e1 space=viewport reads=[5,128 56x56]: it reads what its own layer does not hold, composited by the compositor: it blends with what is below it
DisplayList:
L1 DrawCanvas@s1/e0 dst_rect=[8,8 200x120] canvas_id=canvas1 scaling_mode=Bilinear owner=CanvasBox<CANVAS>#canvas phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-rotated-video.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-rotated-video.txt
index b8bdc336524..144eb7ffc44 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-rotated-video.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-rotated-video.txt
@@ -6,9 +6,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] video #0 space=viewport region=[167,27 186x326] shown by the window server: transform=[0,1,-1,0,450,-70] clip=[0,0 800x600]
+ [L1] video #0 space=viewport region=[167,27 186x326] can be shown by the window server: transform=[0,1,-1,0,450,-70] clip=[0,0 800x600]
DisplayList:
L1 DrawVideoFrame@s2/e0 dst_rect=[100,100 320x180] video_sink_handle=video1 scaling_mode=BilinearMipmap inline_clips=[clip=[100,100 320x180]] owner=VideoBox<VIDEO>#video phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-rounded-canvas-in-rounded-scroller.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-rounded-canvas-in-rounded-scroller.txt
index 4bae4487afe..61b2ecc1aec 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-rounded-canvas-in-rounded-scroller.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-rounded-canvas-in-rounded-scroller.txt
@@ -11,8 +11,8 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[20,20 180x100] min_scroll_offset=[0,0] max_scroll_offset=[20,320] is_viewport=false
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L2] canvas #0 space=scroller@s2 in viewport region=[20,20 200x123] composited within [20,20 180x100] radii=(20,20,20,20) of viewport replayed: more than one rounded clip
[L4] painted space=viewport above band 0 of scroller@s2 in viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-scroller-after-many-overflow-hidden-boxes.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-scroller-after-many-overflow-hidden-boxes.txt
index 81a67e5a1d0..5b225a6dac7 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-scroller-after-many-overflow-hidden-boxes.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-scroller-after-many-overflow-hidden-boxes.txt
@@ -38,10 +38,10 @@ ScrollNode scroll_node_index=s9 parent_scroll_node_index=s0 scrollport_rect=[0,1
ScrollNode scroll_node_index=s10 parent_scroll_node_index=s0 scrollport_rect=[0,160 400x300] min_scroll_offset=[0,0] max_scroll_offset=[1600,0] is_viewport=false
ScrollNode scroll_node_index=s11 parent_scroll_node_index=s10 scrollport_rect=[0,170 300x200] min_scroll_offset=[0,0] max_scroll_offset=[0,850] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L2] painted space=scroller@s11 in scroller@s10 in viewport composited within [0,160 400x300] of viewport composited within [0,170 300x200] of scroller@s10 in viewport
- [L3] canvas #0 space=scroller@s11 in scroller@s10 in viewport region=[0,217 203x126] composited within [0,160 400x300] of viewport composited within [0,170 300x200] of scroller@s10 in viewport shown by the window server: clip=[0,170 300x200]
+ [L3] canvas #0 space=scroller@s11 in scroller@s10 in viewport region=[0,217 203x126] composited within [0,160 400x300] of viewport composited within [0,170 300x200] of scroller@s10 in viewport can be shown by the window server: clip=[0,170 300x200]
DisplayList:
L0 CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s0 rect=[0,0 800x600] owner=Viewport<#document> phase=scroll-metadata
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-transformed-boxes-beside-canvas.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-transformed-boxes-beside-canvas.txt
index 25d0fd48343..abad611a9ce 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-transformed-boxes-beside-canvas.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-transformed-boxes-beside-canvas.txt
@@ -9,9 +9,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[297,17 206x126] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[297,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-two-canvases.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-two-canvases.txt
index a876e04589c..bdeb2ecb7d9 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-two-canvases.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-two-canvases.txt
@@ -5,11 +5,11 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] canvas #0 space=viewport region=[17,17 206x126] shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1
- [L3] canvas #0 space=viewport region=[517,17 206x126] shown by the window server: clip=[0,0 800x600]
+ [L3] canvas #0 space=viewport region=[517,17 206x126] can be shown by the window server: clip=[0,0 800x600]
[L4] painted space=viewport above L3
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-in-rotated-overflow-box.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-in-rotated-overflow-box.txt
index 330c36c7c92..7e388b71541 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-in-rotated-overflow-box.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-in-rotated-overflow-box.txt
@@ -12,8 +12,8 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[100,100 200x150] min_scroll_offset=[0,0] max_scroll_offset=[120,33] is_viewport=false
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] video #0 space=viewport region=[85,80 230x190] replayed: clipped in a rotated or skewed space
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-under-captions.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-under-captions.txt
index 0e6e2b978fc..1b2b78374b7 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-under-captions.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-under-captions.txt
@@ -5,9 +5,9 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
- [L1] video #0 space=viewport region=[7,37 326x186] shown by the window server: clip=[0,0 800x600]
+ [L1] video #0 space=viewport region=[7,37 326x186] can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-with-differing-corner-radii.txt b/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-with-differing-corner-radii.txt
index 88adced5474..eb2d8f5f39f 100644
--- a/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-with-differing-corner-radii.txt
+++ b/Tests/LibWeb/Text/expected/display_list/compositing-layers-video-with-differing-corner-radii.txt
@@ -5,8 +5,8 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] video #0 space=viewport region=[7,7 326x246] replayed: rounded corners of differing radii
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/contenteditable-caret.txt b/Tests/LibWeb/Text/expected/display_list/contenteditable-caret.txt
index e511a3b54eb..8331530a8d8 100644
--- a/Tests/LibWeb/Text/expected/display_list/contenteditable-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/contenteditable-caret.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/css-clip-property.txt b/Tests/LibWeb/Text/expected/display_list/css-clip-property.txt
index 4aa62eb6352..18f8f0f3fba 100644
--- a/Tests/LibWeb/Text/expected/display_list/css-clip-property.txt
+++ b/Tests/LibWeb/Text/expected/display_list/css-clip-property.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/dashed-border-with-border-radius.txt b/Tests/LibWeb/Text/expected/display_list/dashed-border-with-border-radius.txt
index ec511c644b8..d741fb3f78d 100644
--- a/Tests/LibWeb/Text/expected/display_list/dashed-border-with-border-radius.txt
+++ b/Tests/LibWeb/Text/expected/display_list/dashed-border-with-border-radius.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/deep-branching-tree.txt b/Tests/LibWeb/Text/expected/display_list/deep-branching-tree.txt
index 7e7e348170f..36a37f6e94c 100644
--- a/Tests/LibWeb/Text/expected/display_list/deep-branching-tree.txt
+++ b/Tests/LibWeb/Text/expected/display_list/deep-branching-tree.txt
@@ -13,7 +13,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/double-border-with-asymmetric-radii.txt b/Tests/LibWeb/Text/expected/display_list/double-border-with-asymmetric-radii.txt
index 31b204f7f5b..a4ca2d6caf4 100644
--- a/Tests/LibWeb/Text/expected/display_list/double-border-with-asymmetric-radii.txt
+++ b/Tests/LibWeb/Text/expected/display_list/double-border-with-asymmetric-radii.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/fieldset-background-with-legend.txt b/Tests/LibWeb/Text/expected/display_list/fieldset-background-with-legend.txt
index 59f2605268a..d955689112a 100644
--- a/Tests/LibWeb/Text/expected/display_list/fieldset-background-with-legend.txt
+++ b/Tests/LibWeb/Text/expected/display_list/fieldset-background-with-legend.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/fieldset-legend-rounded-dashed-border.txt b/Tests/LibWeb/Text/expected/display_list/fieldset-legend-rounded-dashed-border.txt
index 2bdae6b4441..ea589a6d643 100644
--- a/Tests/LibWeb/Text/expected/display_list/fieldset-legend-rounded-dashed-border.txt
+++ b/Tests/LibWeb/Text/expected/display_list/fieldset-legend-rounded-dashed-border.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/fixed-position.txt b/Tests/LibWeb/Text/expected/display_list/fixed-position.txt
index 2fba46e2bb7..1282b758301 100644
--- a/Tests/LibWeb/Text/expected/display_list/fixed-position.txt
+++ b/Tests/LibWeb/Text/expected/display_list/fixed-position.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt b/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt
index 736a4dccc96..0e4be115d97 100644
--- a/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt
+++ b/Tests/LibWeb/Text/expected/display_list/form-control-native-appearance-corners.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/grid-gap-rounding.txt b/Tests/LibWeb/Text/expected/display_list/grid-gap-rounding.txt
index 843fd247f87..807cc0a236d 100644
--- a/Tests/LibWeb/Text/expected/display_list/grid-gap-rounding.txt
+++ b/Tests/LibWeb/Text/expected/display_list/grid-gap-rounding.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/iframe-compositor-surface.txt b/Tests/LibWeb/Text/expected/display_list/iframe-compositor-surface.txt
index ae94d84eb76..65626a615d8 100644
--- a/Tests/LibWeb/Text/expected/display_list/iframe-compositor-surface.txt
+++ b/Tests/LibWeb/Text/expected/display_list/iframe-compositor-surface.txt
@@ -5,8 +5,8 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
- [L0] base space=viewport
+Layers (for a window server that shows tiles and filters what is below layers):
+ [L0] base space=viewport held by the frame: it is under a layer the frame holds
[L1] composited context #0 space=viewport region=[0,0 123x83]
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/iframe-in-svg-mask-and-pattern.txt b/Tests/LibWeb/Text/expected/display_list/iframe-in-svg-mask-and-pattern.txt
index e197d5e7f25..f81d74624a0 100644
--- a/Tests/LibWeb/Text/expected/display_list/iframe-in-svg-mask-and-pattern.txt
+++ b/Tests/LibWeb/Text/expected/display_list/iframe-in-svg-mask-and-pattern.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
[e1 in s2 out=c0] mask=[0,0 100x100] kind=luminance origin=svg-mask (SVGGeometryBox<rect>)
[e2 in s2 out=c0] mask=[200,0 100x100] kind=luminance origin=svg-mask (SVGGeometryBox<rect>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/image-object-fit-cover-clip.txt b/Tests/LibWeb/Text/expected/display_list/image-object-fit-cover-clip.txt
index 8139c25ae61..ed5dd401d61 100644
--- a/Tests/LibWeb/Text/expected/display_list/image-object-fit-cover-clip.txt
+++ b/Tests/LibWeb/Text/expected/display_list/image-object-fit-cover-clip.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/input-caret.txt b/Tests/LibWeb/Text/expected/display_list/input-caret.txt
index d58e7e08b52..aad32c81734 100644
--- a/Tests/LibWeb/Text/expected/display_list/input-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/input-caret.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt b/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
index 99552ddc419..0f0a55f8c55 100644
--- a/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/jsonl-dump-is-one-json-object-per-line.txt b/Tests/LibWeb/Text/expected/display_list/jsonl-dump-is-one-json-object-per-line.txt
index a5034c6cc6b..e3445967919 100644
--- a/Tests/LibWeb/Text/expected/display_list/jsonl-dump-is-one-json-object-per-line.txt
+++ b/Tests/LibWeb/Text/expected/display_list/jsonl-dump-is-one-json-object-per-line.txt
@@ -7,7 +7,7 @@ record ids count up from 1: true
{"type":"node","kind":"effect","name":"e0","raw":0,"depth":0,"space":"s0","description":"effects=[]"}
{"type":"node","kind":"effect","name":"e1","raw":1,"depth":1,"parent":"e0","space":"s1","description":"mask=[700,20 50x50] kind=alpha origin=css-mask-layers","owner":"BlockContainer<DIV>#masked"}
{"type":"layer","name":"L0","line":"[L0] base space=viewport","records":[[2,5]]}
-{"type":"layer","name":"L1","line":"[L1] canvas #0 space=viewport region=[17,17 206x126] shown by the window server: clip=[0,0 800x600]","records":[[1,1]]}
+{"type":"layer","name":"L1","line":"[L1] canvas #0 space=viewport region=[17,17 206x126] can be shown by the window server: clip=[0,0 800x600]","records":[[1,1]]}
{"type":"layer","name":"L2","line":"[L2] painted space=viewport above L1","records":[[6,6]]}
{"type":"record","id":2,"op":"FillRect","depth":0,"layer":"L0","chunk":"k1","context":{"spatial":{"name":"s2","raw":2},"effect":{"name":"e0","raw":0}},"fields":{"rect":[600,20,50,50],"color":"#008000ff"},"owner":"BlockContainer<DIV>#transformed","phase":"background"}
{"type":"record","id":3,"op":"DeclareMaskContent","depth":0,"layer":"L0","chunk":"k1","context":{"spatial":{"name":"s1","raw":1},"effect":{"name":"e1","raw":1}},"fields":{"rect":[700,20,50,50],"effect":{"name":"e1","raw":1}},"owner":"BlockContainer<DIV>#masked","phase":"preamble"}
diff --git a/Tests/LibWeb/Text/expected/display_list/mask-image-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/mask-image-invalidation.txt
index 696982446ef..f4d8ebfdda7 100644
--- a/Tests/LibWeb/Text/expected/display_list/mask-image-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/mask-image-invalidation.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] mask=[8,8 100x100] kind=alpha origin=css-mask-layers (BlockContainer<DIV>#box.box)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -24,7 +24,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -40,7 +40,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] mask=[8,8 100x100] kind=alpha origin=css-mask-layers (BlockContainer<DIV>#box.box)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/mask-type-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/mask-type-invalidation.txt
index dbfa77c66eb..7f8f340cf7c 100644
--- a/Tests/LibWeb/Text/expected/display_list/mask-type-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/mask-type-invalidation.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s2 out=c0] mask=[-10,-10 120x120] kind=alpha origin=svg-mask (SVGGeometryBox<rect>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -30,7 +30,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s2 out=c0] mask=[-10,-10 120x120] kind=luminance origin=svg-mask (SVGGeometryBox<rect>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/mix-blend-mode-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/mix-blend-mode-invalidation.txt
index 9e1e9084f69..faba422bc7d 100644
--- a/Tests/LibWeb/Text/expected/display_list/mix-blend-mode-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/mix-blend-mode-invalidation.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -21,7 +21,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[blend_mode=Multiply] (BlockContainer<DIV>#box)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
e1 is not composited: it reads only its own layer
diff --git a/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt b/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt
index 6370d572082..85fec4a188d 100644
--- a/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt
+++ b/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt
@@ -12,7 +12,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[119,9 100x100] min_scroll_offset=[0,0] max_scroll_offset=[50,50] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [119,9 100x100] of viewport
[L2] painted space=viewport above band 0 of scroller@s2 in viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/multiline-inline-color-change-inside-opacity.txt b/Tests/LibWeb/Text/expected/display_list/multiline-inline-color-change-inside-opacity.txt
index 8f7372ae61a..7035a518261 100644
--- a/Tests/LibWeb/Text/expected/display_list/multiline-inline-color-change-inside-opacity.txt
+++ b/Tests/LibWeb/Text/expected/display_list/multiline-inline-color-change-inside-opacity.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[opacity=0.5] (InlineNode<SPAN>#outer)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -29,7 +29,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[562.9844,0] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
@@ -41,7 +41,7 @@ L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=39 rect=[8,137 264x13] glyph_bounding
L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=10 rect=[8,150 62x13] glyph_bounding_rect=[8,150 69x12] translation=[8,160] color=rgb(0, 0, 0) text=" effects:" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=25 rect=[8,163 162x13] glyph_bounding_rect=[8,163 166x12] translation=[8,173] color=rgb(0, 0, 0) text=" [e0 in s0] effects=[]" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=63 rect=[8,176 417x13] glyph_bounding_rect=[8,176 423x12] translation=[8,186] color=rgb(0, 0, 0) text=" [e1 in s1] effects=[opacity=0.5] (…" text_length=63 owner=BlockContainer<PRE>#out phase=foreground
-L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=7 rect=[8,202 48x13] glyph_bounding_rect=[8,202 55x12] translation=[8,212] color=rgb(0, 0, 0) text="Layers:" owner=BlockContainer<PRE>#out phase=foreground
+L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=79 rect=[8,202 527x13] glyph_bounding_rect=[8,202 535x12] translation=[8,212] color=rgb(0, 0, 0) text="Layers (for a window server that shows t…" text_length=79 owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=26 rect=[8,215 183x13] glyph_bounding_rect=[8,215 188x12] translation=[8,225] color=rgb(0, 0, 0) text=" [L0] base space=viewport" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=12 rect=[8,241 74x13] glyph_bounding_rect=[8,241 81x12] translation=[8,251] color=rgb(0, 0, 0) text="DisplayList:" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font1 glyphs=195 rect=[8,254 1330x13] glyph_bounding_rect=[8,254 1334x12] translation=[8,264] color=rgb(0, 0, 0) text="L0 DrawGlyphRun@s1/e0 font_id=font1 glyp…" text_length=195 owner=BlockContainer<PRE>#out phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/multiline-inline-opacity.txt b/Tests/LibWeb/Text/expected/display_list/multiline-inline-opacity.txt
index ca211f28826..147c0a5e1ff 100644
--- a/Tests/LibWeb/Text/expected/display_list/multiline-inline-opacity.txt
+++ b/Tests/LibWeb/Text/expected/display_list/multiline-inline-opacity.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s1] effects=[opacity=0.5] (InlineNode<SPAN>#target)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -32,7 +32,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[580.1875,0] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
@@ -52,7 +52,7 @@ L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=39 rect=[8,137 264x13] glyph_bounding
L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=10 rect=[8,150 62x13] glyph_bounding_rect=[8,150 69x12] translation=[8,160] color=rgb(0, 0, 0) text=" effects:" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=25 rect=[8,163 162x13] glyph_bounding_rect=[8,163 166x12] translation=[8,173] color=rgb(0, 0, 0) text=" [e0 in s0] effects=[]" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=64 rect=[8,176 419x13] glyph_bounding_rect=[8,176 426x12] translation=[8,186] color=rgb(0, 0, 0) text=" [e1 in s1] effects=[opacity=0.5] (…" text_length=64 owner=BlockContainer<PRE>#out phase=foreground
-L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=7 rect=[8,202 48x13] glyph_bounding_rect=[8,202 55x12] translation=[8,212] color=rgb(0, 0, 0) text="Layers:" owner=BlockContainer<PRE>#out phase=foreground
+L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=79 rect=[8,202 527x13] glyph_bounding_rect=[8,202 535x12] translation=[8,212] color=rgb(0, 0, 0) text="Layers (for a window server that shows t…" text_length=79 owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=26 rect=[8,215 183x13] glyph_bounding_rect=[8,215 188x12] translation=[8,225] color=rgb(0, 0, 0) text=" [L0] base space=viewport" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=12 rect=[8,241 74x13] glyph_bounding_rect=[8,241 81x12] translation=[8,251] color=rgb(0, 0, 0) text="DisplayList:" owner=BlockContainer<PRE>#out phase=foreground
L1 DrawGlyphRun@s1/e0 font_id=font2 glyphs=202 rect=[8,254 1373x13] glyph_bounding_rect=[8,254 1377x12] translation=[8,264] color=rgb(0, 0, 0) text="L0 DrawGlyphRun@s1/e0 font_id=font1 glyp…" text_length=202 owner=BlockContainer<PRE>#out phase=foreground
diff --git a/Tests/LibWeb/Text/expected/display_list/multiline-inline-paint-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/multiline-inline-paint-invalidation.txt
index 256c32fcb4b..34d43404b56 100644
--- a/Tests/LibWeb/Text/expected/display_list/multiline-inline-paint-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/multiline-inline-paint-invalidation.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -27,7 +27,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/nested-branches.txt b/Tests/LibWeb/Text/expected/display_list/nested-branches.txt
index ca9ee7cae3d..4b66263835d 100644
--- a/Tests/LibWeb/Text/expected/display_list/nested-branches.txt
+++ b/Tests/LibWeb/Text/expected/display_list/nested-branches.txt
@@ -13,7 +13,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt b/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt
index f9c351ed77a..f51eb257b8b 100644
--- a/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt
+++ b/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt
@@ -14,7 +14,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[10,10 200x150] min_scroll_offset=[0,0] max_scroll_offset=[102,0] is_viewport=false
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s2 scrollport_rect=[11,11 300x100] min_scroll_offset=[0,0] max_scroll_offset=[100,0] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [10,10 200x150] of viewport
[L2] painted space=scroller@s3 in scroller@s2 in viewport composited within [10,10 200x150] of viewport composited within [11,11 300x100] of scroller@s2 in viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/opaque-background-image-blend.txt b/Tests/LibWeb/Text/expected/display_list/opaque-background-image-blend.txt
index 5a4fe1bf572..bb46011d8d0 100644
--- a/Tests/LibWeb/Text/expected/display_list/opaque-background-image-blend.txt
+++ b/Tests/LibWeb/Text/expected/display_list/opaque-background-image-blend.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt b/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt
index ed1205191f3..7b32584838f 100644
--- a/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt
+++ b/Tests/LibWeb/Text/expected/display_list/page-focus-rendering.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -37,7 +37,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -65,7 +65,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -94,7 +94,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -121,7 +121,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -146,7 +146,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/patterned-border-on-a-short-side.txt b/Tests/LibWeb/Text/expected/display_list/patterned-border-on-a-short-side.txt
index 81ee468f0ba..e1efbac31ca 100644
--- a/Tests/LibWeb/Text/expected/display_list/patterned-border-on-a-short-side.txt
+++ b/Tests/LibWeb/Text/expected/display_list/patterned-border-on-a-short-side.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/patterned-border-sharing-corners.txt b/Tests/LibWeb/Text/expected/display_list/patterned-border-sharing-corners.txt
index 8e59b63fa47..f1cbada8c06 100644
--- a/Tests/LibWeb/Text/expected/display_list/patterned-border-sharing-corners.txt
+++ b/Tests/LibWeb/Text/expected/display_list/patterned-border-sharing-corners.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/perspective-basic.txt b/Tests/LibWeb/Text/expected/display_list/perspective-basic.txt
index 4c717ca0113..11d9ac3c6f5 100644
--- a/Tests/LibWeb/Text/expected/display_list/perspective-basic.txt
+++ b/Tests/LibWeb/Text/expected/display_list/perspective-basic.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/perspective-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/perspective-invalidation.txt
index 99d6d9c940f..9425e5da0b9 100644
--- a/Tests/LibWeb/Text/expected/display_list/perspective-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/perspective-invalidation.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -23,7 +23,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/positioned-with-transformed-ancestor.txt b/Tests/LibWeb/Text/expected/display_list/positioned-with-transformed-ancestor.txt
index 2d09cb040c5..d2d34e1cc9e 100644
--- a/Tests/LibWeb/Text/expected/display_list/positioned-with-transformed-ancestor.txt
+++ b/Tests/LibWeb/Text/expected/display_list/positioned-with-transformed-ancestor.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/record-ids-number-nested-records-and-name-layer-records.txt b/Tests/LibWeb/Text/expected/display_list/record-ids-number-nested-records-and-name-layer-records.txt
index fd6908db4b3..369b499b7fc 100644
--- a/Tests/LibWeb/Text/expected/display_list/record-ids-number-nested-records-and-name-layer-records.txt
+++ b/Tests/LibWeb/Text/expected/display_list/record-ids-number-nested-records-and-name-layer-records.txt
@@ -1,6 +1,6 @@
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport records=#1,#3-#6
- [L1] canvas #0 space=viewport region=[17,17 206x126] records=#2 shown by the window server: clip=[0,0 800x600]
+ [L1] canvas #0 space=viewport region=[17,17 206x126] records=#2 can be shown by the window server: clip=[0,0 800x600]
[L2] painted space=viewport above L1 records=#6
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/relative-with-inline-transformed-intermediate.txt b/Tests/LibWeb/Text/expected/display_list/relative-with-inline-transformed-intermediate.txt
index 37fc7609d93..408f123ea26 100644
--- a/Tests/LibWeb/Text/expected/display_list/relative-with-inline-transformed-intermediate.txt
+++ b/Tests/LibWeb/Text/expected/display_list/relative-with-inline-transformed-intermediate.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/repeated-svg-background-is-tile.txt b/Tests/LibWeb/Text/expected/display_list/repeated-svg-background-is-tile.txt
index 652c0a24894..5417343c49e 100644
--- a/Tests/LibWeb/Text/expected/display_list/repeated-svg-background-is-tile.txt
+++ b/Tests/LibWeb/Text/expected/display_list/repeated-svg-background-is-tile.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/root-background-absolutely-positioned-overflow.txt b/Tests/LibWeb/Text/expected/display_list/root-background-absolutely-positioned-overflow.txt
index ff1a94de455..d87b5c8d383 100644
--- a/Tests/LibWeb/Text/expected/display_list/root-background-absolutely-positioned-overflow.txt
+++ b/Tests/LibWeb/Text/expected/display_list/root-background-absolutely-positioned-overflow.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,2400] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/root-background-propagation-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/root-background-propagation-invalidation.txt
index 3a613245f69..72f4260c508 100644
--- a/Tests/LibWeb/Text/expected/display_list/root-background-propagation-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/root-background-propagation-invalidation.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -23,7 +23,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -40,7 +40,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/scroll-node-of-box-with-nothing-to-scroll-that-keeps-its-scrolls.txt b/Tests/LibWeb/Text/expected/display_list/scroll-node-of-box-with-nothing-to-scroll-that-keeps-its-scrolls.txt
index 928cfb889d7..2b9bd5ac4ab 100644
--- a/Tests/LibWeb/Text/expected/display_list/scroll-node-of-box-with-nothing-to-scroll-that-keeps-its-scrolls.txt
+++ b/Tests/LibWeb/Text/expected/display_list/scroll-node-of-box-with-nothing-to-scroll-that-keeps-its-scrolls.txt
@@ -12,7 +12,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[0,0] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
index 9be153c6c75..6f296860efb 100644
--- a/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
@@ -11,7 +11,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[33,33 180x100] min_scroll_offset=[0,0] max_scroll_offset=[120,100] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [33,33 180x100] of viewport
[L2] painted space=viewport above band 0 of scroller@s2 in viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/selection-highlight-painting-order.txt b/Tests/LibWeb/Text/expected/display_list/selection-highlight-painting-order.txt
index 464962adaa0..2f1005d707e 100644
--- a/Tests/LibWeb/Text/expected/display_list/selection-highlight-painting-order.txt
+++ b/Tests/LibWeb/Text/expected/display_list/selection-highlight-painting-order.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/selection-vertical-writing-mode.txt b/Tests/LibWeb/Text/expected/display_list/selection-vertical-writing-mode.txt
index 3b0840c139c..dc5651c90ac 100644
--- a/Tests/LibWeb/Text/expected/display_list/selection-vertical-writing-mode.txt
+++ b/Tests/LibWeb/Text/expected/display_list/selection-vertical-writing-mode.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/sibling-overflow-containers.txt b/Tests/LibWeb/Text/expected/display_list/sibling-overflow-containers.txt
index eb65a163904..122d1fa2bd1 100644
--- a/Tests/LibWeb/Text/expected/display_list/sibling-overflow-containers.txt
+++ b/Tests/LibWeb/Text/expected/display_list/sibling-overflow-containers.txt
@@ -14,7 +14,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[9,9 100x80] min_scroll_offset=[0,0] max_scroll_offset=[50,40] is_viewport=false
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[131,9 100x80] min_scroll_offset=[0,0] max_scroll_offset=[50,40] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [9,9 100x80] of viewport
[L2] painted space=viewport above band 0 of scroller@s2 in viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
index 20483fbf4a1..e60a09e5a71 100644
--- a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
@@ -17,7 +17,7 @@ ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[223
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[326,23 92x150] min_scroll_offset=[0,0] max_scroll_offset=[108.65625,150] is_viewport=false
ScrollNode scroll_node_index=s4 parent_scroll_node_index=s0 scrollport_rect=[430,23 91x150] min_scroll_offset=[0,0] max_scroll_offset=[108.671875,150] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [223,23 91x150] of viewport
[L2] painted space=viewport above band 0 of scroller@s2 in viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/sibling-transforms.txt b/Tests/LibWeb/Text/expected/display_list/sibling-transforms.txt
index f6b74b93f5a..999f2265dd7 100644
--- a/Tests/LibWeb/Text/expected/display_list/sibling-transforms.txt
+++ b/Tests/LibWeb/Text/expected/display_list/sibling-transforms.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/simple-overflow-hidden.txt b/Tests/LibWeb/Text/expected/display_list/simple-overflow-hidden.txt
index 55bc079bfef..768455ee84b 100644
--- a/Tests/LibWeb/Text/expected/display_list/simple-overflow-hidden.txt
+++ b/Tests/LibWeb/Text/expected/display_list/simple-overflow-hidden.txt
@@ -11,7 +11,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[10,10 200x100] min_scroll_offset=[0,0] max_scroll_offset=[100,50] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [10,10 200x100] of viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/solid-border-edge-before-a-groove-edge.txt b/Tests/LibWeb/Text/expected/display_list/solid-border-edge-before-a-groove-edge.txt
index 8efbfae7f8a..01bbb31787f 100644
--- a/Tests/LibWeb/Text/expected/display_list/solid-border-edge-before-a-groove-edge.txt
+++ b/Tests/LibWeb/Text/expected/display_list/solid-border-edge-before-a-groove-edge.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/solid-border-edges-with-a-dashed-edge.txt b/Tests/LibWeb/Text/expected/display_list/solid-border-edges-with-a-dashed-edge.txt
index a14dc02e2bd..68cda67e274 100644
--- a/Tests/LibWeb/Text/expected/display_list/solid-border-edges-with-a-dashed-edge.txt
+++ b/Tests/LibWeb/Text/expected/display_list/solid-border-edges-with-a-dashed-edge.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-mask-after-relayout.txt b/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-mask-after-relayout.txt
index 85f5e7eef2f..0f86c530dba 100644
--- a/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-mask-after-relayout.txt
+++ b/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-mask-after-relayout.txt
@@ -11,7 +11,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s3 out=c0] mask=[-10,-10 120x120] kind=luminance origin=svg-mask (SVGForeignObjectBox<foreignObject>#fo)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt b/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt
index 74f17682f87..36939949fbd 100644
--- a/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt
+++ b/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt
@@ -14,7 +14,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[0,0 80x80] min_scroll_offset=[0,0] max_scroll_offset=[0,220] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/svg-in-img-is-recorded-without-visual-contexts.txt b/Tests/LibWeb/Text/expected/display_list/svg-in-img-is-recorded-without-visual-contexts.txt
index edcb75fbc38..31893dbc793 100644
--- a/Tests/LibWeb/Text/expected/display_list/svg-in-img-is-recorded-without-visual-contexts.txt
+++ b/Tests/LibWeb/Text/expected/display_list/svg-in-img-is-recorded-without-visual-contexts.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/svg-overflow-on-inner-elements.txt b/Tests/LibWeb/Text/expected/display_list/svg-overflow-on-inner-elements.txt
index e9c686039dc..7cc9cdd10f3 100644
--- a/Tests/LibWeb/Text/expected/display_list/svg-overflow-on-inner-elements.txt
+++ b/Tests/LibWeb/Text/expected/display_list/svg-overflow-on-inner-elements.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/svg-transform-with-opacity.txt b/Tests/LibWeb/Text/expected/display_list/svg-transform-with-opacity.txt
index e21dc8e4589..478f58ffe84 100644
--- a/Tests/LibWeb/Text/expected/display_list/svg-transform-with-opacity.txt
+++ b/Tests/LibWeb/Text/expected/display_list/svg-transform-with-opacity.txt
@@ -10,7 +10,7 @@ AccumulatedVisualContext Tree:
[e0 in s0] effects=[]
[e1 in s2 out=c0] effects=[opacity=0.5] (SVGGeometryBox<rect>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/text-decoration-thin-lines-cover-whole-pixels.txt b/Tests/LibWeb/Text/expected/display_list/text-decoration-thin-lines-cover-whole-pixels.txt
index 3e6e6318499..7953174182a 100644
--- a/Tests/LibWeb/Text/expected/display_list/text-decoration-thin-lines-cover-whole-pixels.txt
+++ b/Tests/LibWeb/Text/expected/display_list/text-decoration-thin-lines-cover-whole-pixels.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/text-decoration-underline-partial-selection.txt b/Tests/LibWeb/Text/expected/display_list/text-decoration-underline-partial-selection.txt
index 9f890b8c4aa..2d53415438d 100644
--- a/Tests/LibWeb/Text/expected/display_list/text-decoration-underline-partial-selection.txt
+++ b/Tests/LibWeb/Text/expected/display_list/text-decoration-underline-partial-selection.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/text-input-clip-is-not-rounded.txt b/Tests/LibWeb/Text/expected/display_list/text-input-clip-is-not-rounded.txt
index 8c4b88efcf9..658ce76203c 100644
--- a/Tests/LibWeb/Text/expected/display_list/text-input-clip-is-not-rounded.txt
+++ b/Tests/LibWeb/Text/expected/display_list/text-input-clip-is-not-rounded.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/text-shadow-multiple-layers.txt b/Tests/LibWeb/Text/expected/display_list/text-shadow-multiple-layers.txt
index 35976fd81cc..16ea6dbac63 100644
--- a/Tests/LibWeb/Text/expected/display_list/text-shadow-multiple-layers.txt
+++ b/Tests/LibWeb/Text/expected/display_list/text-shadow-multiple-layers.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/text-shadow-vertical-writing-mode.txt b/Tests/LibWeb/Text/expected/display_list/text-shadow-vertical-writing-mode.txt
index bc399dbb236..3c0aeee0f21 100644
--- a/Tests/LibWeb/Text/expected/display_list/text-shadow-vertical-writing-mode.txt
+++ b/Tests/LibWeb/Text/expected/display_list/text-shadow-vertical-writing-mode.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt b/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt
index 759067bbdaa..c023788155a 100644
--- a/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/textarea-caret.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/three-way-branch.txt b/Tests/LibWeb/Text/expected/display_list/three-way-branch.txt
index 007b48bb3bd..5339502fc0e 100644
--- a/Tests/LibWeb/Text/expected/display_list/three-way-branch.txt
+++ b/Tests/LibWeb/Text/expected/display_list/three-way-branch.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/transform-basic.txt b/Tests/LibWeb/Text/expected/display_list/transform-basic.txt
index e6cf5c42b5f..4aa1e08c7ab 100644
--- a/Tests/LibWeb/Text/expected/display_list/transform-basic.txt
+++ b/Tests/LibWeb/Text/expected/display_list/transform-basic.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/transform-invertibility-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/transform-invertibility-invalidation.txt
index 5f89be9d5fd..f963afeebb1 100644
--- a/Tests/LibWeb/Text/expected/display_list/transform-invertibility-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/transform-invertibility-invalidation.txt
@@ -3,7 +3,7 @@ AccumulatedVisualContext Tree:
spatial:
[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] single layer replaying the whole list: empty display list
DisplayList:
@@ -17,7 +17,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/transform-nested.txt b/Tests/LibWeb/Text/expected/display_list/transform-nested.txt
index 0728544c762..f04664762e7 100644
--- a/Tests/LibWeb/Text/expected/display_list/transform-nested.txt
+++ b/Tests/LibWeb/Text/expected/display_list/transform-nested.txt
@@ -7,7 +7,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/transform-with-clip.txt b/Tests/LibWeb/Text/expected/display_list/transform-with-clip.txt
index d84399f76a4..fc365808664 100644
--- a/Tests/LibWeb/Text/expected/display_list/transform-with-clip.txt
+++ b/Tests/LibWeb/Text/expected/display_list/transform-with-clip.txt
@@ -12,7 +12,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[10,10 150x150] min_scroll_offset=[0,0] max_scroll_offset=[70,70] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
[L1] painted space=scroller@s2 in viewport composited within [10,10 150x150] of viewport
diff --git a/Tests/LibWeb/Text/expected/display_list/uniform-solid-border-ring.txt b/Tests/LibWeb/Text/expected/display_list/uniform-solid-border-ring.txt
index e5ec1c5e8a6..dca303cbcb0 100644
--- a/Tests/LibWeb/Text/expected/display_list/uniform-solid-border-ring.txt
+++ b/Tests/LibWeb/Text/expected/display_list/uniform-solid-border-ring.txt
@@ -8,7 +8,7 @@ AccumulatedVisualContext Tree:
ScrollNodes:
ScrollNode scroll_node_index=s1 parent_scroll_node_index=s0 scrollport_rect=[0,0 800x600] min_scroll_offset=[0,0] max_scroll_offset=[0,20] is_viewport=true
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L1] base space=document
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/will-change-visual-context-nodes.txt b/Tests/LibWeb/Text/expected/display_list/will-change-visual-context-nodes.txt
index 5bc6570d635..a75e43dc948 100644
--- a/Tests/LibWeb/Text/expected/display_list/will-change-visual-context-nodes.txt
+++ b/Tests/LibWeb/Text/expected/display_list/will-change-visual-context-nodes.txt
@@ -9,7 +9,7 @@ AccumulatedVisualContext Tree:
[e1 in s1] effects=[] (BlockContainer<DIV>#opacity)
[e2 in s1] effects=[] (BlockContainer<DIV>#filter)
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/z-index-change-no-double-paint.txt b/Tests/LibWeb/Text/expected/display_list/z-index-change-no-double-paint.txt
index 4d8488202c3..b5b9471d6f1 100644
--- a/Tests/LibWeb/Text/expected/display_list/z-index-change-no-double-paint.txt
+++ b/Tests/LibWeb/Text/expected/display_list/z-index-change-no-double-paint.txt
@@ -6,7 +6,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -20,7 +20,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/display_list/zero-area-clip-commands.txt b/Tests/LibWeb/Text/expected/display_list/zero-area-clip-commands.txt
index a0c5edc4352..812198c3d3e 100644
--- a/Tests/LibWeb/Text/expected/display_list/zero-area-clip-commands.txt
+++ b/Tests/LibWeb/Text/expected/display_list/zero-area-clip-commands.txt
@@ -15,7 +15,7 @@ ScrollNodes:
ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[8,8 0x100] min_scroll_offset=[0,0] max_scroll_offset=[50,0] is_viewport=false
ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[8,108 100x0] min_scroll_offset=[0,0] max_scroll_offset=[0,50] is_viewport=false
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/text-transform-contextual-selection-offset-mapping.txt b/Tests/LibWeb/Text/expected/text-transform-contextual-selection-offset-mapping.txt
index 4b23e964657..a1e7d954ca4 100644
--- a/Tests/LibWeb/Text/expected/text-transform-contextual-selection-offset-mapping.txt
+++ b/Tests/LibWeb/Text/expected/text-transform-contextual-selection-offset-mapping.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/expected/text-transform-selection-offset-mapping.txt b/Tests/LibWeb/Text/expected/text-transform-selection-offset-mapping.txt
index b600f28ecf7..5766571c1fc 100644
--- a/Tests/LibWeb/Text/expected/text-transform-selection-offset-mapping.txt
+++ b/Tests/LibWeb/Text/expected/text-transform-selection-offset-mapping.txt
@@ -5,7 +5,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
@@ -21,7 +21,7 @@ AccumulatedVisualContext Tree:
effects:
[e0 in s0] effects=[]
-Layers:
+Layers (for a window server that shows tiles and filters what is below layers):
[L0] base space=viewport
DisplayList:
diff --git a/Tests/LibWeb/Text/input/display_list/compositing-layers-backdrop-filter-without-window-server-equivalent.html b/Tests/LibWeb/Text/input/display_list/compositing-layers-backdrop-filter-without-window-server-equivalent.html
new file mode 100644
index 00000000000..6243f9070d2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/display_list/compositing-layers-backdrop-filter-without-window-server-equivalent.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body { margin: 0; height: 3000px; }
+ #scroller { width: 200px; height: 100px; margin: 20px; overflow: auto; background: white; }
+ #scroller div { height: 400px; background: linear-gradient(orange, purple); }
+ #shadowing { position: fixed; left: 100px; top: 40px; width: 200px; height: 40px; background: rgba(0, 0, 128, 0.5); backdrop-filter: drop-shadow(4px 4px 4px black); }
+</style>
+<div id="scroller"><div></div></div>
+<div id="shadowing"></div>
+<script>
+ test(() => {
+ println(internals.dumpDisplayList().split("\nDisplayList:")[0]);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/display_list/compositing-layers-effect-out-of-view-holds-no-layer-in-frame.html b/Tests/LibWeb/Text/input/display_list/compositing-layers-effect-out-of-view-holds-no-layer-in-frame.html
new file mode 100644
index 00000000000..7525c414021
--- /dev/null
+++ b/Tests/LibWeb/Text/input/display_list/compositing-layers-effect-out-of-view-holds-no-layer-in-frame.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body { margin: 0; height: 3000px; }
+ #scroller { width: 200px; height: 100px; margin: 20px; overflow: auto; background: white; }
+ #scroller div { height: 400px; background: linear-gradient(orange, purple); }
+ canvas { position: absolute; left: 20px; top: 1500px; }
+ #blending { position: absolute; left: 60px; top: 1540px; width: 100px; height: 40px; background: orange; mix-blend-mode: multiply; }
+</style>
+<div id="scroller"><div></div></div>
+<canvas id="canvas" width="200" height="120"></canvas>
+<div id="blending"></div>
+<script>
+ function layersOfDump() {
+ const dump = internals.dumpDisplayList();
+ return dump.slice(dump.indexOf("\nLayers") + 1, dump.indexOf("\nDisplayList:"));
+ }
+
+ asyncTest(async done => {
+ const context = canvas.getContext("2d");
+ context.fillStyle = "blue";
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ println("With the blending box below the viewport:");
+ println(layersOfDump());
+ window.scrollTo(0, 1400);
+ await animationFrame();
+ await animationFrame();
+ println("With the blending box in the viewport:");
+ println(layersOfDump());
+ done();
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/display_list/compositing-layers-frosted-sticky-header.html b/Tests/LibWeb/Text/input/display_list/compositing-layers-frosted-sticky-header.html
new file mode 100644
index 00000000000..9ec48845ae9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/display_list/compositing-layers-frosted-sticky-header.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body { margin: 0; height: 3000px; }
+ #header { position: sticky; top: 0; height: 40px; background: rgba(0, 0, 128, 0.5); backdrop-filter: blur(8px) saturate(150%); }
+ #scroller { width: 200px; height: 100px; margin: 20px; overflow: auto; border-radius: 12px; background: white; }
+ #scroller div { height: 400px; background: linear-gradient(orange, purple); }
+</style>
+<div id="header">Header</div>
+<div id="scroller"><div></div></div>
+<script>
+ test(() => {
+ println(internals.dumpDisplayList().split("\nDisplayList:")[0]);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/display_list/record-ids-number-nested-records-and-name-layer-records.html b/Tests/LibWeb/Text/input/display_list/record-ids-number-nested-records-and-name-layer-records.html
index bcfcf7f450c..8d40df77366 100644
--- a/Tests/LibWeb/Text/input/display_list/record-ids-number-nested-records-and-name-layer-records.html
+++ b/Tests/LibWeb/Text/input/display_list/record-ids-number-nested-records-and-name-layer-records.html
@@ -17,6 +17,6 @@
context.fillStyle = "blue";
context.fillRect(0, 0, canvas.width, canvas.height);
const dump = internals.dumpDisplayList({ recordIds: true });
- println(dump.slice(dump.indexOf("Layers:")));
+ println(dump.slice(dump.indexOf("\nLayers") + 1));
});
</script>