Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 25bd45233d1ada7a89d90c3d31007dec2807bc6d
https://github.com/WebKit/WebKit/commit/25bd45233d1ada7a89d90c3d31007dec2807bc6d
Author: Simon Fraser <[email protected]>
Date: 2025-12-20 (Sat, 20 Dec 2025)
Changed paths:
M LayoutTests/css3/filters/blur-clipped-with-overflow.html
A
LayoutTests/css3/filters/fedisplacement-ref-filter-with-tiling-expected.html
A LayoutTests/css3/filters/fedisplacement-ref-filter-with-tiling.html
M Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp
M Source/WebCore/platform/graphics/filters/FEDisplacementMap.h
M Source/WebCore/platform/graphics/filters/FilterEffect.cpp
M Source/WebCore/rendering/RenderLayer.cpp
M Source/WebCore/rendering/RenderLayerFilters.cpp
M Source/WebCore/rendering/RenderLayerFilters.h
M Source/WebCore/svg/SVGFEDisplacementMapElement.cpp
M Source/WebCore/svg/SVGFEDisplacementMapElement.h
Log Message:
-----------
Tiling gaps with feDisplacementMap in a CSS reference filter
https://bugs.webkit.org/show_bug.cgi?id=279290
rdar://135448018
Reviewed by Said Abou-Hallawa.
webkit.org/b/266295 describes a number of tiling issues with SVG reference
filters.
In many cases, the culprit was `<feDisplacementMap>`. This filter moves pixels,
so
`SVGFEDisplacementMapElement` needs to implement `outsets()`; the max
displacement
is based on half of the scale value. `FEDisplacementMap::calculateOutsets`
converts
this into possible outsets on each side.
To fix rendering issues with tiling, we address the FIXME in
`RenderLayerFilters::beginFilterEffect()`
by ensuring that the dirty rect does not affect `referenceBox`. This code is
also simplified
to no longer store `m_filterRegion`, since we can read it from `m_filter`, and
the two blocks
of code related to computing `filterRegion` are unified. There are two rects
computed here,
with different roles:
`dirtyFilterRegion` designates the area of the input that needs to be redrawn;
it's
the dirty rect inflated by filter outsets (to deal with filters that move
pixels),
clipped to `filterBoxRect`. It's passed to `GraphicsContextSwitcher` and
becomes the
bounds of the filter source image.
`filterRegion` is `dirtyFilterRegion` expanded by outsets to denote the bounds
of
the filter result.
Filter geometry is still incorrect with LBSE, but using `objectBoundingBox()` as
input to the GraphicsContextSwitcher seems to improve things.
RenderLayerFilters now takes the scale at constructor time.
The test case exercises both issues.
Test: css3/filters/fedisplacement-ref-filter-with-tiling.html
* LayoutTests/css3/filters/blur-clipped-with-overflow.html:
* LayoutTests/css3/filters/fedisplacement-ref-filter-with-tiling-expected.html:
Added.
* LayoutTests/css3/filters/fedisplacement-ref-filter-with-tiling.html: Added.
* Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::calculateOutsets):
* Source/WebCore/platform/graphics/filters/FEDisplacementMap.h:
* Source/WebCore/platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::apply):
(WebCore::FilterEffect::externalRepresentation const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::create):
(WebCore::RenderLayerFilters::RenderLayerFilters):
(WebCore::RenderLayerFilters::beginFilterEffect):
* Source/WebCore/rendering/RenderLayerFilters.h:
* Source/WebCore/svg/SVGFEDisplacementMapElement.cpp:
(WebCore::SVGFEDisplacementMapElement::outsets const):
* Source/WebCore/svg/SVGFEDisplacementMapElement.h:
Canonical link: https://commits.webkit.org/304830@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications