Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filters] Enable CoreGraphics drop shadow filter #18110

Conversation

shallawa
Copy link
Contributor

@shallawa shallawa commented Sep 22, 2023

318e176

[Filters] Enable CoreGraphics drop shadow filter
https://bugs.webkit.org/show_bug.cgi?id=261925
rdar://98820279

Reviewed by Cameron McCormack.

Software filters use ImageBuffers to generate the result of their applying to the
target element. These buffers can take significant amount of memory if the target
element is large or the number of effects are big.

CoreGraphics provides a better way to apply FilterEffects. A CGStyle can be used
to apply the FilterEffect to the current drawing. Also beginTransparencyLayer()/ endTransparencyLayer() can be used to force applying the FilterEffect only when
composting the layer to the destination GraphicsContext. This will treat the
drawing commands between beginning and ending the transparency layer as a unit
of drawing.

Although ColorMatrix and GussianBlur CGStyles are available on macOS Sonoma and
iOS 17, only DropShadow style will be enabled by this patch. The other styles
will be enabled in future patches after fixing the expected fuzziness.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::supportedFilterRenderingModes const):
* Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::supportedFilterRenderingModes const):

Canonical link: https://commits.webkit.org/268354@main

ef12d81

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ›  jsc-armv7
βœ… πŸ›  tv-sim ⏳ πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch βœ… πŸ›  jsc-mips
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-mips-tests

@shallawa shallawa self-assigned this Sep 22, 2023
@shallawa shallawa added the Layout and Rendering For bugs with layout and rendering of Web pages. label Sep 22, 2023
@@ -124,7 +124,7 @@ OptionSet<FilterRenderingMode> FEColorMatrix::supportedFilterRenderingModes() co
if (FEColorMatrixCoreImageApplier::supportsCoreImageRendering(*this))
modes.add(FilterRenderingMode::Accelerated);
#endif
#if HAVE(CGSTYLE_COLORMATRIX_BLUR)
#if 0 && HAVE(CGSTYLE_COLORMATRIX_BLUR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment in here (and in FEGaussianBlur.cpp) to explain why we're doing 0 &&. Without any context it looks odd.

@shallawa shallawa force-pushed the eng/Filters-Enable-CoreGraphics-drop-shadow-filter branch from 1cd886e to 736ade9 Compare September 23, 2023 03:48
@shallawa shallawa added merge-queue Applied to send a pull request to merge-queue and removed merge-queue Applied to send a pull request to merge-queue labels Sep 23, 2023
@shallawa shallawa force-pushed the eng/Filters-Enable-CoreGraphics-drop-shadow-filter branch from 736ade9 to ef12d81 Compare September 23, 2023 04:46
@shallawa shallawa added the merge-queue Applied to send a pull request to merge-queue label Sep 23, 2023
https://bugs.webkit.org/show_bug.cgi?id=261925
rdar://98820279

Reviewed by Cameron McCormack.

Software filters use ImageBuffers to generate the result of their applying to the
target element. These buffers can take significant amount of memory if the target
element is large or the number of effects are big.

CoreGraphics provides a better way to apply FilterEffects. A CGStyle can be used
to apply the FilterEffect to the current drawing. Also beginTransparencyLayer()/ endTransparencyLayer() can be used to force applying the FilterEffect only when
composting the layer to the destination GraphicsContext. This will treat the
drawing commands between beginning and ending the transparency layer as a unit
of drawing.

Although ColorMatrix and GussianBlur CGStyles are available on macOS Sonoma and
iOS 17, only DropShadow style will be enabled by this patch. The other styles
will be enabled in future patches after fixing the expected fuzziness.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::supportedFilterRenderingModes const):
* Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::supportedFilterRenderingModes const):

Canonical link: https://commits.webkit.org/268354@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Filters-Enable-CoreGraphics-drop-shadow-filter branch from ef12d81 to 318e176 Compare September 23, 2023 06:52
@webkit-commit-queue
Copy link
Collaborator

Committed 268354@main (318e176): https://commits.webkit.org/268354@main

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

@webkit-commit-queue webkit-commit-queue merged commit 318e176 into WebKit:main Sep 23, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 23, 2023
@shallawa shallawa deleted the eng/Filters-Enable-CoreGraphics-drop-shadow-filter branch September 24, 2023 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
4 participants