Skip to content

Commit 5d8db9f

Browse files
committed
Bug 1905611 - apply clipping to PictureCompositeMode::SVGFEGraph r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D216637 UltraBlame original commit: ebe6cedc1f12804df683c9f2eb5b68ed12e51a83
1 parent ee43978 commit 5d8db9f

File tree

12 files changed

+526
-550
lines changed

12 files changed

+526
-550
lines changed

gfx/wr/webrender/src/picture.rs

Lines changed: 315 additions & 271 deletions
Large diffs are not rendered by default.

gfx/wr/webrender/src/render_task.rs

Lines changed: 150 additions & 263 deletions
Large diffs are not rendered by default.

gfx/wr/webrender/src/scene_building.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use api::{PropertyBinding, ReferenceFrameKind, ScrollFrameDescriptor};
4545
use api::{APZScrollGeneration, HasScrollLinkedEffect, Shadow, SpatialId, StickyFrameDescriptor, ImageMask, ItemTag};
4646
use api::{ClipMode, PrimitiveKeyKind, TransformStyle, YuvColorSpace, ColorRange, YuvData, TempFilterData};
4747
use api::{ReferenceTransformBinding, Rotation, FillRule, SpatialTreeItem, ReferenceFrameDescriptor};
48-
use api::FilterOpGraphPictureBufferId;
48+
use api::{FilterOpGraphPictureBufferId, SVGFE_GRAPH_MAX};
4949
use api::channel::{unbounded_channel, Receiver, Sender};
5050
use api::units::*;
5151
use crate::image_tiling::simplify_repeated_primitive;
@@ -3838,7 +3838,7 @@ impl<'a> SceneBuilder<'a> {
38383838

38393839

38403840

3841-
const BUFFER_LIMIT: usize = 256;
3841+
const BUFFER_LIMIT: usize = SVGFE_GRAPH_MAX;
38423842

38433843

38443844
const SVGFE_INFLATE: i16 = 1;

gfx/wr/webrender_api/src/display_item.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,12 @@ pub struct FilterOpGraphNode {
12431243
pub subregion: LayoutRect,
12441244
}
12451245

1246+
1247+
1248+
1249+
1250+
pub const SVGFE_GRAPH_MAX: usize = 256;
1251+
12461252
#[repr(C)]
12471253
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PeekPoke)]
12481254
pub enum FilterOp {

gfx/wr/wrench/reftests/filters/reftest.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ fuzzy(2,10000) == svgfe-blendmultiply-linear.yaml svgfe-blendmultiply-linear-ref
33
fuzzy(2,10000) == svgfe-blendnormal-linear.yaml svgfe-blendnormal-linear-ref.yaml
44
fuzzy(2,10000) == svgfe-colormatrix.yaml svgfe-colormatrix-ref.yaml
55
fuzzy(4,10000) == svgfe-dropshadow.yaml svgfe-dropshadow-ref.yaml
6+
fuzzy(12,10000) == svgfe-dropshadow-offscreen-source.yaml svgfe-dropshadow-offscreen-source-ref.yaml
67
fuzzy(2,10000) == svgfe-opacity-linear.yaml svgfe-opacity-linear-ref.yaml
78
fuzzy(2,10000) == svgfe-opacity.yaml svgfe-opacity-ref.yaml
89
fuzzy(12,10000) == svgfe-subregion-bigger.yaml svgfe-subregion-bigger-ref.yaml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
root:
3+
items:
4+
- type: stacking-context
5+
bounds: [-130, -94, 510, 510]
6+
filters: drop-shadow([40, 40], 10, red)
7+
items:
8+
- type: stacking-context
9+
bounds: [10, 10, 200, 200]
10+
items:
11+
- type: rect
12+
bounds: [10, 10, 100, 100]
13+
color: [127, 127, 127, 1]
14+
- type: rect
15+
bounds: [50, 30, 100, 60]
16+
color: [192, 192, 192, 1]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
root:
3+
items:
4+
- type: stacking-context
5+
bounds: [-130, -94, 510, 510]
6+
filters:
7+
- svgfe: SourceGraphic
8+
- svgfe: SourceAlpha
9+
- svgfe: dropshadow
10+
linear: false
11+
subregion: [-200, -200, 510, 510]
12+
color: red
13+
dx: 40
14+
dy: 40
15+
std_deviation_x: 10
16+
std_deviation_y: 10
17+
in: 0
18+
items:
19+
- type: stacking-context
20+
bounds: [10, 10, 200, 200]
21+
items:
22+
- type: rect
23+
bounds: [10, 10, 100, 100]
24+
color: [127, 127, 127, 1]
25+
- type: rect
26+
bounds: [50, 30, 100, 60]
27+
color: [192, 192, 192, 1]

layout/reftests/image-element/reftest.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fuzzy-if(winWidget,47-132,47-54) == element-paint-simple.html element-paint-simp
1212
== element-paint-recursion.html element-paint-recursion-ref.html
1313
== element-paint-continuation.html element-paint-continuation-ref.html
1414
== element-paint-transform-01.html element-paint-transform-01-ref.html
15-
random-if(winWidget&&!gfxSVGFE) fuzzy-if(!useDrawSnapshot,255-255,39-42) fuzzy-if(gfxSVGFE,0-201,0-1486) == element-paint-transform-02.html element-paint-transform-02-ref.html # bug 587133
15+
random-if(winWidget&&!gfxSVGFE) fuzzy-if(!useDrawSnapshot,255-255,39-42) fuzzy-if(gfxSVGFE,0-255,0-1983) == element-paint-transform-02.html element-paint-transform-02-ref.html # bug 587133
1616
== element-paint-background-size-01.html element-paint-background-size-01-ref.html
1717
== element-paint-background-size-02.html element-paint-background-size-02-ref.html
1818
fuzzy(0-255,0-4) == element-paint-transform-repeated.html element-paint-transform-repeated-ref.html # Bug 1475907

layout/reftests/svg/filters/svg-filter-chains/reftest.list

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
== clip-input.svg clip-input-ref.svg
55
== clip-original-SourceGraphic.svg clip-original-SourceGraphic-ref.svg
66
== clip-output.svg clip-output-ref.svg
7-
fuzzy(0-5,0-20300) fuzzy-if(Android&&device&&!swgl,5-5,21751-21751) fuzzy-if(gfxSVGFE,0-1,0-1000000) == default-subregion.svg default-subregion-ref.svg
7+
fuzzy(0-5,0-20300) fuzzy-if(Android&&device&&!swgl,5-5,21751-21751) fuzzy-if(gfxSVGFE,0-9,0-1000000) == default-subregion.svg default-subregion-ref.svg
88
== different-FillPaint-filter-regions.svg different-FillPaint-filter-regions-ref.svg
99
== different-StrokePaint-filter-regions.svg different-StrokePaint-filter-regions-ref.svg
1010
== dont-clip-previous-primitives.svg dont-clip-previous-primitives-ref.svg
1111
== intersecting-filter-regions.svg intersecting-filter-regions-ref.svg
12-
fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13184) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) fuzzy-if(gfxSVGFE,0-0,0-0) == long-chain.svg simple-chain-ref.svg
13-
fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13184) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) fuzzy-if(gfxSVGFE,0-0,0-0) == multiple-primitives-per-filter.svg simple-chain-ref.svg
14-
fuzzy-if(winWidget,0-1,0-173) fuzzy-if(!useDrawSnapshot||(winWidget&&isCoverageBuild),9-9,5128-5496) fuzzy-if(!useDrawSnapshot&&swgl,7-7,12820-12830) fuzzy-if(Android&&device&&!swgl,8-8,12355-12355) fuzzy-if(gfxSVGFE,0-1,0-1000000) == second-filter-uses-SourceAlpha.svg second-filter-uses-SourceAlpha-ref.svg
15-
fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13180) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) fuzzy-if(gfxSVGFE,0-0,0-0) == second-filter-uses-SourceGraphic.svg simple-chain-ref.svg
12+
fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13184) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) fuzzy-if(gfxSVGFE,0-9,0-1000000) == long-chain.svg simple-chain-ref.svg
13+
fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13184) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) fuzzy-if(gfxSVGFE,0-9,0-1000000) == multiple-primitives-per-filter.svg simple-chain-ref.svg
14+
fuzzy-if(winWidget,0-1,0-173) fuzzy-if(!useDrawSnapshot||(winWidget&&isCoverageBuild),9-9,5128-5496) fuzzy-if(!useDrawSnapshot&&swgl,7-7,12820-12830) fuzzy-if(Android&&device&&!swgl,8-8,12355-12355) fuzzy-if(gfxSVGFE,0-9,0-1000000) == second-filter-uses-SourceAlpha.svg second-filter-uses-SourceAlpha-ref.svg
15+
fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13180) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) fuzzy-if(gfxSVGFE,0-9,0-1000000) == second-filter-uses-SourceGraphic.svg simple-chain-ref.svg
1616
== simple-chain.svg simple-chain-ref.svg

layout/svg/FilterInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ WrFiltersStatus FilterInstance::BuildWebRenderSVGFiltersImpl(
12611261

12621262

12631263

1264-
static constexpr size_t maxFilters = 256;
1264+
static constexpr size_t maxFilters = wr::SVGFE_GRAPH_MAX;
12651265
int16_t bufferIdMapping[maxFilters];
12661266

12671267
if (instance.mFilterDescription.mPrimitives.Length() > maxFilters) {

0 commit comments

Comments
 (0)