Bug 1777141 - Support `spatial-id` in wrench yaml files r=gfx-reviewers,lsalzman

Some more work towards removing the use of legacy clipid parenting
in wrench test files. Add support for specifying the spatial id
without also setting the clip parent. Port some more wrench tests
to use spatial-id and/or clip-chain.

Differential Revision: https://phabricator.services.mozilla.com/D150528
This commit is contained in:
Glenn Watson 2022-06-29 19:34:18 +00:00
Родитель fc6d3e181e
Коммит 6672bf7be5
25 изменённых файлов: 82 добавлений и 61 удалений

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

@ -4,7 +4,6 @@ root:
-
bounds: [0, 0, 0, 0]
"clip-rect": [0, 0, 0, 0]
"clip-and-scroll": "root-scroll-node"
"backface-visible": true
type: "stacking-context"
"transform-style": flat
@ -14,14 +13,12 @@ root:
-
bounds: [0, 148, 1368, 588]
"clip-rect": [0, 148, 1368, 588]
"clip-and-scroll": "root-scroll-node"
"backface-visible": true
type: clip
id: 2
-
bounds: [0, 0, 0, 0]
"clip-rect": [0, 0, 0, 0]
"clip-and-scroll": "root-scroll-node"
"backface-visible": true
type: "clip-chain"
id: 3
@ -29,7 +26,7 @@ root:
-
bounds: [16, 164, 16200, 200]
"clip-rect": [40, 188, 1328, 216]
"clip-and-scroll": [2, 3]
clip-chain: 3
"backface-visible": true
type: "box-shadow"
"box-bounds": [16, 164, 16200, 200]
@ -46,7 +43,6 @@ root:
-
bounds: [16, 164, 1352, 200]
"clip-rect": [16, 164, 1352, 200]
"clip-and-scroll": "root-scroll-node"
"backface-visible": true
type: clip
id: 4
@ -62,7 +58,7 @@ root:
-
bounds: [0, 0, 0, 0]
"clip-rect": [0, 0, 0, 0]
"clip-and-scroll": [2, 3]
clip-chain: 3
"backface-visible": true
type: "clip-chain"
id: 5
@ -71,14 +67,14 @@ root:
-
bounds: [16, 164, 16200, 200]
"clip-rect": [16, 164, 16200, 200]
"clip-and-scroll": [4, 5]
clip-chain: 5
"backface-visible": true
type: rect
color: 255 0 255 1.0000
-
bounds: [16, 402, 200, 200]
"clip-rect": [40, 426, 216, 216]
"clip-and-scroll": [2, 3]
clip-chain: 3
"backface-visible": true
type: "box-shadow"
"box-bounds": [16, 402, 200, 200]
@ -95,7 +91,6 @@ root:
-
bounds: [16, 402, 200, 200]
"clip-rect": [16, 402, 200, 200]
"clip-and-scroll": "root-scroll-node"
"backface-visible": true
type: clip
id: 6
@ -111,7 +106,6 @@ root:
-
bounds: [0, 0, 0, 0]
"clip-rect": [0, 0, 0, 0]
"clip-and-scroll": [2, 3]
"backface-visible": true
type: "clip-chain"
id: 7
@ -120,7 +114,7 @@ root:
-
bounds: [16, 402, 200, 200]
"clip-rect": [16, 402, 200, 200]
"clip-and-scroll": [6, 7]
clip-chain: 7
"backface-visible": true
type: rect
color: 0 128 0 1.0000

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

@ -11,9 +11,12 @@ root:
rect: [10, 10, 938, 200]
radius: [97, 97]
"clip-mode": clip
- type: clip-chain
id: 3
clips: [2]
-
bounds: [10, 10, 100, 200]
clip-and-scroll: 2
clip-chain: 3
type: border
width: [100, 50, 100, 50]
border-type: normal

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

@ -21,10 +21,13 @@ root:
type: clip
id: 2
"content-size": [800, 400]
- type: clip-chain
id: 3
clips: [2]
-
bounds: [0, 0, 400, 200]
"clip-rect": [0, 0, 400, 200]
"backface-visible": true
type: rect
clip-and-scroll: 2
clip-chain: 3
color: green

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

@ -18,10 +18,13 @@ root:
"clip-rect": [0, 0, 300, 300]
type: clip
id: 5
- type: clip-chain
id: 6
clips: [5]
-
bounds: [0, 0, 0, 0]
"clip-rect": [0, 0, 0, 0]
clip-and-scroll: 5
clip-chain: 6
type: "stacking-context"
transform: rotate(45) translate(-300, 0)
items:

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

@ -14,7 +14,6 @@ root:
-
bounds: [10, 10, 100, 100]
clip-rect: [10, 10, 100, 100]
clip-and-scroll: 2
type: clip
id: 3
"content-size": [800, 1000]
@ -27,6 +26,6 @@ root:
-
bounds: [0, 0, 200, 200]
clip-rect: [0, 0, 200, 200]
clip-and-scroll: [root-scroll-node, 10]
clip-chain: 10
type: rect
color: 0 255 0 1

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

@ -14,13 +14,11 @@ root:
-
bounds: [10, 10, 100, 100]
clip-rect: [10, 10, 100, 100]
clip-and-scroll: root-reference-frame
type: stacking-context
items:
-
bounds: [0, 0, 100, 100]
clip-rect: [0, 0, 100, 100]
clip-and-scroll: root-reference-frame
type: rect
color: 0 255 0 1.0
# The same test as above, except this time the stacking context also starts its
@ -34,7 +32,6 @@ root:
-
bounds: [110, 10, 100, 100]
clip-rect: [110, 10, 100, 100]
clip-and-scroll: root-reference-frame
id: 4
type: stacking-context
transform: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
@ -42,7 +39,6 @@ root:
-
bounds: [0, 0, 100, 100]
clip-rect: [0, 0, 100, 100]
clip-and-scroll: 4
type: rect
color: 0 255 0 1.0
id: [0, 1]

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

@ -14,7 +14,6 @@ root:
id: 2
-
type: stacking-context
clip-and-scroll: 2
transform: rotate(0.25)
items:
- type: clip
@ -23,8 +22,11 @@ root:
complex:
- rect: [ 0, 0, 2400, 900 ]
radius: 50
- type: clip-chain
id: 4
clips: [2, 3]
- type: rect
color: [0, 255, 0, 1]
bounds: [0, 0, 2400, 900]
clip-and-scroll: 3
clip-chain: 4

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

@ -12,16 +12,22 @@ root:
bottom-left: 50,
bottom-right: 50,
}
- type: clip-chain
id: 12
clips: [2]
- type: stacking-context
bounds: [0, 0, 100, 100]
items:
- type: rect
bounds: [ 0, 0, 100, 100 ]
color: [0, 255, 0]
clip-and-scroll: 2
clip-chain: 12
- type: clip
id: 3
bounds: [120, 0, 50, 50]
- type: clip-chain
id: 13
clips: [3]
- type: stacking-context
bounds: [100, 0, 100, 100]
filters: hue-rotate(90)
@ -29,4 +35,4 @@ root:
- type: rect
bounds: [ 0, 0, 100, 100 ]
color: [0, 255, 0]
clip-and-scroll: 3
clip-chain: 13

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

@ -123,6 +123,6 @@ root:
-
bounds: [128, 128, 632, 632]
clip-rect: [128, 128, 632, 632]
clip-and-scroll: [root-scroll-node, 1024]
clip-chain: 1024
type: rect
color: 0 255 0 1

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

@ -20,10 +20,13 @@ root:
id: 2
bounds: 0 0 100 100
clip-rect: 0 0 100 100
- type: clip-chain
id: 12
clips: [2]
- type: stacking-context
bounds: 0 0 0 0
items:
- type: backdrop-filter
bounds: 0 0 100 100
clip-and-scroll: 2
clip-chain: 12
filters: invert(1)

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

@ -21,7 +21,6 @@ root:
-
bounds: [0, 111, 1887, 1971]
"clip-rect": [0, 111, 1887, 1971]
"clip-and-scroll": 3
"backface-visible": true
type: iframe
id: [1, 3]
@ -41,7 +40,6 @@ pipelines:
"content-size": [1887, 1971]
-
"clip-rect": [0, 0, 1887, 1971]
"clip-and-scroll": 10
type: "scroll-frame"
id: 2
"content-size": [1887, 1971]
@ -49,18 +47,15 @@ pipelines:
-
bounds: [0, 0, 1887, 1971]
"clip-rect": [0, 0, 1887, 1971]
"clip-and-scroll": 2
type: clip
id: 3
"content-size": [1887, 1971]
-
"clip-and-scroll": 3
type: "stacking-context"
items:
-
bounds: [0, -186, 1887, 239]
"clip-rect": [0, -186, 1887, 239]
"clip-and-scroll": 3
"backface-visible": true
type: clip
id: 4
@ -68,7 +63,7 @@ pipelines:
-
bounds: [-660.45, -186, 0, 0]
"clip-rect": [-660.45, -186, 0, 0]
"clip-and-scroll": 4
spatial-id: 2
type: "stacking-context"
transform: [1, 0, 0, 0, -0.57735026, 1, 0, 0, 0, 0, 1, 0, 68.849, 0, 0, 1]
items:
@ -83,10 +78,13 @@ pipelines:
type: clip
id: 5
"content-size": [1887, 239]
- type: clip-chain
id: 15
clips: [3, 4, 5]
-
bounds: [0, 0, 1887, 239]
"clip-rect": [0, 0, 1887, 239]
"clip-and-scroll": 5
clip-chain: 15
"backface-visible": true
type: gradient
start: [943.5, -0.00000000000005684342]

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

@ -25,4 +25,4 @@ root:
- type: rect
bounds: 0 0 256 256
color: green
clip-and-scroll: [root-scroll-node, 5]
clip-chain: 5

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

@ -10,7 +10,7 @@ root:
id: 2
- type: conic-gradient
bounds: 0 0 800 450
"clip-and-scroll": 2
spatial-id: 2
center: 100 100
angle: 0.0
stops: [ 0.0, [255, 255, 255, 1], 1.0, [0,0,0,1] ]

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

@ -10,7 +10,7 @@ root:
id: 2
- type: conic-gradient
bounds: 0 0 800 450
"clip-and-scroll": 2
spatial-id: 2
center: 400 225
angle: 0.0
stops: [ 0.0, [255, 255, 255, 1], 1.0, [0,0,0,1] ]

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

@ -10,7 +10,7 @@ root:
id: 2
- type: gradient
bounds: 0 0 800 450
"clip-and-scroll": 2
spatial-id: 2
start: 20 20
end: 80 50
stops: [ 0.0, [255, 255, 255, 1], 1.0, [0,0,0,1] ]

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

@ -10,7 +10,7 @@ root:
id: 2
- type: gradient
bounds: 0 0 800 450
"clip-and-scroll": 2
spatial-id: 2
start: 100 100
end: 700 350
stops: [ 0.0, [255, 255, 255, 1], 1.0, [0,0,0,1] ]

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

@ -10,7 +10,7 @@ root:
id: 2
- type: radial-gradient
bounds: 0 0 800 450
"clip-and-scroll": 2
spatial-id: 2
center: 50 50
radius: 60 60
stops: [ 0.0, [255, 255, 255, 1], 1.0, [0,0,0,1] ]

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

@ -10,7 +10,7 @@ root:
id: 2
- type: radial-gradient
bounds: 0 0 800 450
"clip-and-scroll": 2
spatial-id: 2
center: 400 225
radius: 200 200
stops: [ 0.0, [255, 255, 255, 1], 1.0, [0,0,0,1] ]

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

@ -10,12 +10,15 @@ root:
bounds: [0, 0, 200, 200]
type: clip
id: 2
- type: clip-chain
id: 12
clips: [2]
# Here we are testing that the clip-and-scroll property applies to
# both stacking contexts and items.
-
bounds: [0, 0, 0, 0]
content-size: [200, 200]
clip-and-scroll: 2
clip-chain: 12
type: "stacking-context"
"scroll-policy": scrollable
transform: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -100, 0, 0, 1]

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

@ -15,14 +15,19 @@ root:
- type: clip
bounds: [10, 60, 50, 50]
id: 42
- type: clip-chain
id: 142
clips: [42]
- type: stacking-context
bounds: [10, 10, 100, 100]
items:
- type: rect
bounds: [0, 0, 100, 50]
color: green
clip-and-scroll: [root-reference-frame, 42]
clip-chain: 142
spatial-id: root-reference-frame
- type: rect
bounds: [0, 50, 100, 50]
color: red
clip-and-scroll: [root-reference-frame, 42]
clip-chain: 142
spatial-id: root-reference-frame

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

@ -9,7 +9,7 @@ root:
- type: rect
bounds: [0, 0, 50, 50]
color: green
clip-and-scroll: root-reference-frame
spatial-id: root-reference-frame
- type: stacking-context
bounds: [0, 0, 50, 50]
transform: translate(60, 100)
@ -25,7 +25,6 @@ root:
- type: rect
bounds: [0, 0, 50, 50]
color: green
clip-and-scroll: 100
- type: stacking-context
bounds: [120, 0, 50, 200]
transform: translate(0, 0)
@ -39,7 +38,6 @@ root:
- type: rect
bounds: [0, 100, 50, 50]
color: green
clip-and-scroll: 101
- type: stacking-context
bounds: [180, 0, 50, 200]
perspective: 1
@ -52,4 +50,3 @@ root:
- type: rect
bounds: [0, 100, 50, 50]
color: green
clip-and-scroll: 102

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

@ -23,12 +23,12 @@ root:
- type: rect
bounds: [0, 0, 50, 50]
color: red
clip-and-scroll: 123
spatial-id: 123
- type: rect
bounds: [50, 0, 50, 50]
color: green
clip-and-scroll: 456
spatial-id: 456
- type: rect
bounds: [100, 0, 50, 50]
color: blue
clip-and-scroll: 789
spatial-id: 789

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

@ -11,7 +11,7 @@ root:
- type: rect
bounds: [0, 0, 50, 50]
color: red
clip-and-scroll: 123
spatial-id: 123
- type: scroll-frame
bounds: [50, 0, 50, 50]
content-size: [50, 50]
@ -21,7 +21,7 @@ root:
- type: rect
bounds: [50, 0, 50, 50]
color: green
clip-and-scroll: 456
spatial-id: 456
- type: scroll-frame
bounds: [100, 0, 50, 50]
content-size: [50, 50]
@ -31,5 +31,5 @@ root:
- type: rect
bounds: [100, 0, 50, 50]
color: blue
clip-and-scroll: 789
spatial-id: 789

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

@ -11,10 +11,13 @@ root:
bounds: [0, 0, 50, 80]
type: clip
id: 2
- type: clip-chain
id: 12
clips: [2]
- type: rect
bounds: [10, 10, 100, 100]
color: red
clip-and-scroll: 2
clip-chain: 12
id: [0, 0]
pipelines: []

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

@ -509,16 +509,17 @@ impl YamlFrameReader {
}
}
fn to_spatial_id(&self, item: &Yaml, pipeline_id: PipelineId) -> SpatialId {
fn to_spatial_id(&self, item: &Yaml, pipeline_id: PipelineId) -> Option<SpatialId> {
match *item {
Yaml::Integer(value) => self.user_spatial_id_map[&(value as u64)],
Yaml::Integer(value) => Some(self.user_spatial_id_map[&(value as u64)]),
Yaml::String(ref id_string) if id_string == "root-reference-frame" =>
SpatialId::root_reference_frame(pipeline_id),
Some(SpatialId::root_reference_frame(pipeline_id)),
Yaml::String(ref id_string) if id_string == "root-scroll-node" =>
SpatialId::root_scroll_node(pipeline_id),
Some(SpatialId::root_scroll_node(pipeline_id)),
Yaml::BadValue => None,
_ => {
println!("Unable to parse SpatialId {:?}", item);
SpatialId::root_reference_frame(pipeline_id)
None
}
}
}
@ -546,7 +547,7 @@ impl YamlFrameReader {
match *item {
Yaml::BadValue => (None, None),
Yaml::Array(ref array) if array.len() == 2 => {
let scroll_id = self.to_spatial_id(&array[0], pipeline_id);
let scroll_id = self.to_spatial_id(&array[0], pipeline_id).expect("unknown spatial id");
let clip_id = self.to_clip_id(&array[1], pipeline_id);
(clip_id, Some(scroll_id))
}
@ -1577,10 +1578,15 @@ impl YamlFrameReader {
for item in yaml_items {
let item_type = Self::get_item_type_from_yaml(item);
let (set_clip_id, set_scroll_id) = self.to_clip_and_scroll_info(
let (set_clip_id, mut set_scroll_id) = self.to_clip_and_scroll_info(
&item["clip-and-scroll"],
dl.pipeline_id
);
if let Some(id) = self.to_spatial_id(&item["spatial-id"], dl.pipeline_id) {
set_scroll_id = Some(id);
}
if let Some(clip_id) = set_clip_id {
self.clip_id_stack.push(clip_id);
}