Skip to content

Conversation

@shallawa
Copy link
Contributor

@shallawa shallawa commented Sep 5, 2025

0bd4123

[Filters] Applying CoreGraphics filters on different tiles may result in white borders around the tiles
https://bugs.webkit.org/show_bug.cgi?id=298453
rdar://159951868

Reviewed by Simon Fraser.

The transparency layer of the CoreGraphics filter should be clipped to the layer
backgroundClipRect without intersecting it with the paintDirtyRect. CoreGraphics
expects the context is set to the coordinates of the target filtered renderer
not only the dirty rectangle only.

Test: css3/filters/effect-graphics-context-blur-tile-boundaries.html
* LayoutTests/css3/filters/effect-graphics-context-blur-tile-boundaries-expected.html: Added.
* LayoutTests/css3/filters/effect-graphics-context-blur-tile-boundaries.html: Added.
* Source/WebCore/rendering/LayerFragment.h:
(WebCore::LayerFragment::Rects::backgroundRect const):
(WebCore::LayerFragment::backgroundRect const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):

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

7dd209d

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@shallawa shallawa self-assigned this Sep 5, 2025
@shallawa shallawa added the Layout and Rendering For bugs with layout and rendering of Web pages. label Sep 5, 2025
@shallawa shallawa requested a review from smfr September 5, 2025 19:10
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 5, 2025
Copy link
Contributor

@smfr smfr left a comment

Choose a reason for hiding this comment

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

This needs a test.

destinationContext.clip(intersection(filterStyle.imageRect, clipRect));

auto maxSide = filterStyle.outsets.maxSide();
auto outsets = FloatBoxExtent { maxSide, maxSide, maxSide, maxSide };
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have to take the max of the outsets, rather than just expanding by the appropriate amount on each side?


inline FloatBoxExtent operator-(const FloatRect& a, const FloatRect& b)
{
return FloatBoxExtent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this clamp negative to zero, so we don't return negative extents?

Copy link
Contributor Author

@shallawa shallawa Sep 15, 2025

Choose a reason for hiding this comment

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

If we have

FloatRect a = { 0, 0, 3, 3 };
FloatRect b = { 1, 1, 1, 1 };
FloatBoxExtent c = a - b; // c = { 1, 1, 1, 1 };
FloatBoxExtent c = b - a; // Should d = { -1, -1, -1, -1 }?  Or should d = { 0, 0, 0, 0 }?

I think the result should be signed. If the rect edge is positive, this means a - b is expanded in this direction. If the rect edge is negative, this means a -b is shrunk in this direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turned out this part is not needed to fix this bug.

@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Sep 13, 2025
@shallawa shallawa force-pushed the eng/Filters-Applying-CoreGraphics-filters-on-different-tiles-may-result-in-white-borders-around-the-tiles branch from 313760f to f71edec Compare September 13, 2025 00:35
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 13, 2025
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Sep 16, 2025
@shallawa shallawa force-pushed the eng/Filters-Applying-CoreGraphics-filters-on-different-tiles-may-result-in-white-borders-around-the-tiles branch from f71edec to df76b85 Compare September 16, 2025 00:56
@shallawa
Copy link
Contributor Author

This needs a test.

The new test case shows this display without this PR:

tempImageLjkJLL

The expected page shows this display:

tempImageT20A02

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 16, 2025
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Sep 16, 2025
@shallawa shallawa force-pushed the eng/Filters-Applying-CoreGraphics-filters-on-different-tiles-may-result-in-white-borders-around-the-tiles branch from df76b85 to 0f60c45 Compare September 16, 2025 04:44
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 16, 2025
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Sep 16, 2025
@shallawa shallawa force-pushed the eng/Filters-Applying-CoreGraphics-filters-on-different-tiles-may-result-in-white-borders-around-the-tiles branch from 0f60c45 to 7dd209d Compare September 16, 2025 10:12
@shallawa shallawa added the merge-queue Applied to send a pull request to merge-queue label Sep 16, 2025
… in white borders around the tiles

https://bugs.webkit.org/show_bug.cgi?id=298453
rdar://159951868

Reviewed by Simon Fraser.

The transparency layer of the CoreGraphics filter should be clipped to the layer
backgroundClipRect without intersecting it with the paintDirtyRect. CoreGraphics
expects the context is set to the coordinates of the target filtered renderer
not only the dirty rectangle only.

Test: css3/filters/effect-graphics-context-blur-tile-boundaries.html
* LayoutTests/css3/filters/effect-graphics-context-blur-tile-boundaries-expected.html: Added.
* LayoutTests/css3/filters/effect-graphics-context-blur-tile-boundaries.html: Added.
* Source/WebCore/rendering/LayerFragment.h:
(WebCore::LayerFragment::Rects::backgroundRect const):
(WebCore::LayerFragment::backgroundRect const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):

Canonical link: https://commits.webkit.org/300038@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Filters-Applying-CoreGraphics-filters-on-different-tiles-may-result-in-white-borders-around-the-tiles branch from 7dd209d to 0bd4123 Compare September 16, 2025 17:16
@webkit-commit-queue
Copy link
Collaborator

Committed 300038@main (0bd4123): https://commits.webkit.org/300038@main

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

@webkit-commit-queue webkit-commit-queue merged commit 0bd4123 into WebKit:main Sep 16, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 16, 2025
@shallawa shallawa deleted the eng/Filters-Applying-CoreGraphics-filters-on-different-tiles-may-result-in-white-borders-around-the-tiles branch September 18, 2025 19:12
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

Development

Successfully merging this pull request may close these issues.

5 participants