Bug 248197

Summary: [Filters] Introduce GraphicsStyle and add it to GraphicsContext and GraphicsContextState
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, bfulgham, ews-watchlist, gyuyoung.kim, heycam, ryuan.choi, sergio, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 243816    
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch simon.fraser: review-

Description Said Abou-Hallawa 2022-11-21 17:23:58 PST
This will allow applying a GraphicsStyle to all the following drawing commands. Some of FilterEffects can be expressed as GraphicsStyles. Applying a FilterEffect using CoreGraphics will be done by setting GraphicsStyle to the GraphicsContext before drawing the sourceImage of the Filter.
    
The plan is control beginning, ending and nesting GraphicsStyle using transparency layers.
Comment 1 Radar WebKit Bug Importer 2022-11-21 17:32:04 PST
<rdar://problem/102591759>
Comment 2 Said Abou-Hallawa 2022-11-21 17:36:50 PST
Pull request: https://github.com/WebKit/WebKit/pull/6718
Comment 3 Said Abou-Hallawa 2022-11-21 17:38:44 PST
Created attachment 463646 [details]
Patch
Comment 4 Said Abou-Hallawa 2022-11-21 18:21:47 PST
Created attachment 463648 [details]
Patch
Comment 5 Said Abou-Hallawa 2022-11-21 20:33:26 PST
Created attachment 463653 [details]
Patch
Comment 6 Simon Fraser (smfr) 2022-11-22 09:37:57 PST
Comment on attachment 463653 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=463653&action=review

I suggest you add DropShadow first, then add support for gaussian blur and color matrix.

> Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:193
> +struct CGGaussianBlurStyle {

These need to be wrapped in #if HAVE(CGSTYLE_COLORMATRIX_BLUR)

> Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:210
> +    kCGStyleGaussianBlur = 3,

The new values need to be wrapped in HAVE(CGSTYLE_COLORMATRIX_BLUR)

> Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:367
> +CGStyleRef CGStyleCreateGaussianBlur(const CGGaussianBlurStyle*);

These need to be wrapped in HAVE(CGSTYLE_COLORMATRIX_BLUR)
Comment 7 Said Abou-Hallawa 2022-11-22 14:20:52 PST
Comment on attachment 463653 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=463653&action=review

>> Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:193
>> +struct CGGaussianBlurStyle {
> 
> These need to be wrapped in #if HAVE(CGSTYLE_COLORMATRIX_BLUR)

Done.

>> Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:210
>> +    kCGStyleGaussianBlur = 3,
> 
> The new values need to be wrapped in HAVE(CGSTYLE_COLORMATRIX_BLUR)

Done.

>> Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:367
>> +CGStyleRef CGStyleCreateGaussianBlur(const CGGaussianBlurStyle*);
> 
> These need to be wrapped in HAVE(CGSTYLE_COLORMATRIX_BLUR)

CGStyleCreateShadow2() is not supported on GoldenGate https://ews-build.webkit.org/#/builders/43/builds/30382. So I think we should enable all the CoreGraphics by a single flag: HAVE(CORE_GRAPHICS_STYLES) or HAVE(CG_STYLES).
Comment 8 Said Abou-Hallawa 2022-11-22 14:21:34 PST
A new PR was uploaded to https://github.com/WebKit/WebKit/pull/6718
Comment 9 EWS 2022-11-23 17:24:27 PST
Committed 256980@main (d6bd013ec6ba): <https://commits.webkit.org/256980@main>

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