Bug 254062

Summary: [Filters] Calculating the CSSFilter geometry and clipping sometimes is incorrect
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case (does not work on Retina display)
none
test case 2 (incorrect filter geometry)
none
test case 3 (unclipped filter region) none

Description Said Abou-Hallawa 2023-03-16 22:43:25 PDT
Like SVGFilter, CSSFilter should always intersect the FilterEffect imageRect with its primitiveSubregion. This will require:

1. Filter::ClipOperation will be removed.
2. Filter::clipToMaxEffectRect() will always clip the rectangle with maxEffectRect.
3. FilterEffect::calculateImageRect() will return the maxEffectRect if number of input effects is zero. This was a bug which was covered by the union mode of Filter::clipToMaxEffectRect().
4. RenderLayerFilters::beginFilterEffect() should set its targetBoundingBox the sourceImageRect of FilterTargetSwitcher.
5. SVGFilterGraph::getNamedNodes() should not return an error if one of the inputs is builtin and there is no node for it. This happens when we build a graph of primitives and one of the inputs is SourceGraphic or SourceAlpha. In this case we just need to ignore this input since there is no built-in primitive for it. This fixes the calculation of the filter outsets which was covered by  the union mode of Filter::clipToMaxEffectRect().
Comment 1 Said Abou-Hallawa 2023-03-16 22:45:28 PDT
Created attachment 465472 [details]
test case (does not work on Retina display)
Comment 2 Said Abou-Hallawa 2023-03-16 22:48:56 PDT
Created attachment 465473 [details]
test case 2 (incorrect filter geometry)
Comment 3 Radar WebKit Bug Importer 2023-03-16 22:51:11 PDT
<rdar://problem/106844401>
Comment 4 Said Abou-Hallawa 2023-03-16 22:57:07 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11641
Comment 5 Said Abou-Hallawa 2023-03-17 09:36:24 PDT
Created attachment 465481 [details]
test case 3 (unclipped filter region)
Comment 6 EWS 2023-03-18 12:29:34 PDT
Committed 261827@main (7acdd2650a9b): <https://commits.webkit.org/261827@main>

Reviewed commits have been landed. Closing PR #11641 and removing active labels.