From 6672bf7be5e8a9ed10145cae3719435026099f5e Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Wed, 29 Jun 2022 19:34:18 +0000 Subject: [PATCH] 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 --- .../boxshadow/box-shadow-huge-radius.yaml | 16 +++++---------- .../clip/border-with-rounded-clip.yaml | 5 ++++- .../reftests/clip/clip-3d-transform.yaml | 5 ++++- .../clip/clip-45-degree-rotation.yaml | 5 ++++- .../custom-clip-chain-node-ancestors.yaml | 3 +-- .../clip/fixed-position-clipping.yaml | 4 ---- .../clip/segmentation-across-rotation.yaml | 6 ++++-- .../clip/stacking-context-clip-ref.yaml | 10 ++++++++-- .../wrench/reftests/crash/many-segments.yaml | 2 +- .../filters/backdrop-filter-perspective.yaml | 5 ++++- .../reftests/filters/blend-clipped.yaml | 12 +++++------ .../filters/filter-drop-shadow-clip.yaml | 2 +- .../gradient/conic-backdrop-with-spacing.yaml | 2 +- .../reftests/gradient/conic-backdrop.yaml | 2 +- .../linear-backdrop-with-spacing.yaml | 2 +- .../reftests/gradient/linear-backdrop.yaml | 2 +- .../radial-backdrop-with-spacing.yaml | 2 +- .../reftests/gradient/radial-backdrop.yaml | 2 +- .../scrolling/clip-and-scroll-property.yaml | 5 ++++- .../fixed-position-scrolling-clip.yaml | 9 +++++++-- .../reftests/scrolling/fixed-position.yaml | 5 +---- .../scrolling/scroll-frame-order-ref.yaml | 6 +++--- .../scrolling/scroll-frame-order.yaml | 6 +++--- .../scrolling/sibling-hidden-clip.yaml | 5 ++++- gfx/wr/wrench/src/yaml_frame_reader.rs | 20 ++++++++++++------- 25 files changed, 82 insertions(+), 61 deletions(-) diff --git a/gfx/wr/wrench/reftests/boxshadow/box-shadow-huge-radius.yaml b/gfx/wr/wrench/reftests/boxshadow/box-shadow-huge-radius.yaml index 9ff601af49ba..bb36c4dedaa8 100644 --- a/gfx/wr/wrench/reftests/boxshadow/box-shadow-huge-radius.yaml +++ b/gfx/wr/wrench/reftests/boxshadow/box-shadow-huge-radius.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/clip/border-with-rounded-clip.yaml b/gfx/wr/wrench/reftests/clip/border-with-rounded-clip.yaml index 12785ef444d3..4d2012632733 100644 --- a/gfx/wr/wrench/reftests/clip/border-with-rounded-clip.yaml +++ b/gfx/wr/wrench/reftests/clip/border-with-rounded-clip.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/clip/clip-3d-transform.yaml b/gfx/wr/wrench/reftests/clip/clip-3d-transform.yaml index f844b382ad3e..c40780ca220a 100644 --- a/gfx/wr/wrench/reftests/clip/clip-3d-transform.yaml +++ b/gfx/wr/wrench/reftests/clip/clip-3d-transform.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/clip/clip-45-degree-rotation.yaml b/gfx/wr/wrench/reftests/clip/clip-45-degree-rotation.yaml index 316f249a3e05..c3fe5ebe6c6b 100644 --- a/gfx/wr/wrench/reftests/clip/clip-45-degree-rotation.yaml +++ b/gfx/wr/wrench/reftests/clip/clip-45-degree-rotation.yaml @@ -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: diff --git a/gfx/wr/wrench/reftests/clip/custom-clip-chain-node-ancestors.yaml b/gfx/wr/wrench/reftests/clip/custom-clip-chain-node-ancestors.yaml index 9824da4f9cad..e2cf3c917782 100644 --- a/gfx/wr/wrench/reftests/clip/custom-clip-chain-node-ancestors.yaml +++ b/gfx/wr/wrench/reftests/clip/custom-clip-chain-node-ancestors.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/clip/fixed-position-clipping.yaml b/gfx/wr/wrench/reftests/clip/fixed-position-clipping.yaml index 8eaa38871014..e6e27ea857c6 100644 --- a/gfx/wr/wrench/reftests/clip/fixed-position-clipping.yaml +++ b/gfx/wr/wrench/reftests/clip/fixed-position-clipping.yaml @@ -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] diff --git a/gfx/wr/wrench/reftests/clip/segmentation-across-rotation.yaml b/gfx/wr/wrench/reftests/clip/segmentation-across-rotation.yaml index c90cf79e4e8f..e62bf164f1bd 100644 --- a/gfx/wr/wrench/reftests/clip/segmentation-across-rotation.yaml +++ b/gfx/wr/wrench/reftests/clip/segmentation-across-rotation.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/clip/stacking-context-clip-ref.yaml b/gfx/wr/wrench/reftests/clip/stacking-context-clip-ref.yaml index 50fb8facd462..262b159fdf4a 100644 --- a/gfx/wr/wrench/reftests/clip/stacking-context-clip-ref.yaml +++ b/gfx/wr/wrench/reftests/clip/stacking-context-clip-ref.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/crash/many-segments.yaml b/gfx/wr/wrench/reftests/crash/many-segments.yaml index 03b33b68638f..e7ab7dddddec 100644 --- a/gfx/wr/wrench/reftests/crash/many-segments.yaml +++ b/gfx/wr/wrench/reftests/crash/many-segments.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/filters/backdrop-filter-perspective.yaml b/gfx/wr/wrench/reftests/filters/backdrop-filter-perspective.yaml index ca834e5ff710..f5b9a1da64cd 100644 --- a/gfx/wr/wrench/reftests/filters/backdrop-filter-perspective.yaml +++ b/gfx/wr/wrench/reftests/filters/backdrop-filter-perspective.yaml @@ -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) diff --git a/gfx/wr/wrench/reftests/filters/blend-clipped.yaml b/gfx/wr/wrench/reftests/filters/blend-clipped.yaml index 2fdb4ad51c03..8162a96c09c3 100644 --- a/gfx/wr/wrench/reftests/filters/blend-clipped.yaml +++ b/gfx/wr/wrench/reftests/filters/blend-clipped.yaml @@ -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] diff --git a/gfx/wr/wrench/reftests/filters/filter-drop-shadow-clip.yaml b/gfx/wr/wrench/reftests/filters/filter-drop-shadow-clip.yaml index 8da4f2aec2b1..0c898dd689d7 100644 --- a/gfx/wr/wrench/reftests/filters/filter-drop-shadow-clip.yaml +++ b/gfx/wr/wrench/reftests/filters/filter-drop-shadow-clip.yaml @@ -25,4 +25,4 @@ root: - type: rect bounds: 0 0 256 256 color: green - clip-and-scroll: [root-scroll-node, 5] + clip-chain: 5 diff --git a/gfx/wr/wrench/reftests/gradient/conic-backdrop-with-spacing.yaml b/gfx/wr/wrench/reftests/gradient/conic-backdrop-with-spacing.yaml index 063492ec95b5..695e600dffc4 100644 --- a/gfx/wr/wrench/reftests/gradient/conic-backdrop-with-spacing.yaml +++ b/gfx/wr/wrench/reftests/gradient/conic-backdrop-with-spacing.yaml @@ -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] ] diff --git a/gfx/wr/wrench/reftests/gradient/conic-backdrop.yaml b/gfx/wr/wrench/reftests/gradient/conic-backdrop.yaml index fafaacd4fa3a..bc654a50ace1 100644 --- a/gfx/wr/wrench/reftests/gradient/conic-backdrop.yaml +++ b/gfx/wr/wrench/reftests/gradient/conic-backdrop.yaml @@ -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] ] diff --git a/gfx/wr/wrench/reftests/gradient/linear-backdrop-with-spacing.yaml b/gfx/wr/wrench/reftests/gradient/linear-backdrop-with-spacing.yaml index 083222b6ac73..dd85ffdae5c0 100644 --- a/gfx/wr/wrench/reftests/gradient/linear-backdrop-with-spacing.yaml +++ b/gfx/wr/wrench/reftests/gradient/linear-backdrop-with-spacing.yaml @@ -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] ] diff --git a/gfx/wr/wrench/reftests/gradient/linear-backdrop.yaml b/gfx/wr/wrench/reftests/gradient/linear-backdrop.yaml index 4a4eea5b66a1..7b351788d427 100644 --- a/gfx/wr/wrench/reftests/gradient/linear-backdrop.yaml +++ b/gfx/wr/wrench/reftests/gradient/linear-backdrop.yaml @@ -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] ] diff --git a/gfx/wr/wrench/reftests/gradient/radial-backdrop-with-spacing.yaml b/gfx/wr/wrench/reftests/gradient/radial-backdrop-with-spacing.yaml index 795c65d07059..f8e2c14b1ce7 100644 --- a/gfx/wr/wrench/reftests/gradient/radial-backdrop-with-spacing.yaml +++ b/gfx/wr/wrench/reftests/gradient/radial-backdrop-with-spacing.yaml @@ -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] ] diff --git a/gfx/wr/wrench/reftests/gradient/radial-backdrop.yaml b/gfx/wr/wrench/reftests/gradient/radial-backdrop.yaml index 22e360bf0147..91ee3a6ba19c 100644 --- a/gfx/wr/wrench/reftests/gradient/radial-backdrop.yaml +++ b/gfx/wr/wrench/reftests/gradient/radial-backdrop.yaml @@ -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] ] diff --git a/gfx/wr/wrench/reftests/scrolling/clip-and-scroll-property.yaml b/gfx/wr/wrench/reftests/scrolling/clip-and-scroll-property.yaml index ed72c23fcea6..5744c22f9107 100644 --- a/gfx/wr/wrench/reftests/scrolling/clip-and-scroll-property.yaml +++ b/gfx/wr/wrench/reftests/scrolling/clip-and-scroll-property.yaml @@ -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] diff --git a/gfx/wr/wrench/reftests/scrolling/fixed-position-scrolling-clip.yaml b/gfx/wr/wrench/reftests/scrolling/fixed-position-scrolling-clip.yaml index 63573e5742f3..bdf537409ed3 100644 --- a/gfx/wr/wrench/reftests/scrolling/fixed-position-scrolling-clip.yaml +++ b/gfx/wr/wrench/reftests/scrolling/fixed-position-scrolling-clip.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/scrolling/fixed-position.yaml b/gfx/wr/wrench/reftests/scrolling/fixed-position.yaml index 6fa099b5e37d..c56f1378cd7c 100644 --- a/gfx/wr/wrench/reftests/scrolling/fixed-position.yaml +++ b/gfx/wr/wrench/reftests/scrolling/fixed-position.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/scrolling/scroll-frame-order-ref.yaml b/gfx/wr/wrench/reftests/scrolling/scroll-frame-order-ref.yaml index 5429d052db2e..b29d3ba2b86f 100644 --- a/gfx/wr/wrench/reftests/scrolling/scroll-frame-order-ref.yaml +++ b/gfx/wr/wrench/reftests/scrolling/scroll-frame-order-ref.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/scrolling/scroll-frame-order.yaml b/gfx/wr/wrench/reftests/scrolling/scroll-frame-order.yaml index 1801dbb08ad4..2977c04d9516 100644 --- a/gfx/wr/wrench/reftests/scrolling/scroll-frame-order.yaml +++ b/gfx/wr/wrench/reftests/scrolling/scroll-frame-order.yaml @@ -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 diff --git a/gfx/wr/wrench/reftests/scrolling/sibling-hidden-clip.yaml b/gfx/wr/wrench/reftests/scrolling/sibling-hidden-clip.yaml index 74b735d32a23..9039a4af0dc5 100644 --- a/gfx/wr/wrench/reftests/scrolling/sibling-hidden-clip.yaml +++ b/gfx/wr/wrench/reftests/scrolling/sibling-hidden-clip.yaml @@ -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: [] diff --git a/gfx/wr/wrench/src/yaml_frame_reader.rs b/gfx/wr/wrench/src/yaml_frame_reader.rs index 2b3f222cde97..803bc073c4ab 100644 --- a/gfx/wr/wrench/src/yaml_frame_reader.rs +++ b/gfx/wr/wrench/src/yaml_frame_reader.rs @@ -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 { 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); }