Bug 236609

Summary: [CoordinatedGraphics] Issue with shadow rendering for image elements
Product: WebKit Reporter: ujwal koneru <ujwal.koneru>
Component: ImagesAssignee: ujwal koneru <ujwal.koneru>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: fujii.hironori, kkinnunen, sabouhallawa, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
Drop shadow clips shadow to image element.
none
drop shadow test clipping.
none
current output
none
Output when full layer is copied by the tilerect
none
[screenshot] Safari Technology Preview 140
none
shadows third issue when blur radius is less than offset.
none
shadows not rendered on tile edge, when full layer is rendered
none
test case 2 none

ujwal koneru
Reported 2022-02-14 13:53:00 PST
Created attachment 451940 [details] Drop shadow clips shadow to image element. When shadows are rendered for an image element, shadows are clipped to the image element size. Debug shows the layer does render the shadow but final tiles are not updated since the rect is clipped to the image element size. Observed this on BSDunix/playstation. unsure on other platforms.
Attachments
Drop shadow clips shadow to image element. (281 bytes, text/html)
2022-02-14 13:53 PST, ujwal koneru
no flags
drop shadow test clipping. (285 bytes, text/html)
2022-02-14 13:59 PST, ujwal koneru
no flags
current output (120.24 KB, image/png)
2022-02-16 22:00 PST, ujwal koneru
no flags
Output when full layer is copied by the tilerect (162.49 KB, image/png)
2022-02-16 22:05 PST, ujwal koneru
no flags
[screenshot] Safari Technology Preview 140 (114.77 KB, image/png)
2022-02-16 22:55 PST, Fujii Hironori
no flags
shadows third issue when blur radius is less than offset. (292 bytes, text/html)
2022-02-17 10:17 PST, ujwal koneru
no flags
shadows not rendered on tile edge, when full layer is rendered (127.18 KB, image/png)
2022-02-17 10:23 PST, ujwal koneru
no flags
test case 2 (442 bytes, text/html)
2022-10-05 19:06 PDT, Fujii Hironori
no flags
ujwal koneru
Comment 1 2022-02-14 13:58:24 PST
Comment on attachment 451940 [details] Drop shadow clips shadow to image element. ><!DOCTYPE html> ><html><head> > <title>dropshadow test</title> > </head> ><body> > <div style="margin-left: 150px; margin-top: 360px"> > <img src="https://i.imgur.com/L9YCQmk.png" style="width: 175px; margin: 15px; filter:drop-shadow(20px 20px 30px blue) ;"> > </div> ></body></html>
ujwal koneru
Comment 2 2022-02-14 13:59:17 PST
Created attachment 451942 [details] drop shadow test clipping. test case
ujwal koneru
Comment 3 2022-02-16 22:00:25 PST
Created attachment 452314 [details] current output current output where shadows are clipped.
ujwal koneru
Comment 4 2022-02-16 22:05:10 PST
Created attachment 452316 [details] Output when full layer is copied by the tilerect Changed rect.intersect to rect.unite to render full layer at https://github.com/WebKit/WebKit/blob/7f1c2ffe6a36cedde507edc54311e7a8fcde50d9/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp#L678 This shows the paint finished the shadow but the updaterect on tile(https://github.com/WebKit/WebKit/blob/7f1c2ffe6a36cedde507edc54311e7a8fcde50d9/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp#L1169) does not consider the outsets/visual overflow of the filter. The block artifact of the shadow is a secondary issue that is patched at https://bugs.webkit.org/show_bug.cgi?id=236407
Fujii Hironori
Comment 5 2022-02-16 22:55:21 PST
Created attachment 452320 [details] [screenshot] Safari Technology Preview 140 I'm observing an issue with Safari Technology Preview 140. 1. Start STP 2. Menu > Safari Technology Preview > Clear History... > Clear History 3. Load https://bugs.webkit.org/attachment.cgi?id=451942
Fujii Hironori
Comment 6 2022-02-16 22:58:24 PST
I think there are two problems here. 1. No shadow issue I think this is Coordinated Graphics specific bug. It can be reprocuded with GTK and PlayStation ports. 2. Clipped shadow issue I think this is WebKit common bug.
Fujii Hironori
Comment 7 2022-02-16 23:52:01 PST
(In reply to Fujii Hironori from comment #6) > 2. Clipped shadow issue > I think this is WebKit common bug. Filed another bug ticket for this. Bug 236758 – img element with drop-shadow filter doesn't repaint correctly on loading the image
ujwal koneru
Comment 8 2022-02-17 10:17:33 PST
Created attachment 452383 [details] shadows third issue when blur radius is less than offset. Thanks Fujii-san. I see a third issue when blur radius is less than xoff/yoffsets. At the tile boundary, we are missing the shadow. This is closely related to (1) above and I think also an coordinated graphics issue.
ujwal koneru
Comment 9 2022-02-17 10:23:50 PST
Created attachment 452384 [details] shadows not rendered on tile edge, when full layer is rendered This might need a new bug since the source dirty rect of the tile has shadow missing unlike original issue. (paint missed shadow on tile edges(?), even though when I dump shadow rects at \platform\graphics\filters\software, seems to have complete shadow size.)
Fujii Hironori
Comment 10 2022-02-17 12:42:18 PST
Good catch. Filed: Bug 236800 – drop-shadow filter doesn't work correctly in tiled backing layer
Radar WebKit Bug Importer
Comment 11 2022-02-21 13:53:16 PST
ujwal koneru
Comment 12 2022-05-12 15:02:54 PDT
Rootcaused the issue to missing set on 'hassoftwarefilter' flag. Renderview has a flag to trigger correct dirty rect calculation at https://github.com/WebKit/WebKit/blob/388a2cb6b11b3c27af168a286fc4c6f16baeb505/Source/WebCore/rendering/RenderObject.cpp#L866 when the container is created. However the flag has to be set every time a software filter is used. I suspect apple is not seeing this because filters are accelerated/coreimage flags trigger a correct repaint rect. When accelerated/non-accelerated filter determination is made for the layer, should set https://github.com/WebKit/WebKit/blob/76f8900db60ddf7e2690c37d6b7535e86f9e374e/Source/WebCore/rendering/RenderLayer.cpp#L5736 +renderer().view().setHasSoftwareFilters(!renderer().page().acceleratedFiltersEnabled()); Will open a PR.
ujwal koneru
Comment 13 2022-10-05 13:18:04 PDT
Fujii Hironori
Comment 14 2022-10-05 19:06:48 PDT
Created attachment 462828 [details] test case 2
Fujii Hironori
Comment 15 2022-10-05 19:10:57 PDT
204269@main (bug#189248) removed setHasSoftwareFilters calling code without a change log description.
Fujii Hironori
Comment 16 2022-10-05 19:15:31 PDT
*** This bug has been marked as a duplicate of bug 236758 ***
Fujii Hironori
Comment 17 2022-10-05 19:17:05 PDT
Oops. wrong bug id.
Fujii Hironori
Comment 18 2022-10-05 19:17:15 PDT
*** This bug has been marked as a duplicate of bug 118411 ***
Note You need to log in before you can comment on or make changes to this bug.