Bug 241535 - [Filters] LightSource should keep its points in <length-percentage> units
Summary: [Filters] LightSource should keep its points in <length-percentage> units
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 231253 232842
  Show dependency treegraph
 
Reported: 2022-06-11 21:32 PDT by Said Abou-Hallawa
Modified: 2022-06-12 21:27 PDT (History)
4 users (show)

See Also:


Attachments
fePointLight test case (1.18 KB, image/svg+xml)
2022-06-11 21:32 PDT, Said Abou-Hallawa
no flags Details
feSpotLight test case (1.34 KB, image/svg+xml)
2022-06-11 21:33 PDT, Said Abou-Hallawa
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.