diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index a34f7a4d7080e..040b3c84aa223 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -14938,287 +14938,6 @@ if colorMatrix ) { -/ -/ -Note -: -This -color -matrix -was -added -here -in -for -accessibility -in -/ -/ -https -: -/ -/ -bugzilla -. -mozilla -. -org -/ -show_bug -. -cgi -? -id -= -1431466 -it -could -be -/ -/ -done -with -regular -SVG -in -the -document -as -long -as -it -is -accelerated -/ -/ -and -it -' -s -probably -best -to -do -this -in -linearRGB -now -that -it -is -/ -/ -feasible -to -do -so -/ -/ -TODO -( -ahale -) -: -Make -sure -to -test -this -works -correctly -before -enabling -if -( -StaticPrefs -: -: -gfx_webrender_svg_filter_effects -( -) -& -& -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_also_use_for_docshell_fecolormatrix -( -) -) -{ -/ -/ -WebRender -SVGFE -code -needs -a -valid -filter -region -so -use -1 -< -< -30 -as -/ -/ -rendering -will -already -be -heavily -degraded -at -that -range -. -static -constexpr -float -kExtent -= -1024 -. -0f -* -1024 -. -0f -* -1024 -. -0f -; -wr -: -: -LayoutRect -subregion -= -{ -{ -- -kExtent -- -kExtent -} -{ -kExtent -kExtent -} -} -; -auto -node -= -wr -: -: -FilterOpGraphNode -{ -} -; -node -. -input -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -None -( -) -; -node -. -input2 -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -None -( -) -; -node -. -subregion -= -subregion -; -wrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFESourceGraphic -( -node -) -) -; -node -. -input -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -BufferId -( -0 -) -; -wrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEColorMatrix -( -node -colorMatrix -- -> -components -) -) -; -} -else -{ wrFilters . filters @@ -15241,7 +14960,6 @@ components ) ; } -} wrManager - > @@ -55094,17 +54812,14 @@ AsSpan ( ) ; -/ -/ -Try -building -a -CSS -filter -chain -WrFiltersStatus -status +bool +initialized = +true +; +if +( +! SVGIntegrationUtils : : @@ -55114,46 +54829,9 @@ filterChain mFrame wrFilters ) -; -if -( -status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK -) -{ -/ -/ -If -the -filters -are -too -complex -for -CSS -filters -try -SVG -filters -auto -offsetForSVGFilters -= -nsLayoutUtils -: -: -ComputeOffsetToUserSpace -( -aDisplayListBuilder -mFrame -) -; -status -= +& +& +! SVGIntegrationUtils : : @@ -55166,19 +54844,8 @@ StyleFilterType : BackdropFilter wrFilters -offsetForSVGFilters +initialized ) -; -} -if -( -status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK ) { / @@ -55215,13 +54882,8 @@ wrFilters } if ( -status -= -= -WrFiltersStatus -: -: -UNSUPPORTED +! +initialized ) { wrFilters @@ -55886,17 +55548,14 @@ AsSpan ( ) ; -/ -/ -Try -building -a -CSS -filter -chain -WrFiltersStatus -status +bool +initialized = +true +; +if +( +! SVGIntegrationUtils : : @@ -55906,40 +55565,9 @@ filterChain mFrame wrFilters ) -; -if -( -status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK -) -{ -/ -/ -Try -building -an -SVG -filter -graph -auto -offsetForSVGFilters -= -nsLayoutUtils -: -: -ComputeOffsetToUserSpace -( -aDisplayListBuilder -mFrame -) -; -status -= +& +& +! SVGIntegrationUtils : : @@ -55952,20 +55580,12 @@ StyleFilterType : Filter wrFilters -offsetForSVGFilters +initialized ) -; +) +{ if ( -status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK -& -& mStyle ) { @@ -56001,26 +55621,14 @@ as invalid filters . -status +wrFilters = -WrFiltersStatus -: -: -UNSUPPORTED -; +{ } +; } -switch -( -status -) +else { -case -WrFiltersStatus -: -: -BLOB_FALLBACK -: / / Draw @@ -56030,12 +55638,14 @@ fallback return false ; -case -WrFiltersStatus -: -: -UNSUPPORTED -: +} +} +if +( +! +initialized +) +{ / / https @@ -56075,9 +55685,9 @@ object or the referenced +object / / -object is not a @@ -56089,11 +55699,11 @@ whole filter chain is -/ -/ ignored . No +/ +/ filter is applied @@ -56132,73 +55742,6 @@ wrFilters { } ; -break -; -case -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE -: -/ -/ -SVG -spec -allows -us -to -drop -the -entire -filter -graph -if -it -contains -too -/ -/ -many -filters -to -render -or -other -performance -considerations -. -wrFilters -= -{ -} -; -break -; -case -WrFiltersStatus -: -: -CHAIN -: -case -WrFiltersStatus -: -: -SVGFE -: -/ -/ -Filter -the -image -using -the -wrFilters -produced -above -. -break -; } uint64_t clipChainId diff --git a/layout/reftests/css-blending/reftest.list b/layout/reftests/css-blending/reftest.list index f1670be6cf97e..6b6a2ee84331e 100644 --- a/layout/reftests/css-blending/reftest.list +++ b/layout/reftests/css-blending/reftest.list @@ -70,66 +70,20 @@ image ref . html -# -for -some -reason -this -test -ends -up -with -a -subpixel -misalignment -for -the -' -. -' -# -character -when -using -gfx -. -webrender -. -svg -- -filters -. -enable -= -true -but -other -text -# -works -however -the -text -is -not -the -purpose -of -this -test -so -just -use -fuzzy -. fuzzy +- +if ( -0 +geckoview +& +& +device +3 - -73 -0 +3 +5 - -8 +5 ) = = diff --git a/layout/reftests/image-element/reftest.list b/layout/reftests/image-element/reftest.list index 5c4c477cdcd74..469f225c2848c 100644 --- a/layout/reftests/image-element/reftest.list +++ b/layout/reftests/image-element/reftest.list @@ -268,14 +268,24 @@ transform ref . html +random +- +if +( +winWidget +) fuzzy +- +if ( -0 +! +useDrawSnapshot +255 - -201 -0 +255 +39 - -1486 +42 ) = = @@ -389,13 +399,29 @@ html Bug 1475907 fuzzy +- +if ( +winWidget 0 - 255 0 - -144 +24 +) +fuzzy +- +if +( +! +useDrawSnapshot +255 +- +255 +50 +- +115 ) = = diff --git a/layout/reftests/svg/blur-inside-clipPath.svg b/layout/reftests/svg/blur-inside-clipPath.svg index 72888dbed7cf6..9ee479e6b71a5 100644 --- a/layout/reftests/svg/blur-inside-clipPath.svg +++ b/layout/reftests/svg/blur-inside-clipPath.svg @@ -81,9 +81,9 @@ d = " M0 -600v +512v - -600h512v600z +512h512v512z " / > diff --git a/layout/reftests/svg/filters/css-filters/reftest.list b/layout/reftests/svg/filters/css-filters/reftest.list index 0ce03d97e1e49..388d1848e275a 100644 --- a/layout/reftests/svg/filters/css-filters/reftest.list +++ b/layout/reftests/svg/filters/css-filters/reftest.list @@ -119,6 +119,38 @@ software ref . html +fuzzy +- +if +( +! +useDrawSnapshot +2 +- +5 +4764 +- +8168 +) +fuzzy +- +if +( +Android +& +& +device +& +& +! +swgl +5 +- +5 +8574 +- +8574 +) = = blur @@ -216,18 +248,6 @@ if ( useDrawSnapshot ) -fuzzy -- -if -( -gfxSVGFEGaussianBlur -0 -- -2 -0 -- -1000000 -) = = blur @@ -424,15 +444,6 @@ zero ref . html -fuzzy -( -0 -- -2 -0 -- -1000000 -) = = drop @@ -447,15 +458,6 @@ shadow ref . html -fuzzy -( -0 -- -2 -0 -- -1000000 -) = = drop @@ -478,15 +480,6 @@ color ref . html -fuzzy -( -0 -- -2 -0 -- -1000000 -) = = drop diff --git a/layout/reftests/svg/filters/reftest.list b/layout/reftests/svg/filters/reftest.list index 34602977580a8..50a19a05bfa04 100644 --- a/layout/reftests/svg/filters/reftest.list +++ b/layout/reftests/svg/filters/reftest.list @@ -180,10 +180,10 @@ fuzzy ( 0 - -2 +1 0 - -1000000 +42500 ) = = @@ -217,10 +217,10 @@ fuzzy ( 0 - -2 +1 0 - -1000000 +6400 ) = = @@ -240,10 +240,10 @@ fuzzy ( 0 - -2 +1 0 - -1000000 +10000 ) = = @@ -291,10 +291,10 @@ fuzzy ( 0 - -2 +1 0 - -1000000 +9600 ) = = @@ -314,10 +314,10 @@ fuzzy ( 0 - -2 +1 0 - -1000000 +10000 ) = = @@ -393,10 +393,10 @@ fuzzy ( 0 - -2 +1 0 - -1000000 +1600 ) = = @@ -412,14 +412,20 @@ feFlood ref . svg +skip +- +if +( +winWidget +) fuzzy ( 0 - -2 +1 0 - -1000000 +6400 ) = = @@ -435,49 +441,6 @@ feFlood ref . svg -# -NOTE -: -some -of -these -use -multiple -fuzzy -conditions -each -fuzzy -condition -# -is -simply -setting -the -fuzzy -parameters -that -will -be -used -by -the -= -= -at -the -end -# -so -the -last -fuzzy -wins -in -terms -of -override -order -. fuzzy ( 0 @@ -485,71 +448,41 @@ fuzzy 2 0 - -1000000 -) -= -= -feGaussianBlur -- -1 -. -svg -feGaussianBlur -- -1 -- -ref -. -svg -pref -( -gfx -. -webrender -. -svg -- -filter -- -effects -true +6404 ) fuzzy +- +if ( -0 +Android +& +& +device +& +& +! +swgl +6 - -2 -0 +6 +6400 - -1000000 +6400 ) = = feGaussianBlur - -2 +1 . svg feGaussianBlur - -2 +1 - ref . svg -pref -( -gfx -. -webrender -. -svg -- -filter -- -effects -false -) fuzzy ( 0 @@ -559,25 +492,6 @@ fuzzy - 304 ) -fuzzy -- -if -( -Android -& -& -device -& -& -! -swgl -6 -- -6 -6400 -- -6400 -) = = feGaussianBlur @@ -607,45 +521,37 @@ feGaussianBlur ref . svg -pref +fuzzy +- +if ( -gfx -. -webrender -. -svg +! +useDrawSnapshot +2 - -filter +5 +4764 - -effects -true +8168 ) -= -= -feGaussianBlur -- -4 -. -svg -feGaussianBlur -- -4 +fuzzy - -ref -. -svg -pref +if ( -gfx -. -webrender -. -svg +Android +& +& +device +& +& +! +swgl +5 - -filter +5 +8574 - -effects -false +8574 ) = = @@ -673,18 +579,6 @@ geckoview - 200 ) -fuzzy -- -if -( -gfxSVGFEGaussianBlur -0 -- -0 -0 -- -0 -) = = feGaussianBlur @@ -699,15 +593,6 @@ feGaussianBlur ref . svg -fuzzy -( -0 -- -2 -0 -- -10000 -) = = feGaussianBlur @@ -722,54 +607,11 @@ feGaussianBlur ref . svg -# -SVGFE -implementation -deliberately -does -not -cap -blur -radius -( -but -resolution -# -degrades -) -the -regular -WebRender -CSS -filter -also -does -not -need -to -cap -radius -# -for -the -same -reason -so -this -test -is -now -only -relevant -to -blob -fallback skip - if ( -! -useDrawSnapshot +winWidget ) = = @@ -982,6 +824,18 @@ no tests for feTurbulence +fuzzy +- +if +( +geckoview +0 +- +36 +0 +- +220 +) = = filter @@ -1041,6 +895,12 @@ pattern ref . svg +random +- +if +( +winWidget +) = = filter @@ -1055,6 +915,9 @@ svg pass . svg +# +bug +1356139 = = filter @@ -1443,18 +1306,6 @@ fuzzy - 28600 ) -fuzzy -- -if -( -gfxSVGFEComposite -0 -- -2 -0 -- -1000000 -) = = feComposite @@ -1603,34 +1454,6 @@ useDrawSnapshot - 16467 ) -fuzzy -- -if -( -gfxSVGFEDropShadow -& -& -! -gfxSVGFEOffset -97 -- -98 -21575 -- -22951 -) -fuzzy -- -if -( -gfxSVGFEOffset -0 -- -2 -0 -- -1000000 -) = = feDropShadow @@ -1658,13 +1481,25 @@ pass . svg fuzzy +- +if ( -0 +! +useDrawSnapshot +| +| +( +winWidget +& +& +isCoverageBuild +) +20 - 21 -0 +5523 - -1000000 +5647 ) = = @@ -1957,6 +1792,21 @@ sourcegraphic ref . svg +# +These +failures +are +caused +by +bug +1586055 +fails +- +if +( +! +useDrawSnapshot +) = = outside @@ -1973,6 +1823,13 @@ sourcegraphic ref . svg +fails +- +if +( +! +useDrawSnapshot +) = = outside diff --git a/layout/reftests/svg/filters/svg-filter-chains/reftest.list b/layout/reftests/svg/filters/svg-filter-chains/reftest.list index 1f6d41d2fc92f..5ef652503aad7 100644 --- a/layout/reftests/svg/filters/svg-filter-chains/reftest.list +++ b/layout/reftests/svg/filters/svg-filter-chains/reftest.list @@ -77,6 +77,34 @@ output ref . svg +fuzzy +( +0 +- +5 +0 +- +20300 +) +fuzzy +- +if +( +Android +& +& +device +& +& +! +swgl +5 +- +5 +21751 +- +21751 +) = = default @@ -175,6 +203,54 @@ regions ref . svg +fuzzy +- +if +( +! +useDrawSnapshot +9 +- +9 +5168 +- +5536 +) +fuzzy +- +if +( +! +useDrawSnapshot +& +& +swgl +7 +- +7 +13170 +- +13184 +) +fuzzy +- +if +( +Android +& +& +device +& +& +! +swgl +8 +- +8 +12391 +- +12391 +) = = long @@ -189,6 +265,54 @@ chain ref . svg +fuzzy +- +if +( +! +useDrawSnapshot +9 +- +9 +5168 +- +5536 +) +fuzzy +- +if +( +! +useDrawSnapshot +& +& +swgl +7 +- +7 +13170 +- +13184 +) +fuzzy +- +if +( +Android +& +& +device +& +& +! +swgl +8 +- +8 +12391 +- +12391 +) = = multiple @@ -207,6 +331,74 @@ chain ref . svg +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 +) = = second @@ -229,6 +421,54 @@ SourceAlpha ref . svg +fuzzy +- +if +( +! +useDrawSnapshot +9 +- +9 +5168 +- +5536 +) +fuzzy +- +if +( +! +useDrawSnapshot +& +& +swgl +7 +- +7 +13170 +- +13180 +) +fuzzy +- +if +( +Android +& +& +device +& +& +! +swgl +8 +- +8 +12391 +- +12391 +) = = second diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index e672537e1d1fd..0e7948097f43e 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -731,59 +731,14 @@ mask ref . html -# -this -test -exists -to -detect -if -clip -paths -are -erroneously -cropped -by -the -# -unfiltered -size -of -the -primitive -which -was -bug -1459890 -so -the -blur -fuzz -# -doesn -' -t -matter -as -if -the -error -occurs -it -causes -a -much -more -drastic -change fuzzy ( 0 - -20 +11 0 - -9840 +7155 ) = = @@ -2526,23 +2481,11 @@ if winWidget 0 - -4 +3 0 - 12739 ) -fuzzy -- -if -( -gfxSVGFEGaussianBlur -0 -- -7 -0 -- -1000000 -) = = dynamic diff --git a/layout/svg/FilterInstance.cpp b/layout/svg/FilterInstance.cpp index cdc575f2acc80..224e53ab7de30 100644 --- a/layout/svg/FilterInstance.cpp +++ b/layout/svg/FilterInstance.cpp @@ -951,7 +951,7 @@ ComponentTransferFuncType Identity ; } -WrFiltersStatus +bool FilterInstance : : @@ -971,35 +971,12 @@ aStyleFilterType WrFiltersHolder & aWrFilters -const -nsPoint +bool & -aOffsetForSVGFilters -) -{ -WrFiltersStatus -status -= -BuildWebRenderSVGFiltersImpl -( -aFilteredFrame -aFilters -aStyleFilterType -aWrFilters -aOffsetForSVGFilters -) -; -if -( -status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK +aInitialized ) { +bool status = BuildWebRenderFiltersImpl @@ -1008,18 +985,13 @@ aFilteredFrame aFilters aStyleFilterType aWrFilters +aInitialized ) ; -} if ( +! status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK ) { aFilteredFrame @@ -1045,7 +1017,7 @@ return status ; } -WrFiltersStatus +bool FilterInstance : : @@ -1065,6 +1037,9 @@ aStyleFilterType WrFiltersHolder & aWrFilters +bool +& +aInitialized ) { aWrFilters @@ -1091,14 +1066,6 @@ Clear ( ) ; -aWrFilters -. -post_filters_clip -= -Nothing -( -) -; nsIFrame * firstFrame @@ -1138,11 +1105,12 @@ SVGObserverUtils eHasRefsSomeInvalid ) { +aInitialized += +false +; return -WrFiltersStatus -: -: -UNSUPPORTED +true ; } UniquePtr @@ -1263,11 +1231,12 @@ IsInitialized ) ) { +aInitialized += +false +; return -WrFiltersStatus -: -: -UNSUPPORTED +true ; } / @@ -1318,10 +1287,7 @@ gfx_webrender_max_filter_ops_per_chain ) { return -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE +true ; } Maybe @@ -1500,10 +1466,7 @@ NumberOfInputs ) { return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } / @@ -1568,10 +1531,7 @@ kPrimitiveIndexSourceGraphic ) { return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } } @@ -1595,10 +1555,7 @@ i ) { return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } bool @@ -2004,10 +1961,7 @@ bail out . return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } const @@ -2124,10 +2078,7 @@ blur filter . return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } const @@ -2166,10 +2117,7 @@ height ) { return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } sRGBColor @@ -2406,10 +2354,7 @@ of values . return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } wr @@ -2837,10 +2782,7 @@ filterData else { return -WrFiltersStatus -: -: -BLOB_FALLBACK +false ; } if @@ -3128,8637 +3070,106 @@ value ; } return -WrFiltersStatus -: -: -CHAIN +true ; } -static -WrFiltersStatus -WrSVGFEInputBuild -( -wr +nsRegion +FilterInstance : : -FilterOpGraphPictureReference +GetPreFilterNeededArea +( +nsIFrame +* +aFilteredFrame +const +nsTArray +< +SVGFilterFrame +* +> & -pic -int32_t -aSource -int16_t -aNodeOutput -int16_t -aSourceGraphic -int16_t -aSourceAlpha +aFilterFrames const -int16_t -aBufferIdMapping -[ -] -) -{ -switch -( -aSource +nsRegion +& +aPostFilterDirtyRegion ) { -case -FilterPrimitiveDescription -: -: -kPrimitiveIndexSourceGraphic -: -pic -. -buffer_id +gfxMatrix +tm = -wr -: -: -FilterOpGraphPictureBufferId +SVGUtils : : -BufferId +GetCanvasTM ( -aSourceGraphic +aFilteredFrame ) ; -break -; -case -FilterPrimitiveDescription -: -: -kPrimitiveIndexSourceAlpha -: -pic -. -buffer_id +auto +filterChain = -wr -: -: -FilterOpGraphPictureBufferId -: -: -BufferId +aFilteredFrame +- +> +StyleEffects ( -aSourceAlpha ) -; -break -; -case -FilterPrimitiveDescription -: -: -kPrimitiveIndexFillPaint -: -case -FilterPrimitiveDescription -: -: -kPrimitiveIndexStrokePaint -: -/ -/ -https -: -/ -/ -bugzilla -. -mozilla -. -org -/ -show_bug +- +> +mFilters . -cgi -? -id +AsSpan +( +) +; +UniquePtr +< +UserSpaceMetrics +> +metrics = -1897878 -/ -/ -Fill -and -Stroke -paints -are -not -yet -supported -by -WebRender -they -may -be -/ -/ -a -color +UserSpaceMetricsForFrame ( -most -common +aFilteredFrame ) -or -pattern -fill -so +; +/ +/ +Hardcode +InputIsTainted +to +true +because we -could -implement -them -with +don +' +t +want +JS +to +be +able +to / / -feFlood -or -feImage -+ -feTile -depending -on +read the -nature +rendered +contents of -the -fill +aFilteredFrame . -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -default -: -MOZ_RELEASE_ASSERT +FilterInstance +instance ( -aSource -> -= -0 -" -Unrecognized -SVG -filter -primitive -enum -value +aFilteredFrame +aFilteredFrame - -added -another -? -" -) -; -MOZ_RELEASE_ASSERT -( -aSource -< -aNodeOutput -" -Invalid -DAG -- -nodes -can -only -refer -to -earlier -nodes -" -) -; -if -( -aSource -< -0 -| -| -aSource -> -= -aNodeOutput -) -{ -return -WrFiltersStatus -: -: -UNSUPPORTED -; -} -/ -/ -Look -up -the -node -we -remapped -this -id -to -. -/ -/ -This -can -' -t -overflow -because -aSource -< -aNodeOutput -and -the -table -is -the -/ -/ -same -size -. -pic -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -BufferId -( -aBufferIdMapping -[ -aSource -] -) -; -break -; -} -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEOpacity -( -WrFiltersHolder -& -aWrFilters -const -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -OpacityAttributes -& -aAttributes -) -{ -/ -/ -CSS -opacity -/ -/ -This -is -the -only -CSS -property -that -is -has -no -direct -analog -in -SVG -although -/ -/ -technically -it -can -be -represented -as -SVGFEComponentTransfer -or -/ -/ -SVGFEColorMatrix -or -SVGFECompositeArithmetic -those -would -be -inefficient -/ -/ -approaches -. -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_opacity -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -float -opacity -= -aAttributes -. -mOpacity -; -if -( -opacity -! -= -1 -. -0f -) -{ -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEOpacity -( -aGraphNode -wr -: -: -PropertyBinding -< -float -> -: -: -Value -( -opacity -) -opacity -) -) -; -} -else -{ -/ -/ -If -it -' -s -a -no -- -op -we -still -have -to -generate -a -graph -node -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEIdentity -( -aGraphNode -) -) -; -} -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEToAlpha -( -WrFiltersHolder -& -aWrFilters -const -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -ToAlphaAttributes -& -aAttributes -) -{ -/ -/ -Convert -a -color -image -to -an -alpha -channel -- -internal -use -; -generated -by -/ -/ -SVGFilterInstance -: -: -GetOrCreateSourceAlphaIndex -( -) -. -if -( -! -StaticPrefs -: -: -GetPrefName_gfx_webrender_svg_filter_effects_toalpha -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEToAlpha -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEBlend -( -WrFiltersHolder -& -aWrFilters -const -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -BlendAttributes -& -aAttributes -) -{ -/ -/ -SVGFEBlend -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_feblend -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -switch -( -aAttributes -. -mBlendMode -) -{ -case -SVG_FEBLEND_MODE_COLOR -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendColor -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_COLOR_BURN -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendColorBurn -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_COLOR_DODGE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendColorDodge -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_DARKEN -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendDarken -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_DIFFERENCE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendDifference -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_EXCLUSION -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendExclusion -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_HARD_LIGHT -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendHardLight -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_HUE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendHue -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_LIGHTEN -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendLighten -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_LUMINOSITY -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendLuminosity -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_MULTIPLY -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendMultiply -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_NORMAL -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendNormal -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_OVERLAY -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendOverlay -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_SATURATION -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendSaturation -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_SCREEN -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendScreen -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FEBLEND_MODE_SOFT_LIGHT -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEBlendSoftLight -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -default -: -break -; -} -MOZ_CRASH -( -" -Unrecognized -SVG_FEBLEND_MODE -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -static -WrFiltersStatus -WrFilterOpSVGFEComposite -( -WrFiltersHolder -& -aWrFilters -const -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -CompositeAttributes -& -aAttributes -) -{ -/ -/ -SVGFEComposite -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fecomposite -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -switch -( -aAttributes -. -mOperator -) -{ -case -SVG_FECOMPOSITE_OPERATOR_ARITHMETIC -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeArithmetic -( -aGraphNode -aAttributes -. -mCoefficients -[ -0 -] -aAttributes -. -mCoefficients -[ -1 -] -aAttributes -. -mCoefficients -[ -2 -] -aAttributes -. -mCoefficients -[ -3 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FECOMPOSITE_OPERATOR_ATOP -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeATop -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FECOMPOSITE_OPERATOR_IN -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeIn -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FECOMPOSITE_OPERATOR_LIGHTER -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeLighter -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FECOMPOSITE_OPERATOR_OUT -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeOut -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FECOMPOSITE_OPERATOR_OVER -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeOver -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_FECOMPOSITE_OPERATOR_XOR -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeXOR -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -default -: -break -; -} -MOZ_CRASH -( -" -Unrecognized -SVG_FECOMPOSITE_OPERATOR -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -static -WrFiltersStatus -WrFilterOpSVGFEColorMatrix -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -ColorMatrixAttributes -& -aAttributes -) -{ -/ -/ -SVGFEColorMatrix -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fecolormatrix -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -float -transposed -[ -20 -] -; -if -( -gfx -: -: -ComputeColorMatrix -( -aAttributes -transposed -) -) -{ -float -matrix -[ -20 -] -= -{ -transposed -[ -0 -] -transposed -[ -5 -] -transposed -[ -10 -] -transposed -[ -15 -] -transposed -[ -1 -] -transposed -[ -6 -] -transposed -[ -11 -] -transposed -[ -16 -] -transposed -[ -2 -] -transposed -[ -7 -] -transposed -[ -12 -] -transposed -[ -17 -] -transposed -[ -3 -] -transposed -[ -8 -] -transposed -[ -13 -] -transposed -[ -18 -] -transposed -[ -4 -] -transposed -[ -9 -] -transposed -[ -14 -] -transposed -[ -19 -] -} -; -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEColorMatrix -( -aGraphNode -matrix -) -) -; -} -else -{ -/ -/ -If -it -' -s -a -no -- -op -we -still -have -to -generate -a -graph -node -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEIdentity -( -aGraphNode -) -) -; -} -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEComponentTransfer -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -ComponentTransferAttributes -& -aAttributes -) -{ -/ -/ -SVGFEComponentTransfer -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fecomponenttransfer -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -We -ensure -that -there -are -at -least -256 -values -for -each -channel -so -that -/ -/ -the -shader -can -skip -interpolation -math -for -simplicity -. -size_t -stops -= -256 -; -for -( -const -auto -& -v -: -aAttributes -. -mValues -) -{ -if -( -stops -< -v -. -Length -( -) -) -{ -stops -= -v -. -Length -( -) -; -} -} -aWrFilters -. -values -. -AppendElement -( -nsTArray -< -float -> -( -) -) -; -nsTArray -< -float -> -& -values -= -aWrFilters -. -values -[ -aWrFilters -. -values -. -Length -( -) -- -1 -] -; -values -. -SetCapacity -( -stops -* -4 -) -; -/ -/ -Set -the -FilterData -funcs -for -whether -or -not -to -interpolate -the -values -/ -/ -between -stops -although -we -use -enough -stops -that -it -may -not -matter -. -/ -/ -The -only -type -that -doesn -' -t -use -interpolation -is -discrete -. -wr -: -: -WrFilterData -filterData -{ -} -; -filterData -. -funcR_type -= -aAttributes -. -mTypes -[ -0 -] -! -= -SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE -? -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Table -: -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Discrete -; -filterData -. -funcG_type -= -aAttributes -. -mTypes -[ -1 -] -! -= -SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE -? -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Table -: -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Discrete -; -filterData -. -funcB_type -= -aAttributes -. -mTypes -[ -2 -] -! -= -SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE -? -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Table -: -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Discrete -; -filterData -. -funcA_type -= -aAttributes -. -mTypes -[ -3 -] -! -= -SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE -? -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Table -: -mozilla -: -: -wr -: -: -ComponentTransferFuncType -: -: -Discrete -; -/ -/ -This -is -a -bit -of -a -strange -way -to -store -the -table -it -is -an -interleaved -/ -/ -array -of -RGBA -values -that -we -want -to -store -in -a -single -gpucache -array -/ -/ -of -raw -pixels -so -it -' -s -easiest -to -send -it -to -WebRender -as -a -single -/ -/ -channel -but -FilterData -requires -it -to -be -4 -channels -so -we -send -it -as -/ -/ -4 -groups -of -values -but -the -data -is -interleaved -. -values -. -SetLength -( -stops -* -4 -) -; -filterData -. -R_values -= -& -( -values -[ -0 -] -) -; -filterData -. -R_values_count -= -stops -; -filterData -. -G_values -= -& -( -values -[ -stops -] -) -; -filterData -. -G_values_count -= -stops -; -filterData -. -B_values -= -& -( -values -[ -stops -* -2 -] -) -; -filterData -. -B_values_count -= -stops -; -filterData -. -A_values -= -& -( -values -[ -stops -* -3 -] -) -; -filterData -. -A_values_count -= -stops -; -/ -/ -This -builds -a -single -interleaved -RGBA -table -as -it -is -well -suited -to -GPU -/ -/ -texture -fetches -without -any -dynamic -component -indexing -in -the -shader -which -/ -/ -can -confuse -buggy -shader -compilers -. -float -invScale -= -1 -. -0f -/ -( -float -) -( -stops -- -1 -) -; -for -( -size_t -c -= -0 -; -c -< -4 -; -c -+ -+ -) -{ -auto -f -= -aAttributes -. -mTypes -[ -c -] -; -/ -/ -Check -if -there -' -s -no -data -( -we -have -crashtests -for -this -) -. -if -( -aAttributes -. -mValues -[ -c -] -. -Length -( -) -< -1 -& -& -f -! -= -SVG_FECOMPONENTTRANSFER_SAME_AS_R -) -{ -f -= -SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY -; -} -/ -/ -Check -for -misuse -of -SVG_FECOMPONENTTRANSFER_SAME_AS_R -. -if -( -c -= -= -0 -& -& -f -= -= -SVG_FECOMPONENTTRANSFER_SAME_AS_R -) -{ -f -= -SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY -; -} -switch -( -f -) -{ -case -SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE -: -{ -size_t -length1 -= -( -size_t -) -aAttributes -. -mValues -[ -c -] -. -Length -( -) -- -1 -; -for -( -size_t -i -= -0 -; -i -< -stops -; -i -+ -+ -) -{ -/ -/ -find -the -corresponding -color -in -the -table -/ -/ -this -can -not -overflow -due -to -the -length -check -float -kf -= -( -float -) -i -* -invScale -* -( -float -) -length1 -; -float -floorkf -= -floor -( -kf -) -; -size_t -k -= -( -size_t -) -floorkf -; -k -= -std -: -: -min -( -k -length1 -) -; -float -v -= -aAttributes -. -mValues -[ -c -] -[ -k -] -; -v -= -mozilla -: -: -clamped -( -v -0 -. -0f -1 -. -0f -) -; -values -[ -i -* -4 -+ -c -] -= -v -; -} -break -; -} -case -SVG_FECOMPONENTTRANSFER_TYPE_GAMMA -: -{ -float -slope -= -invScale -; -float -intercept -= -0 -. -0f -; -float -amplitude -= -aAttributes -. -mValues -[ -c -] -[ -0 -] -; -float -exponent -= -aAttributes -. -mValues -[ -c -] -[ -1 -] -; -float -offset -= -aAttributes -. -mValues -[ -c -] -[ -2 -] -; -for -( -size_t -i -= -0 -; -i -< -stops -; -i -+ -+ -) -{ -float -v -= -amplitude -* -pow -( -( -float -) -i -* -slope -+ -intercept -exponent -) -+ -offset -; -v -= -mozilla -: -: -clamped -( -v -0 -. -0f -1 -. -0f -) -; -values -[ -i -* -4 -+ -c -] -= -v -; -} -break -; -} -case -SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY -: -{ -float -slope -= -invScale -; -float -intercept -= -0 -. -0f -; -for -( -size_t -i -= -0 -; -i -< -stops -; -i -+ -+ -) -{ -float -v -= -( -float -) -i -* -slope -+ -intercept -; -v -= -mozilla -: -: -clamped -( -v -0 -. -0f -1 -. -0f -) -; -values -[ -i -* -4 -+ -c -] -= -v -; -} -break -; -} -case -SVG_FECOMPONENTTRANSFER_TYPE_LINEAR -: -{ -float -slope -= -aAttributes -. -mValues -[ -c -] -[ -0 -] -* -invScale -; -float -intercept -= -aAttributes -. -mValues -[ -c -] -[ -1 -] -; -for -( -size_t -i -= -0 -; -i -< -stops -; -i -+ -+ -) -{ -float -v -= -( -float -) -i -* -slope -+ -intercept -; -v -= -mozilla -: -: -clamped -( -v -0 -. -0f -1 -. -0f -) -; -values -[ -i -* -4 -+ -c -] -= -v -; -} -break -; -} -case -SVG_FECOMPONENTTRANSFER_TYPE_TABLE -: -{ -size_t -length1 -= -( -size_t -) -aAttributes -. -mValues -[ -c -] -. -Length -( -) -- -1 -; -for -( -size_t -i -= -0 -; -i -< -stops -; -i -+ -+ -) -{ -/ -/ -Find -the -corresponding -color -in -the -table -and -interpolate -float -kf -= -( -float -) -i -* -invScale -* -( -float -) -length1 -; -float -floorkf -= -floor -( -kf -) -; -size_t -k -= -( -size_t -) -floorkf -; -float -v1 -= -aAttributes -. -mValues -[ -c -] -[ -k -] -; -float -v2 -= -aAttributes -. -mValues -[ -c -] -[ -( -k -+ -1 -< -= -length1 -) -? -k -+ -1 -: -k -] -; -float -v -= -v1 -+ -( -v2 -- -v1 -) -* -( -kf -- -floorkf -) -; -v -= -mozilla -: -: -clamped -( -v -0 -. -0f -1 -. -0f -) -; -values -[ -i -* -4 -+ -c -] -= -v -; -} -break -; -} -case -SVG_FECOMPONENTTRANSFER_SAME_AS_R -: -{ -/ -/ -We -already -checked -c -> -0 -above -. -for -( -size_t -i -= -0 -; -i -< -stops -; -i -+ -+ -) -{ -values -[ -i -* -4 -+ -c -] -= -values -[ -i -* -4 -] -; -} -break -; -} -default -: -{ -MOZ_CRASH -( -" -Unrecognized -feComponentTransfer -type -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -} -} -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEComponentTransfer -( -aGraphNode -) -) -; -aWrFilters -. -filter_datas -. -AppendElement -( -filterData -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEConvolveMatrix -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -ConvolveMatrixAttributes -& -aAttributes -) -{ -/ -/ -SVGFEConvolveMatrix -- -extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_feconvolvematrix -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -Limited -kernel -size -for -performance -reasons -- -spec -allows -us -to -drop -/ -/ -the -whole -filter -graph -if -anything -is -unreasonable -so -we -only -support -/ -/ -up -to -5x5 -kernel -as -that -is -pretty -fast -in -hardware -static -constexpr -int32_t -width -= -5 -; -static -constexpr -int32_t -height -= -5 -; -if -( -aAttributes -. -mKernelSize -. -Width -( -) -< -1 -| -| -aAttributes -. -mKernelSize -. -Width -( -) -> -width -| -| -aAttributes -. -mKernelSize -. -Height -( -) -< -1 -| -| -aAttributes -. -mKernelSize -. -Height -( -) -> -height -| -| -( -size_t -) -aAttributes -. -mKernelSize -. -Width -( -) -* -( -size_t -) -aAttributes -. -mKernelSize -. -Height -( -) -> -width -* -height -) -{ -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -Reject -kernel -matrix -if -it -is -fewer -values -than -dimensions -suggest -if -( -aAttributes -. -mKernelMatrix -. -Length -( -) -< -( -size_t -) -aAttributes -. -mKernelSize -. -Width -( -) -* -( -size_t -) -aAttributes -. -mKernelSize -. -Height -( -) -) -{ -return -WrFiltersStatus -: -: -UNSUPPORTED -; -} -/ -/ -Arrange -the -values -in -the -order -the -shader -expects -float -matrix -[ -width -* -height -] -; -for -( -size_t -y -= -0 -; -y -< -height -; -y -+ -+ -) -{ -for -( -size_t -x -= -0 -; -x -< -width -; -x -+ -+ -) -{ -if -( -x -< -( -size_t -) -aAttributes -. -mKernelSize -. -Width -( -) -& -& -y -< -( -size_t -) -aAttributes -. -mKernelSize -. -Height -( -) -) -{ -matrix -[ -y -* -width -+ -x -] -= -aAttributes -. -mKernelMatrix -[ -y -* -aAttributes -. -mKernelSize -. -Width -( -) -+ -x -] -; -} -else -{ -matrix -[ -y -* -width -+ -x -] -= -0 -. -0f -; -} -} -} -switch -( -aAttributes -. -mEdgeMode -) -{ -case -SVG_EDGEMODE_UNKNOWN -: -case -SVG_EDGEMODE_DUPLICATE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEConvolveMatrixEdgeModeDuplicate -( -aGraphNode -aAttributes -. -mKernelSize -. -Width -( -) -aAttributes -. -mKernelSize -. -Height -( -) -matrix -aAttributes -. -mDivisor -aAttributes -. -mBias -aAttributes -. -mTarget -. -x -. -value -aAttributes -. -mTarget -. -y -. -value -aAttributes -. -mKernelUnitLength -. -Width -( -) -aAttributes -. -mKernelUnitLength -. -Height -( -) -aAttributes -. -mPreserveAlpha -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_EDGEMODE_NONE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEConvolveMatrixEdgeModeNone -( -aGraphNode -aAttributes -. -mKernelSize -. -Width -( -) -aAttributes -. -mKernelSize -. -Height -( -) -matrix -aAttributes -. -mDivisor -aAttributes -. -mBias -aAttributes -. -mTarget -. -x -. -value -aAttributes -. -mTarget -. -y -. -value -aAttributes -. -mKernelUnitLength -. -Width -( -) -aAttributes -. -mKernelUnitLength -. -Height -( -) -aAttributes -. -mPreserveAlpha -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_EDGEMODE_WRAP -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEConvolveMatrixEdgeModeWrap -( -aGraphNode -aAttributes -. -mKernelSize -. -Width -( -) -aAttributes -. -mKernelSize -. -Height -( -) -matrix -aAttributes -. -mDivisor -aAttributes -. -mBias -aAttributes -. -mTarget -. -x -. -value -aAttributes -. -mTarget -. -y -. -value -aAttributes -. -mKernelUnitLength -. -Width -( -) -aAttributes -. -mKernelUnitLength -. -Height -( -) -aAttributes -. -mPreserveAlpha -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -default -: -break -; -} -MOZ_CRASH -( -" -Unrecognized -SVG_EDGEMODE -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -static -WrFiltersStatus -WrFilterOpSVGFEDiffuseLighting -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -DiffuseLightingAttributes -& -aAttributes -const -LayoutDevicePoint -& -aUserspaceOffset -) -{ -/ -/ -SVGFEDiffuseLighting -- -extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fediffuselighting -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -switch -( -aAttributes -. -mLightType -) -{ -case -LightType -: -: -Distant -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEDiffuseLightingDistant -( -aGraphNode -aAttributes -. -mSurfaceScale -aAttributes -. -mLightingConstant -aAttributes -. -mKernelUnitLength -. -width -aAttributes -. -mKernelUnitLength -. -height -aAttributes -. -mLightValues -[ -0 -] -aAttributes -. -mLightValues -[ -1 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -LightType -: -: -Point -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEDiffuseLightingPoint -( -aGraphNode -aAttributes -. -mSurfaceScale -aAttributes -. -mLightingConstant -aAttributes -. -mKernelUnitLength -. -width -aAttributes -. -mKernelUnitLength -. -height -aAttributes -. -mLightValues -[ -0 -] -+ -aUserspaceOffset -. -x -. -value -aAttributes -. -mLightValues -[ -1 -] -+ -aUserspaceOffset -. -y -. -value -aAttributes -. -mLightValues -[ -2 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -LightType -: -: -Spot -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEDiffuseLightingSpot -( -aGraphNode -aAttributes -. -mSurfaceScale -aAttributes -. -mLightingConstant -aAttributes -. -mKernelUnitLength -. -width -aAttributes -. -mKernelUnitLength -. -height -aAttributes -. -mLightValues -[ -0 -] -+ -aUserspaceOffset -. -x -. -value -aAttributes -. -mLightValues -[ -1 -] -+ -aUserspaceOffset -. -y -. -value -aAttributes -. -mLightValues -[ -2 -] -aAttributes -. -mLightValues -[ -3 -] -+ -aUserspaceOffset -. -x -. -value -aAttributes -. -mLightValues -[ -4 -] -+ -aUserspaceOffset -. -y -. -value -aAttributes -. -mLightValues -[ -5 -] -aAttributes -. -mLightValues -[ -6 -] -aAttributes -. -mLightValues -[ -7 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -LightType -: -: -None -: -case -LightType -: -: -Max -: -/ -/ -No -default -case -so -that -the -compiler -will -warn -if -new -enums -are -added -break -; -} -MOZ_CRASH -( -" -Unrecognized -LightType -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -static -WrFiltersStatus -WrFilterOpSVGFEDisplacementMap -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -DisplacementMapAttributes -& -aAttributes -) -{ -/ -/ -SVGFEDisplacementMap -- -extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fedisplacementmap -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEDisplacementMap -( -aGraphNode -aAttributes -. -mScale -aAttributes -. -mXChannel -aAttributes -. -mYChannel -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEDropShadow -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -DropShadowAttributes -& -aAttributes -) -{ -/ -/ -SVGFEDropShadow -- -extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fedropshadow -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -This -color -is -used -in -a -shader -coefficient -that -is -in -sRGB -color -space -/ -/ -so -it -needs -to -go -through -the -regular -device -color -transformation -. -/ -/ -This -does -not -premultiply -the -alpha -- -the -shader -will -do -that -. -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEDropShadow -( -aGraphNode -wr -: -: -ToColorF -( -ToDeviceColor -( -aAttributes -. -mColor -) -) -aAttributes -. -mOffset -. -x -aAttributes -. -mOffset -. -y -aAttributes -. -mStdDeviation -. -width -aAttributes -. -mStdDeviation -. -height -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEFlood -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -FloodAttributes -& -aAttributes -) -{ -/ -/ -SVGFEFlood -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_feflood -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -This -color -is -used -in -a -shader -coefficient -that -is -in -sRGB -color -space -/ -/ -so -it -needs -to -go -through -the -regular -device -color -transformation -. -/ -/ -This -does -not -premultiply -the -alpha -- -the -shader -will -do -that -. -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEFlood -( -aGraphNode -wr -: -: -ToColorF -( -ToDeviceColor -( -aAttributes -. -mColor -) -) -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEGaussianBlur -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -GaussianBlurAttributes -& -aAttributes -) -{ -/ -/ -SVGFEGaussianBlur -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fegaussianblur -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEGaussianBlur -( -aGraphNode -aAttributes -. -mStdDeviation -. -width -aAttributes -. -mStdDeviation -. -height -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEImage -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -ImageAttributes -& -aAttributes -const -LayoutDevicePoint -& -aUserspaceOffset -) -{ -/ -/ -SVGFEImage -- -Extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_feimage -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -float -matrix -[ -6 -] -; -matrix -[ -0 -] -= -aAttributes -. -mTransform -. -components -[ -0 -] -; -matrix -[ -1 -] -= -aAttributes -. -mTransform -. -components -[ -1 -] -; -matrix -[ -2 -] -= -aAttributes -. -mTransform -. -components -[ -2 -] -; -matrix -[ -3 -] -= -aAttributes -. -mTransform -. -components -[ -3 -] -; -matrix -[ -4 -] -= -aAttributes -. -mTransform -. -components -[ -4 -] -+ -aUserspaceOffset -. -x -. -value -; -matrix -[ -5 -] -= -aAttributes -. -mTransform -. -components -[ -5 -] -+ -aUserspaceOffset -. -y -. -value -; -/ -/ -TODO -: -We -need -to -resolve -aAttributes -. -mInputIndex -to -an -actual -image -/ -/ -somehow -. -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEImage -( -aGraphNode -aAttributes -. -mFilter -matrix -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEMerge -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -MergeAttributes -& -aAttributes -FilterPrimitiveDescription -& -aPrimitive -int16_t -aNodeOutput -int16_t -aSourceGraphic -int16_t -aSourceAlpha -const -int16_t -aBufferIdMapping -[ -] -size_t -aMaxFilters -) -{ -/ -/ -SVGFEMerge -- -common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_femerge -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -There -is -no -SVGFEMerge -so -we -need -to -expand -the -provided -inputs -to -a -/ -/ -chain -of -SVGFECompositeOver -ops -before -handing -it -to -WebRender -. -if -( -aPrimitive -. -NumberOfInputs -( -) -> -= -2 -) -{ -wr -: -: -FilterOpGraphPictureReference -previous -{ -} -; -for -( -size_t -index -= -0 -; -index -< -aPrimitive -. -NumberOfInputs -( -) -; -index -+ -+ -) -{ -wr -: -: -FilterOpGraphPictureReference -current -{ -} -; -WrFiltersStatus -status -= -WrSVGFEInputBuild -( -current -aPrimitive -. -InputPrimitiveIndex -( -index -) -aNodeOutput -aSourceGraphic -aSourceAlpha -aBufferIdMapping -) -; -if -( -status -! -= -WrFiltersStatus -: -: -SVGFE -) -{ -/ -/ -If -the -input -is -an -invalid -ref -we -have -to -disable -filters -on -this -. -return -status -; -} -aGraphNode -. -input -= -current -; -aGraphNode -. -input2 -= -previous -; -if -( -aWrFilters -. -filters -. -Length -( -) -> -= -aMaxFilters -) -{ -/ -/ -Reject -the -graph -if -it -has -too -many -filters -to -even -process -return -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE -; -} -if -( -index -> -= -1 -) -{ -/ -/ -Emit -a -node -that -composites -this -pic -over -the -previous -pics -. -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFECompositeOver -( -aGraphNode -) -) -; -/ -/ -Use -this -graph -node -as -input2 -( -background -) -on -the -next -node -. -previous -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -BufferId -( -( -int16_t -) -( -aWrFilters -. -filters -. -Length -( -) -- -1 -) -) -; -} -else -{ -/ -/ -Conceptually -the -first -pic -is -composited -over -transparent -black -/ -/ -which -is -a -no -- -op -so -we -just -use -the -first -pic -as -a -direct -input -/ -/ -on -the -first -node -we -actually -emit -. -previous -. -buffer_id -= -current -. -buffer_id -; -} -} -} -else -if -( -aPrimitive -. -NumberOfInputs -( -) -= -= -1 -) -{ -/ -/ -If -we -only -got -a -single -feMergeNode -pic -we -still -want -to -apply -/ -/ -the -subregion -clip -so -make -an -SVGFEIdentity -op -. -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEIdentity -( -aGraphNode -) -) -; -} -else -{ -/ -/ -feMerge -with -no -feMergeNodes -is -just -blank -. -wr -: -: -ColorF -blank -= -{ -0 -. -0f -0 -. -0f -0 -. -0f -0 -. -0f -} -; -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEFlood -( -aGraphNode -blank -) -) -; -} -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFEMorphology -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -MorphologyAttributes -& -aAttributes -) -{ -/ -/ -SVGFEMorphology -- -Rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_femorphology -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -switch -( -aAttributes -. -mOperator -) -{ -case -SVG_OPERATOR_DILATE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEMorphologyDilate -( -aGraphNode -aAttributes -. -mRadii -. -width -aAttributes -. -mRadii -. -height -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_OPERATOR_ERODE -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEMorphologyErode -( -aGraphNode -aAttributes -. -mRadii -. -width -aAttributes -. -mRadii -. -height -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -default -: -break -; -} -MOZ_CRASH -( -" -Unrecognized -SVG_OPERATOR -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -static -WrFiltersStatus -WrFilterOpSVGFEOffset -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -OffsetAttributes -& -aAttributes -) -{ -/ -/ -SVGFEOffset -- -Common -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_feoffset -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFEOffset -( -aGraphNode -( -float -) -aAttributes -. -mValue -. -x -( -float -) -aAttributes -. -mValue -. -y -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFETile -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -TileAttributes -& -aAttributes -) -{ -/ -/ -SVGFETile -- -Extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fetile -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFETile -( -aGraphNode -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -} -static -WrFiltersStatus -WrFilterOpSVGFESpecularLighting -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -SpecularLightingAttributes -& -aAttributes -const -LayoutDevicePoint -& -aUserspaceOffset -) -{ -/ -/ -SVGFESpecularLighting -- -extremely -rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_fespecularlighting -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -switch -( -aAttributes -. -mLightType -) -{ -case -LightType -: -: -Distant -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFESpecularLightingDistant -( -aGraphNode -aAttributes -. -mSurfaceScale -aAttributes -. -mLightingConstant -aAttributes -. -mSpecularExponent -aAttributes -. -mKernelUnitLength -. -width -aAttributes -. -mKernelUnitLength -. -height -aAttributes -. -mLightValues -[ -0 -] -aAttributes -. -mLightValues -[ -1 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -LightType -: -: -Point -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFESpecularLightingPoint -( -aGraphNode -aAttributes -. -mSurfaceScale -aAttributes -. -mLightingConstant -aAttributes -. -mSpecularExponent -aAttributes -. -mKernelUnitLength -. -width -aAttributes -. -mKernelUnitLength -. -height -aAttributes -. -mLightValues -[ -0 -] -+ -aUserspaceOffset -. -x -. -value -aAttributes -. -mLightValues -[ -1 -] -+ -aUserspaceOffset -. -y -. -value -aAttributes -. -mLightValues -[ -2 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -LightType -: -: -Spot -: -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFESpecularLightingSpot -( -aGraphNode -aAttributes -. -mSurfaceScale -aAttributes -. -mLightingConstant -aAttributes -. -mSpecularExponent -aAttributes -. -mKernelUnitLength -. -width -aAttributes -. -mKernelUnitLength -. -height -aAttributes -. -mLightValues -[ -0 -] -+ -aUserspaceOffset -. -x -. -value -aAttributes -. -mLightValues -[ -1 -] -+ -aUserspaceOffset -. -y -. -value -aAttributes -. -mLightValues -[ -2 -] -aAttributes -. -mLightValues -[ -3 -] -+ -aUserspaceOffset -. -x -. -value -aAttributes -. -mLightValues -[ -4 -] -+ -aUserspaceOffset -. -y -. -value -aAttributes -. -mLightValues -[ -5 -] -aAttributes -. -mLightValues -[ -6 -] -aAttributes -. -mLightValues -[ -7 -] -) -) -; -return -WrFiltersStatus -: -: -SVGFE -; -case -LightType -: -: -None -: -case -LightType -: -: -Max -: -/ -/ -No -default -case -so -that -the -compiler -will -warn -if -new -enums -are -added -break -; -} -MOZ_CRASH -( -" -Unrecognized -LightType -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -static -WrFiltersStatus -WrFilterOpSVGFETurbulence -( -WrFiltersHolder -& -aWrFilters -wr -: -: -FilterOpGraphNode -& -aGraphNode -const -TurbulenceAttributes -& -aAttributes -const -LayoutDevicePoint -& -aUserspaceOffset -) -{ -/ -/ -SVGFETurbulence -- -Rare -if -( -! -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_feturbulence -( -) -) -{ -/ -/ -Fallback -if -pref -is -disabled -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -The -software -implementation -we -use -converts -float -to -uint32_t -and -then -/ -/ -to -int32_t -so -we -do -that -here -to -get -identical -results -to -the -prior -/ -/ -implementation -in -contrast -to -the -spec -which -uses -purely -signed -math -/ -/ -for -setting -up -the -seed -. -int32_t -m1 -= -2147483647 -- -1 -; -int32_t -seed -= -( -int32_t -) -( -( -uint32_t -) -aAttributes -. -mSeed -) -; -if -( -seed -< -= -0 -) -seed -= -- -( -seed -% -m1 -) -+ -1 -; -if -( -seed -> -m1 -) -seed -= -m1 -; -switch -( -aAttributes -. -mType -) -{ -case -SVG_TURBULENCE_TYPE_FRACTALNOISE -: -if -( -aAttributes -. -mStitchable -) -{ -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFETurbulenceWithFractalNoiseWithStitching -( -aGraphNode -aAttributes -. -mBaseFrequency -. -width -aAttributes -. -mBaseFrequency -. -height -aAttributes -. -mOctaves -seed -) -) -; -} -else -{ -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFETurbulenceWithFractalNoiseWithNoStitching -( -aGraphNode -aAttributes -. -mBaseFrequency -. -width -aAttributes -. -mBaseFrequency -. -height -aAttributes -. -mOctaves -seed -) -) -; -} -return -WrFiltersStatus -: -: -SVGFE -; -case -SVG_TURBULENCE_TYPE_TURBULENCE -: -if -( -aAttributes -. -mStitchable -) -{ -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFETurbulenceWithTurbulenceNoiseWithStitching -( -aGraphNode -aAttributes -. -mBaseFrequency -. -width -aAttributes -. -mBaseFrequency -. -height -aAttributes -. -mOctaves -seed -) -) -; -} -else -{ -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFETurbulenceWithTurbulenceNoiseWithNoStitching -( -aGraphNode -aAttributes -. -mBaseFrequency -. -width -aAttributes -. -mBaseFrequency -. -height -aAttributes -. -mOctaves -seed -) -) -; -} -return -WrFiltersStatus -: -: -SVGFE -; -default -: -break -; -} -MOZ_CRASH -( -" -Unrecognized -SVG_TURBULENCE_TYPE -" -) -; -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ -/ -Builds -filter -DAG -for -fully -accelerated -rendering -of -SVG -filter -primitives -/ -/ -/ -and -CSS -filter -chains -using -SVG -filter -primitives -WrFiltersStatus -FilterInstance -: -: -BuildWebRenderSVGFiltersImpl -( -nsIFrame -* -aFilteredFrame -Span -< -const -StyleFilter -> -aFilters -StyleFilterType -aStyleFilterType -WrFiltersHolder -& -aWrFilters -const -nsPoint -& -aOffsetForSVGFilters -) -{ -/ -/ -If -we -return -without -making -a -valid -filter -graph -we -need -to -restore -/ -/ -aInitialized -before -the -fallback -code -is -run -. -aWrFilters -. -filters -. -Clear -( -) -; -aWrFilters -. -filter_datas -. -Clear -( -) -; -aWrFilters -. -values -. -Clear -( -) -; -aWrFilters -. -post_filters_clip -= -Nothing -( -) -; -nsIFrame -* -firstFrame -= -nsLayoutUtils -: -: -FirstContinuationOrIBSplitSibling -( -aFilteredFrame -) -; -nsTArray -< -SVGFilterFrame -* -> -filterFrames -; -if -( -SVGObserverUtils -: -: -GetAndObserveFilters -( -firstFrame -& -filterFrames -aStyleFilterType -) -= -= -SVGObserverUtils -: -: -eHasRefsSomeInvalid -) -{ -return -WrFiltersStatus -: -: -UNSUPPORTED -; -} -UniquePtr -< -UserSpaceMetrics -> -metrics -= -UserSpaceMetricsForFrame -( -firstFrame -) -; -gfxRect -filterSpaceBoundsNotSnapped -; -/ -/ -TODO -: -simply -using -an -identity -matrix -here -was -pulling -the -scale -from -a -/ -/ -gfx -context -for -the -non -- -wr -path -. -gfxMatrix -scaleMatrix -; -gfxMatrix -scaleMatrixInDevUnits -= -scaleMatrix -* -SVGUtils -: -: -GetCSSPxToDevPxMatrix -( -firstFrame -) -; -/ -/ -Hardcode -inputIsTainted -to -true -because -we -don -' -t -want -JS -to -be -able -to -/ -/ -read -the -rendered -contents -of -aFilteredFrame -. -FilterInstance -instance -( -firstFrame -firstFrame -- -> -GetContent -( -) -* -metrics -aFilters -filterFrames -/ -* -inputIsTainted -* -/ -true -nullptr -scaleMatrixInDevUnits -nullptr -nullptr -nullptr -nullptr -& -filterSpaceBoundsNotSnapped -) -; -if -( -! -instance -. -IsInitialized -( -) -) -{ -return -WrFiltersStatus -: -: -UNSUPPORTED -; -} -/ -/ -If -there -more -filters -than -the -limit -pref -allows -we -can -drop -the -entire -/ -/ -filter -graph -and -pretend -we -succeeded -the -SVG -spec -allows -us -to -drop -any -/ -/ -overly -complex -graph -very -large -graphs -tend -to -OOM -anyway -. -if -( -instance -. -mFilterDescription -. -mPrimitives -. -Length -( -) -> -StaticPrefs -: -: -gfx_webrender_max_filter_ops_per_chain -( -) -) -{ -return -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE -; -} -/ -/ -We -have -to -remap -the -input -nodes -to -a -possibly -larger -number -of -output -/ -/ -nodes -due -to -expanding -feMerge -. -static -constexpr -size_t -maxFilters -= -256 -; -int16_t -bufferIdMapping -[ -maxFilters -] -; -/ -/ -Just -drop -the -graph -if -there -are -too -many -filters -to -process -. -if -( -instance -. -mFilterDescription -. -mPrimitives -. -Length -( -) -> -maxFilters -) -{ -return -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE -; -} -/ -/ -For -subregions -and -filter -parameters -we -need -to -transform -into -the -SVG -/ -/ -User -Space -coordinate -system -which -is -the -parent -stacking -context -/ -/ -coordinate -system -not -to -be -confused -with -Filter -Space -( -which -is -this -/ -/ -stacking -context -' -s -child -coordinate -system -) -or -Frame -Space -. -/ -/ -/ -/ -See -nsLayoutUtils -: -: -ComputeOffsetToUserSpace -for -further -explanation -and -/ -/ -SVGIntegrationUtils -. -cpp -EffectOffsets -: -: -ComputeEffectOffset -is -how -this -is -/ -/ -done -in -the -blob -fallback -. -/ -/ -/ -/ -The -display -list -we -are -building -already -puts -the -child -elements -' -geometry -/ -/ -( -if -any -) -in -SVG -User -Space -so -we -want -the -filter -region -and -primitive -/ -/ -subregions -to -be -in -SVG -User -Space -so -uerspaceOffset -represents -the -offset -/ -/ -from -Filter -to -User -Space -which -is -in -LayoutDevice -units -. -/ -/ -/ -/ -As -a -practical -matter -things -like -regular -view -zoom -change -Filter -Space -/ -/ -scale -so -we -don -' -t -have -to -do -anything -for -that -pinch -zoom -in -apz -can -be -/ -/ -doing -its -own -thing -but -doesn -' -t -affect -the -coordinate -system -we -use -here -/ -/ -as -everything -is -multiplied -by -subregion -and -divided -by -filterRegion -so -/ -/ -they -only -need -to -be -matching -scale -from -WebRender -perspective -. -LayoutDevicePoint -userspaceOffset -= -LayoutDevicePoint -: -: -FromAppUnits -( -aOffsetForSVGFilters -aFilteredFrame -- -> -PresContext -( -) -- -> -AppUnitsPerDevPixel -( -) -) -; -/ -/ -The -bounds -of -SourceGraphic -are -defined -in -the -spec -as -being -equal -to -the -/ -/ -filter -region -so -we -need -to -compute -that -and -while -subregion -bounds -are -/ -/ -always -integer -the -bounds -of -the -filter -element -( -and -hence -filter -region -) -/ -/ -are -not -actually -integer -so -we -need -to -account -for -the -non -- -integer -filter -/ -/ -region -clip -by -using -filterSpaceBoundsNotSnapped -this -matters -in -: -/ -/ -. -/ -mach -reftest -layout -/ -reftests -/ -svg -/ -filter -- -scaled -- -01 -. -svg -wr -: -: -LayoutRect -filterRegion -= -{ -{ -( -float -) -( -filterSpaceBoundsNotSnapped -. -TopLeft -( -) -. -x -+ -userspaceOffset -. -x -. -value -) -( -float -) -( -filterSpaceBoundsNotSnapped -. -TopLeft -( -) -. -y -+ -userspaceOffset -. -y -. -value -) -} -{ -( -float -) -( -filterSpaceBoundsNotSnapped -. -BottomRight -( -) -. -x -+ -userspaceOffset -. -x -. -value -) -( -float -) -( -filterSpaceBoundsNotSnapped -. -BottomRight -( -) -. -y -+ -userspaceOffset -. -y -. -value -) -} -} -; -/ -/ -To -enforce -the -filterRegion -clipping -SourceGraphic -before -it -enters -the -/ -/ -graph -we -have -to -create -a -SourceGraphic -node -and -SourceAlpha -node -when -we -/ -/ -implement -StrokePaint -and -FillPaint -they -will -need -to -create -nodes -on -/ -/ -demand -however -as -they -have -custom -colors -( -feFlood -) -and -patterns -( -feTile -) -. -auto -sourceGraphicNode -= -( -int16_t -) -aWrFilters -. -filters -. -Length -( -) -; -auto -sourceNode -= -wr -: -: -FilterOpGraphNode -{ -} -; -sourceNode -. -subregion -= -filterRegion -; -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFESourceGraphic -( -sourceNode -) -) -; -auto -sourceAlphaNode -= -( -int16_t -) -aWrFilters -. -filters -. -Length -( -) -; -aWrFilters -. -filters -. -AppendElement -( -wr -: -: -FilterOp -: -: -SVGFESourceAlpha -( -sourceNode -) -) -; -/ -/ -We -have -some -failure -modes -that -can -occur -when -processing -the -graph -. -WrFiltersStatus -status -= -WrFiltersStatus -: -: -SVGFE -; -for -( -uint32_t -i -= -0 -; -i -< -instance -. -mFilterDescription -. -mPrimitives -. -Length -( -) -; -i -+ -+ -) -{ -const -auto -& -primitive -= -instance -. -mFilterDescription -. -mPrimitives -[ -i -] -; -const -PrimitiveAttributes -& -attr -= -primitive -. -Attributes -( -) -; -const -bool -linear -= -primitive -. -OutputColorSpace -( -) -= -= -ColorSpace -: -: -LinearRGB -; -const -size_t -inputs -= -primitive -. -NumberOfInputs -( -) -; -wr -: -: -FilterOpGraphNode -graphNode -= -wr -: -: -FilterOpGraphNode -{ -} -; -/ -/ -Physical -( -linear -) -colorspace -is -the -default -in -SVG -filters -whereas -all -/ -/ -CSS -filters -use -sRGB -( -curved -/ -naive -) -colorspace -calculations -for -math -/ -/ -this -is -the -color -- -interpolation -- -filter -property -in -SVG -spec -. -Note -that -/ -/ -feFlood -cares -about -the -color -- -interpolation -property -on -the -color -value -/ -/ -provided -rather -than -the -regular -color -- -interpolation -- -filter -property -. -graphNode -. -linear -= -linear -; -/ -/ -Transform -the -subregion -into -SVG -' -user -space -' -which -WebRender -expects -. -graphNode -. -subregion -= -wr -: -: -ToLayoutRect -( -Rect -( -primitive -. -PrimitiveSubregion -( -) -) -+ -userspaceOffset -. -ToUnknownPoint -( -) -) -; -/ -/ -We -need -to -clip -the -final -output -node -by -the -filterRegion -as -it -could -/ -/ -be -non -- -integer -( -whereas -the -subregions -were -computed -by -SVGFilterInstance -/ -/ -code -as -integer -only -) -. -if -( -i -= -= -instance -. -mFilterDescription -. -mPrimitives -. -Length -( -) -- -1 -) -{ -if -( -graphNode -. -subregion -. -min -. -x -< -filterRegion -. -min -. -x -) -{ -graphNode -. -subregion -. -min -. -x -= -filterRegion -. -min -. -x -; -} -if -( -graphNode -. -subregion -. -min -. -y -< -filterRegion -. -min -. -y -) -{ -graphNode -. -subregion -. -min -. -y -= -filterRegion -. -min -. -y -; -} -if -( -graphNode -. -subregion -. -max -. -x -> -filterRegion -. -max -. -x -) -{ -graphNode -. -subregion -. -max -. -x -= -filterRegion -. -max -. -x -; -} -if -( -graphNode -. -subregion -. -max -. -y -> -filterRegion -. -max -. -y -) -{ -graphNode -. -subregion -. -max -. -y -= -filterRegion -. -max -. -y -; -} -} -/ -/ -Buffer -ids -are -matched -up -later -by -WebRender -to -understand -the -DAG -we -/ -/ -hold -the -following -assumptions -( -and -verify -them -regularly -) -: -/ -/ -* -Inputs -referencing -buffer -ids -are -always -< -node -index -/ -/ -( -This -means -the -DAG -can -be -walked -sequentially -as -a -flat -array -and -/ -/ -always -evaluate -correctly -) -/ -/ -* -node -index -< -maxFilters -graphNode -. -input -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -None -( -) -; -graphNode -. -input2 -. -buffer_id -= -wr -: -: -FilterOpGraphPictureBufferId -: -: -None -( -) -; -if -( -inputs -> -= -1 -) -{ -status -= -WrSVGFEInputBuild -( -graphNode -. -input -primitive -. -InputPrimitiveIndex -( -0 -) -( -int16_t -) -i -sourceGraphicNode -sourceAlphaNode -bufferIdMapping -) -; -if -( -status -! -= -WrFiltersStatus -: -: -SVGFE -) -{ -break -; -} -if -( -inputs -> -= -2 -) -{ -status -= -WrSVGFEInputBuild -( -graphNode -. -input2 -primitive -. -InputPrimitiveIndex -( -1 -) -( -int16_t -) -i -sourceGraphicNode -sourceAlphaNode -bufferIdMapping -) -; -if -( -status -! -= -WrFiltersStatus -: -: -SVGFE -) -{ -break -; -} -} -} -/ -/ -If -there -are -too -many -filters -( -after -feMerge -expansion -) -to -keep -track -of -/ -/ -in -bufferIdMapping -[ -] -then -we -can -just -drop -the -entire -graph -the -SVG -spec -/ -/ -allows -us -to -drop -overly -complex -graphs -and -maxFilters -is -not -a -small -/ -/ -quantity -. -if -( -aWrFilters -. -filters -. -Length -( -) -> -= -maxFilters -) -{ -status -= -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE -; -break -; -} -if -( -attr -. -is -< -OpacityAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEOpacity -( -aWrFilters -graphNode -attr -. -as -< -OpacityAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -ToAlphaAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEToAlpha -( -aWrFilters -graphNode -attr -. -as -< -ToAlphaAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -BlendAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEBlend -( -aWrFilters -graphNode -attr -. -as -< -BlendAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -ColorMatrixAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEColorMatrix -( -aWrFilters -graphNode -attr -. -as -< -ColorMatrixAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -ComponentTransferAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEComponentTransfer -( -aWrFilters -graphNode -attr -. -as -< -ComponentTransferAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -CompositeAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEComposite -( -aWrFilters -graphNode -attr -. -as -< -CompositeAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -ConvolveMatrixAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEConvolveMatrix -( -aWrFilters -graphNode -attr -. -as -< -ConvolveMatrixAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -DiffuseLightingAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEDiffuseLighting -( -aWrFilters -graphNode -attr -. -as -< -DiffuseLightingAttributes -> -( -) -userspaceOffset -) -; -} -else -if -( -attr -. -is -< -DisplacementMapAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEDisplacementMap -( -aWrFilters -graphNode -attr -. -as -< -DisplacementMapAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -DropShadowAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEDropShadow -( -aWrFilters -graphNode -attr -. -as -< -DropShadowAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -FloodAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEFlood -( -aWrFilters -graphNode -attr -. -as -< -FloodAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -GaussianBlurAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEGaussianBlur -( -aWrFilters -graphNode -attr -. -as -< -GaussianBlurAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -ImageAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEImage -( -aWrFilters -graphNode -attr -. -as -< -ImageAttributes -> -( -) -userspaceOffset -) -; -} -else -if -( -attr -. -is -< -MergeAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEMerge -( -aWrFilters -graphNode -attr -. -as -< -MergeAttributes -> -( -) -instance -. -mFilterDescription -. -mPrimitives -[ -i -] -( -int16_t -) -i -sourceGraphicNode -sourceAlphaNode -bufferIdMapping -maxFilters -) -; -} -else -if -( -attr -. -is -< -MorphologyAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEMorphology -( -aWrFilters -graphNode -attr -. -as -< -MorphologyAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -OffsetAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFEOffset -( -aWrFilters -graphNode -attr -. -as -< -OffsetAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -SpecularLightingAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFESpecularLighting -( -aWrFilters -graphNode -attr -. -as -< -SpecularLightingAttributes -> -( -) -userspaceOffset -) -; -} -else -if -( -attr -. -is -< -TileAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFETile -( -aWrFilters -graphNode -attr -. -as -< -TileAttributes -> -( -) -) -; -} -else -if -( -attr -. -is -< -TurbulenceAttributes -> -( -) -) -{ -status -= -WrFilterOpSVGFETurbulence -( -aWrFilters -graphNode -attr -. -as -< -TurbulenceAttributes -> -( -) -userspaceOffset -) -; -} -else -{ -/ -/ -Unknown -attributes -type -? -status -= -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -if -( -status -! -= -WrFiltersStatus -: -: -SVGFE -) -{ -break -; -} -/ -/ -Set -the -remapping -table -entry -bufferIdMapping -[ -i -] -= -( -int16_t -) -( -aWrFilters -. -filters -. -Length -( -) -- -1 -) -; -} -if -( -status -! -= -WrFiltersStatus -: -: -SVGFE -) -{ -/ -/ -If -we -couldn -' -t -handle -this -graph -clear -the -filters -before -returning -. -aWrFilters -. -filters -. -Clear -( -) -; -aWrFilters -. -filter_datas -. -Clear -( -) -; -aWrFilters -. -values -. -Clear -( -) -; -aWrFilters -. -post_filters_clip -= -Nothing -( -) -; -} -return -status -; -} -nsRegion -FilterInstance -: -: -GetPreFilterNeededArea -( -nsIFrame -* -aFilteredFrame -const -nsTArray -< -SVGFilterFrame -* -> -& -aFilterFrames -const -nsRegion -& -aPostFilterDirtyRegion -) -{ -gfxMatrix -tm -= -SVGUtils -: -: -GetCanvasTM -( -aFilteredFrame -) -; -auto -filterChain -= -aFilteredFrame -- -> -StyleEffects -( -) -- -> -mFilters -. -AsSpan -( -) -; -UniquePtr -< -UserSpaceMetrics -> -metrics -= -UserSpaceMetricsForFrame -( -aFilteredFrame -) -; -/ -/ -Hardcode -InputIsTainted -to -true -because -we -don -' -t -want -JS -to -be -able -to -/ -/ -read -the -rendered -contents -of -aFilteredFrame -. -FilterInstance -instance -( -aFilteredFrame -aFilteredFrame -- -> -GetContent -( +> +GetContent +( ) * metrics @@ -12086,9 +3497,6 @@ const gfxRect * aOverrideBBox -gfxRect -* -aFilterSpaceBoundsNotSnapped ) : mTargetFrame @@ -12352,17 +3760,6 @@ FrameSpaceToFilterSpace aPreFilterDirtyRegion ) ; -if -( -aFilterSpaceBoundsNotSnapped -) -{ -* -aFilterSpaceBoundsNotSnapped -= -mFilterSpaceBoundsNotSnapped -; -} mInitialized = true @@ -12794,7 +4191,6 @@ mTargetContent mMetrics mTargetBBox mUserSpaceToFilterSpaceScale -mFilterSpaceBoundsNotSnapped ) ; if diff --git a/layout/svg/FilterInstance.h b/layout/svg/FilterInstance.h index cfae006025393..b14f646d3656c 100644 --- a/layout/svg/FilterInstance.h +++ b/layout/svg/FilterInstance.h @@ -1019,140 +1019,52 @@ it are * supported -returns -a -status -that -indicates -which -code -path -will -handle -the -* -filters -on -this -frame -or -if -we -must -fall -back -to -blob -image . -* -/ -static -WrFiltersStatus -BuildWebRenderFilters -( -nsIFrame -* -aFilteredFrame -mozilla -: -: -Span -< -const -mozilla -: -: -StyleFilter -> -aFilters -StyleFilterType -aStyleFilterType -WrFiltersHolder -& -aWrFilters -const -nsPoint -& -aOffsetForSVGFilters -) -; -/ -* -* -* -Try -to -build -WebRender -SVG -filter -graph -for -a -frame -based -on -SVG -and -CSS -* -filters -. -If -given -an -unreasonably -costly +aInitialized +is set -of -filters -this -can -reject -* +to +true +if the -entire filter -graph +has +been +initialized +* +and +false +otherwise ( +e +. +g +. a -behavior -permitted -by -SVG -spec +bad +url ) . +If +aInitialized +is +false +the +filter * -* -See -WrFiltersStatus -for -possible -outcomes -. -* -Prefs -such -as -gfx -. -webrender -. -svg -- +the filter -- -effects -affect -this +contents +should +not +be +drawn . * / static -WrFiltersStatus -BuildWebRenderSVGFiltersImpl +bool +BuildWebRenderFilters ( nsIFrame * @@ -1174,10 +1086,9 @@ aStyleFilterType WrFiltersHolder & aWrFilters -const -nsPoint +bool & -aOffsetForSVGFilters +aInitialized ) ; private @@ -1437,26 +1348,6 @@ is null . * -param -aFilterSpaceBoundsNotSnapped -[ -optional -] -The -calculated -bbox -in -* -userspace -can -be -returend -in -the -provided -outparam -. -* / FilterInstance ( @@ -1521,15 +1412,10 @@ gfxRect aOverrideBBox = nullptr -gfxRect -* -aFilterSpaceBoundsNotSnapped -= -nullptr ) ; static -WrFiltersStatus +bool BuildWebRenderFiltersImpl ( nsIFrame @@ -1552,6 +1438,9 @@ aStyleFilterType WrFiltersHolder & aWrFilters +bool +& +aInitialized ) ; / @@ -2684,29 +2573,6 @@ mTargetBBoxInFilterSpace * * * -The -SVG -filter -element -rect -in -filter -space -may -be -non -- -integer -. -* -/ -gfxRect -mFilterSpaceBoundsNotSnapped -; -/ -* -* -* Transform rects between diff --git a/layout/svg/SVGFilterInstance.cpp b/layout/svg/SVGFilterInstance.cpp index 9b3c0e04eb88e..570ce5330de10 100644 --- a/layout/svg/SVGFilterInstance.cpp +++ b/layout/svg/SVGFilterInstance.cpp @@ -308,9 +308,6 @@ const MatrixScalesDouble & aUserSpaceToFilterSpaceScale -gfxRect -& -aFilterSpaceBoundsNotSnapped ) : mFilter @@ -408,10 +405,6 @@ ComputeBounds return ; } -aFilterSpaceBoundsNotSnapped -= -mFilterSpaceBoundsNotSnapped -; mInitialized = true @@ -783,10 +776,6 @@ UserSpaceToFilterSpace userSpaceBounds ) ; -mFilterSpaceBoundsNotSnapped -= -filterSpaceBounds -; filterSpaceBounds . RoundOut diff --git a/layout/svg/SVGFilterInstance.h b/layout/svg/SVGFilterInstance.h index 12c0dd170dfb3..91698275968f3 100644 --- a/layout/svg/SVGFilterInstance.h +++ b/layout/svg/SVGFilterInstance.h @@ -709,9 +709,6 @@ gfx MatrixScalesDouble & aUserSpaceToFilterSpaceScale -gfxRect -& -aFilterSpaceBoundsNotSnapped ) ; / @@ -1554,29 +1551,6 @@ mFilterSpaceBounds * * The -bounds -of -the -filter -element -itself -which -may -be -non -- -integer -. -* -/ -gfxRect -mFilterSpaceBoundsNotSnapped -; -/ -* -* -* -The scale factors between diff --git a/layout/svg/SVGIntegrationUtils.cpp b/layout/svg/SVGIntegrationUtils.cpp index 3d5a9481609e7..5d51b554ab2b3 100644 --- a/layout/svg/SVGIntegrationUtils.cpp +++ b/layout/svg/SVGIntegrationUtils.cpp @@ -6731,7 +6731,7 @@ opacity ) ; } -WrFiltersStatus +bool SVGIntegrationUtils : : @@ -6753,65 +6753,6 @@ aWrFilters { / / -Check -if -prefs -are -set -to -convert -the -CSS -filters -to -SVG -filters -and -use -/ -/ -the -new -WebRender -SVG -filter -rendering -rather -than -the -existing -CSS -filter -/ -/ -support -if -( -StaticPrefs -: -: -gfx_webrender_svg_filter_effects -( -) -& -& -StaticPrefs -: -: -gfx_webrender_svg_filter_effects_also_convert_css_filters -( -) -) -{ -return -WrFiltersStatus -: -: -BLOB_FALLBACK -; -} -/ -/ All CSS filters @@ -6880,35 +6821,9 @@ gfx_webrender_max_filter_ops_per_chain ) { return -WrFiltersStatus -: -: -DISABLED_FOR_PERFORMANCE +true ; } -/ -/ -Track -status -so -we -can -do -cleanup -if -unsupported -filters -are -found -. -WrFiltersStatus -status -= -WrFiltersStatus -: -: -CHAIN -; aWrFilters . filters @@ -7461,70 +7376,16 @@ break } default : -status -= -WrFiltersStatus -: -: -BLOB_FALLBACK -; -break -; -} -if -( -status -! -= -WrFiltersStatus -: -: -CHAIN -) -{ -break +return +false ; } } -if -( -status -! -= -WrFiltersStatus -: -: -CHAIN -) -{ -/ -/ -Clean -up -the -filters -holder -if -we -can -' -t -render -filters -this -way -. -aWrFilters -= -{ -} -; -} return -status +true ; } -WrFiltersStatus +bool SVGIntegrationUtils : : @@ -7544,10 +7405,9 @@ aStyleFilterType WrFiltersHolder & aWrFilters -const -nsPoint +bool & -aOffsetForSVGFilters +aInitialized ) { return @@ -7560,7 +7420,7 @@ aFilteredFrame aFilters aStyleFilterType aWrFilters -aOffsetForSVGFilters +aInitialized ) ; } @@ -7595,29 +7455,20 @@ AsSpan ( ) ; -WrFiltersStatus -status +bool +initialized = +true +; +return CreateWebRenderCSSFilters ( filterChain aFrame wrFilters ) -; -if -( -status -= -= -WrFiltersStatus -: -: -BLOB_FALLBACK -) -{ -status -= +| +| BuildWebRenderFilters ( aFrame @@ -7627,31 +7478,10 @@ StyleFilterType : Filter wrFilters -nsPoint -( -) +initialized ) ; } -return -status -= -= -WrFiltersStatus -: -: -CHAIN -| -| -status -= -= -WrFiltersStatus -: -: -SVGFE -; -} bool SVGIntegrationUtils : diff --git a/layout/svg/SVGIntegrationUtils.h b/layout/svg/SVGIntegrationUtils.h index 834fa85a6749c..c727120395430 100644 --- a/layout/svg/SVGIntegrationUtils.h +++ b/layout/svg/SVGIntegrationUtils.h @@ -197,197 +197,9 @@ nsRect struct nsSize ; -enum -class -WrFiltersStatus -{ -/ -/ -Image -will -be -rendered -unftilered -- -the -filter -graph -contains -invalid -refs -/ -/ -( -which -SVG -spec -states -will -be -rendered -as -if -there -is -no -filter -graph -) -. -UNSUPPORTED -= -0 -/ -/ -Image -will -be -rendered -unfiltered -- -the -filter -graph -provided -is -/ -/ -excessively -costly -to -render -and -has -been -dropped -( -per -SVG -spec -we -can -do -/ -/ -this -to -preserve -user -experience -) -. -DISABLED_FOR_PERFORMANCE -= -1 -/ -/ -Image -will -be -rendered -using -blob -fallback -( -software -rendering -) -due -to -/ -/ -unsupported -operations -( -in -either -the -CSS -or -SVGFE -path -) -. -BLOB_FALLBACK -= -2 -/ -/ -Image -will -be -rendered -using -a -simple -CSS -filter -chain -in -WebRender -. -CHAIN -= -3 -/ -/ -Filter -graph -will -be -rendered -using -WebRender -SVGFE -code -path -this -can -/ -/ -handle -any -kind -of -filter -graph -consisting -of -supported -operations -( -most -/ -/ -operations -are -supported -) -. -SVGFE -= -4 -} -; struct WrFiltersHolder { -/ -/ -TODO -( -Bug -1899691 -) -: -Better -to -use -AutoTArray -here -. -. -. nsTArray < mozilla @@ -1588,7 +1400,7 @@ it * / static -WrFiltersStatus +bool CreateWebRenderCSSFilters ( Span @@ -1633,7 +1445,7 @@ supported * / static -WrFiltersStatus +bool BuildWebRenderFilters ( nsIFrame @@ -1650,10 +1462,9 @@ aStyleFilterType WrFiltersHolder & aWrFilters -const -nsPoint +bool & -aOffsetForSVGFilters +aInitialized ) ; / diff --git a/layout/tools/reftest/manifest.sys.mjs b/layout/tools/reftest/manifest.sys.mjs index 281bbdb36d289..f95b39c172c23 100644 --- a/layout/tools/reftest/manifest.sys.mjs +++ b/layout/tools/reftest/manifest.sys.mjs @@ -4126,258 +4126,6 @@ Software ; / / -These -detect -if -each -SVG -filter -primitive -is -enabled -in -WebRender -sandbox -. -gfxSVGFE -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -" -) -& -& -! -g -. -useDrawSnapshot -; -sandbox -. -gfxSVGFEColorMatrix -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -fecolormatrix -" -) -& -& -sandbox -. -gfxSVGFE -; -sandbox -. -gfxSVGFEComponentTransfer -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -fecomponenttransfer -" -) -& -& -sandbox -. -gfxSVGFE -; -sandbox -. -gfxSVGFEComposite -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -fecomposite -" -) -& -& -sandbox -. -gfxSVGFE -; -sandbox -. -gfxSVGFEDropShadow -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -fedropshadow -" -) -& -& -sandbox -. -gfxSVGFE -; -sandbox -. -gfxSVGFEFlood -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -feflood -" -) -& -& -sandbox -. -gfxSVGFE -; -sandbox -. -gfxSVGFEGaussianBlur -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -fegaussianblur -" -) -& -& -sandbox -. -gfxSVGFE -; -sandbox -. -gfxSVGFEOffset -= -Services -. -prefs -. -getBoolPref -( -" -gfx -. -webrender -. -svg -- -filter -- -effects -. -feoffset -" -) -& -& -sandbox -. -gfxSVGFE -; -/ -/ Use this to diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 1fcd95a997f0f..8067e6ea6beb9 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -40044,547 +40044,6 @@ webrender . svg - -filter -- -effects -type -: -RelaxedAtomicBool -value -: -IS_NIGHTLY_BUILD -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -also -- -convert -- -css -- -filters -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -also -- -use -- -for -- -docshell -- -fecolormatrix -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -opacity -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -toalpha -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -feblend -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fecolormatrix -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fecomponenttransfer -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fecomposite -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -feconvolvematrix -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fediffuselighting -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fedisplacementmap -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fedropshadow -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -feflood -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fegaussianblur -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -feimage -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -femerge -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -femorphology -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -# -Disabled -for -now -due -to -https -: -/ -/ -bugzilla -. -mozilla -. -org -/ -show_bug -. -cgi -? -id -= -1902136 -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -feoffset -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fespecularlighting -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -fetile -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- -filter -- -effects -. -feturbulence -type -: -RelaxedAtomicBool -value -: -false -mirror -: -always -- -name -: -gfx -. -webrender -. -svg -- images type : @@ -93140,28 +92599,6 @@ security . tls . -client_hello -. -send_p256_keyshare -type -: -RelaxedAtomicBool -value -: -true -mirror -: -always -rust -: -true -- -name -: -security -. -tls -. enable_certificate_compression_zlib type : diff --git a/testing/web-platform/meta/css/filter-effects/blur-text.html.ini b/testing/web-platform/meta/css/filter-effects/blur-text.html.ini deleted file mode 100644 index 8b8321729cce9..0000000000000 --- a/testing/web-platform/meta/css/filter-effects/blur-text.html.ini +++ /dev/null @@ -1,20 +0,0 @@ -[ -blur -- -text -. -html -] -fuzzy -: -maxDifference -= -0 -- -8 -; -totalPixels -= -0 -- -55000 diff --git a/testing/web-platform/meta/css/filter-effects/effect-reference-on-transparent-element.html.ini b/testing/web-platform/meta/css/filter-effects/effect-reference-on-transparent-element.html.ini new file mode 100644 index 0000000000000..6fda4fbbab714 --- /dev/null +++ b/testing/web-platform/meta/css/filter-effects/effect-reference-on-transparent-element.html.ini @@ -0,0 +1,16 @@ +[ +effect +- +reference +- +on +- +transparent +- +element +. +html +] +expected +: +FAIL diff --git a/testing/web-platform/meta/css/filter-effects/filter-region-transformed-child-001.html.ini b/testing/web-platform/meta/css/filter-effects/filter-region-transformed-child-001.html.ini new file mode 100644 index 0000000000000..ab1c6ef363c39 --- /dev/null +++ b/testing/web-platform/meta/css/filter-effects/filter-region-transformed-child-001.html.ini @@ -0,0 +1,16 @@ +[ +filter +- +region +- +transformed +- +child +- +001 +. +html +] +expected +: +FAIL diff --git a/testing/web-platform/meta/css/filter-effects/svg-multiple-filter-functions.html.ini b/testing/web-platform/meta/css/filter-effects/svg-multiple-filter-functions.html.ini index 05eaf4c176b43..1ef7397ea37ea 100644 --- a/testing/web-platform/meta/css/filter-effects/svg-multiple-filter-functions.html.ini +++ b/testing/web-platform/meta/css/filter-effects/svg-multiple-filter-functions.html.ini @@ -9,16 +9,6 @@ functions . html ] -fuzzy +expected : -maxDifference -= -0 -- -1 -; -totalPixels -= -0 -- -10000 +FAIL