Bug 1704478 - Ensure clips are applied to root level blend containers. r=gfx-reviewers,lsalzman

When a root level blend container matches the criteria to be optimized
from a stacking context to a tile cache, we need to ensure that if
the source stacking context had any valid clips, they are propagated
to the shared clips applied by the tile cache.

Differential Revision: https://phabricator.services.mozilla.com/D111988
This commit is contained in:
Glenn Watson 2021-04-14 05:18:31 +00:00
Родитель ff0500f7e3
Коммит b541551129
5 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -1999,6 +1999,7 @@ impl<'a> SceneBuilder<'a> {
{
self.tile_cache_builder.add_tile_cache(
stacking_context.prim_list,
stacking_context.clip_chain_id,
&self.spatial_tree,
&self.clip_store,
self.interners,

Просмотреть файл

@ -112,6 +112,7 @@ impl TileCacheBuilder {
pub fn add_tile_cache(
&mut self,
prim_list: PrimitiveList,
clip_chain_id: ClipChainId,
spatial_tree: &SpatialTree,
clip_store: &ClipStore,
interners: &Interners,
@ -216,6 +217,22 @@ impl TileCacheBuilder {
}
}
// If a blend-container has any clips on the stacking context we are removing,
// we need to ensure those clips are added to the shared clips applied to the
// tile cache we are creating.
let mut current_clip_chain_id = clip_chain_id;
while current_clip_chain_id != ClipChainId::NONE {
let clip_chain_node = &clip_store
.clip_chain_nodes[current_clip_chain_id.0 as usize];
let clip_node_data = &interners.clip[clip_chain_node.handle];
if let ClipNodeKind::Rectangle = clip_node_data.clip_node_kind {
shared_clips.push(ClipInstance::new(clip_chain_node.handle, clip_chain_node.spatial_node_index));
}
current_clip_chain_id = clip_chain_node.parent_clip_chain_id;
}
// Construct the new tile cache and add to the list to be built
let slice = self.pending_tile_caches.len();

Просмотреть файл

@ -0,0 +1,6 @@
---
root:
items:
- type: rect
bounds: [ 50, 50, 100, 100 ]
color: blue

Просмотреть файл

@ -0,0 +1,15 @@
# Verify that clip-chains are correctly applied to root level blend containers (which get
# optimized to be tile caches).
---
root:
items:
- type: clip
id: 2
bounds: [ 50, 50, 100, 100 ]
- type: stacking-context
blend-container: true
clip-node: 2
items:
- type: rect
bounds: [ 0, 0, 200, 200 ]
color: blue

Просмотреть файл

@ -18,3 +18,4 @@ color_targets(1) alpha_targets(0) == clip-out-rotation.yaml blank.yaml # Unexpec
== iframe-nested-in-stacking-context.yaml iframe-nested-in-stacking-context-ref.yaml
== clip-rectangle-redundant-sc.yaml clip-rectangle-redundant-sc-ref.yaml
fuzzy(128,707) == clip-filter-raster-root.yaml clip-filter-raster-root-ref.yaml
== blend-container.yaml blend-container-ref.yaml