Bug 1836063 - Add invalidation regression test r=gfx-reviewers,gw

Add a regression test for picture cache invalidation caused by scrolling
content with opacity-filtered stacking contexts.  This test ensures that
picture cache tiles are not invalidated by scrolling when such
sub-pictures are present, which was the problem in bug 1836063.

Depends on D181664

Differential Revision: https://phabricator.services.mozilla.com/D182496
This commit is contained in:
David Turner 2023-07-13 19:42:21 +00:00
parent 731133fa2d
commit da07fe271f
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,29 @@
# This is intended to be a really simple imitation of what Gecko's
# display-list around the content scrolling viewport. In addition to the
# scroll-frame's clip (added by clip-to-frame) it also adds equivalent clips
# to everything inside, including inside the stacking context. The stacking
# context with partial opacity acts as a regression test for bug 1836063.
root:
items:
- type: clip
id: 2
bounds: [0, 0, 50, 50]
- type: clip-chain
id: 3
clips: [2]
- type: scroll-frame
bounds: [0, 0, 50, 50]
scroll-offset: [0, 0]
clip-to-frame: true
items:
- type: stacking-context
bounds: [0, 0, 100, 500]
filters: [opacity(0.9)]
clip-chain: 3
items:
- type: rect
bounds: [0, 0, 100, 500]
color: green
clip-chain: 3

View File

@ -0,0 +1,26 @@
# This file should be identical to scroll_subpic_1.yaml except for the
# scroll-offset on the scroll-frame.
root:
items:
- type: clip
id: 2
bounds: [0, 0, 50, 50]
- type: clip-chain
id: 3
clips: [2]
- type: scroll-frame
bounds: [0, 0, 50, 50]
scroll-offset: [0, 10]
clip-to-frame: true
items:
- type: stacking-context
bounds: [0, 0, 100, 500]
filters: [opacity(0.9)]
clip-chain: 3
items:
- type: rect
bounds: [0, 0, 100, 500]
color: green
clip-chain: 3

View File

@ -50,6 +50,7 @@ impl<'a> TestHarness<'a> {
// List all invalidation tests here
self.test_basic();
self.test_composite_nop();
self.test_scroll_subpic();
}
/// Simple validation / proof of concept of invalidation testing
@ -105,6 +106,29 @@ impl<'a> TestHarness<'a> {
assert!(results.composite_needed);
}
/// Ensure that tile cache pictures are not invalidated upon scrolling
fn test_scroll_subpic(
&mut self,
) {
// First frame at scroll-offset 0
let results = self.render_yaml("scroll_subpic_1");
// Ensure we actually rendered something
assert!(
matches!(results.pc_debug.slice(0).tile(0, 0), TileDebugInfo::Dirty(..)),
"Ensure the first test frame actually rendered something",
);
// Second frame just scrolls to scroll-offset 50
let results = self.render_yaml("scroll_subpic_2");
// Ensure the cache tile was not invalidated
assert!(
results.pc_debug.slice(0).tile(0, 0).is_valid(),
"Ensure the cache tile was not invalidated after scrolling",
);
}
/// Render a YAML file, and return the picture cache debug info
fn render_yaml(
&mut self,