Bug 241535

Summary: [Filters] LightSource should keep its points in <length-percentage> units
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   
Bug Depends on:    
Bug Blocks: 231253, 232842    
Attachments:
Description Flags
fePointLight test case
none
feSpotLight test case none

Description Said Abou-Hallawa 2022-06-11 21:32:12 PDT
Created attachment 460186 [details]
fePointLight test case

Open the attached test cases.

Expected: A green circle and green ellipse should be drawn.

The problem is PointLightSource and SpotLightSource are created with points in user space coordinates. See SVGFEPointLightElement::lightSource() and SVGFESpotLightElement::lightSource(). But this requires knowing the filter targetBoundingBox and the primitiveUnits.

When dynamically updating these points through SVGFEDiffuseLightingElement::setFilterEffectAttribute() or SVGFESpecularLightingElement::setFilterEffectAttribute() the filter is not available and these points are set in logical coordinates. This means these points will have values between -1 and 1 in user space coordinates. This is why the green circle and ellipse are not shown in the test cases.

The fix is to make LightSource store their points in logical coordinates and to resolve them to user space coordinates in initPaintingData().
Comment 1 Said Abou-Hallawa 2022-06-11 21:33:49 PDT
Created attachment 460187 [details]
feSpotLight test case
Comment 2 Said Abou-Hallawa 2022-06-11 21:38:33 PDT
Pull request: https://github.com/WebKit/WebKit/pull/1462
Comment 3 Said Abou-Hallawa 2022-06-12 20:08:13 PDT
See https://drafts.csswg.org/css-values-4/#typedef-length-percentage for the definition of <length-percentage>.
Comment 4 Radar WebKit Bug Importer 2022-06-12 20:24:23 PDT
<rdar://problem/94973414>
Comment 5 EWS 2022-06-12 21:27:41 PDT
Committed r295481 (251486@main): <https://commits.webkit.org/251486@main>

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