Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 02459994a00495d5b0ac994ac913c7191c4dc538
      
https://github.com/WebKit/WebKit/commit/02459994a00495d5b0ac994ac913c7191c4dc538
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    A 
LayoutTests/compositing/filters/filter-source-outside-viewport-expected.html
    A LayoutTests/compositing/filters/filter-source-outside-viewport.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/filter-unbounded-child-in-layer-plane.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/gtk/TestExpectations
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp
    M Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.h
    M Source/WebCore/platform/graphics/skia/SkiaCompositingLayerFilters.cpp
    M Source/WebCore/platform/graphics/skia/SkiaCompositingLayerFilters.h

  Log Message:
  -----------
  [GTK][WPE] Fix the source area of filters and backdrop filters
https://bugs.webkit.org/show_bug.cgi?id=325847

Reviewed by Carlos Garcia Campos.

Filters are applied in an offscreen surface that only covered the visible part
of the layer. Content outside of it was never painted into the surface, so it
did not contribute to the filter result. For example, if a layer with a drop
shadow is partly scrolled out of the viewport, the shadow of the scrolled out
part was missing, even when the shadow resides inside the viewport. Like
Chromium, extend the surface by the area the filter reads from outside the
visible part - clamped to the maximum surface size. Also add the area the
filter has to cover into the damage region.

The surface of a backdrop filter instead covered its whole border box, and lost
the visible part, if that did not fit. Limit it the same way, to what the filter
reads for the visible part of the border box, _within_ the border box. As the
surface can now end before the border box, mirror a backdrop blur at the border
box, as the spec requires, instead of clamping it at the edges of the surface.
Also apply the filter of the layer to its backdrop, which was painted outside of
it before, which was wrong.

Stop painting a backdrop in recursivePaint() when reaching the layer it belongs
to, before any of the effects of that layer. The filter path could return before
it reached paintSelfAndChildren(), and the layers after it were then painted
into the backdrop.

This fixes several backdrop-filter WPT tests, and 
drop-shadow-with-3d-transform.html.
Add a new specific test covering the "filter outside viewport" scenario,
which triggered the investigation into this topic. Raise the fuzzy pixel budget 
of
filter-unbounded-child-in-layer-plane.html, as the larger surface changes the
rounding of a few pixels by one.

Test: compositing/filters/filter-source-outside-viewport.html

* LayoutTests/compositing/filters/filter-source-outside-viewport-expected.html: 
Added.
* LayoutTests/compositing/filters/filter-source-outside-viewport.html: Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/filter-unbounded-child-in-layer-plane.html:
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp:
(WebCore::SkiaCompositingLayer::setBackdropFilters):
(WebCore::SkiaCompositingLayer::hasFilter const):
(WebCore::filterSourceBounds):
(WebCore::SkiaCompositingLayer::paintBackdrop):
(WebCore::SkiaCompositingLayer::paintWithMaskAndBackdrop):
(WebCore::SkiaCompositingLayer::paintWithFilterAndMask):
(WebCore::SkiaCompositingLayer::recursivePaint):
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.h:
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayerFilters.cpp:
(WebCore::SkiaCompositingLayerFilters::create):
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayerFilters.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to