Bug 236609 - [CoordinatedGraphics] Issue with shadow rendering for image elements
Summary: [CoordinatedGraphics] Issue with shadow rendering for image elements
Status: RESOLVED DUPLICATE of bug 118411
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Other Linux
: P2 Normal
Assignee: ujwal koneru
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-14 13:53 PST by ujwal koneru
Modified: 2022-10-05 19:17 PDT (History)
5 users (show)

See Also:


Attachments
Drop shadow clips shadow to image element. (281 bytes, text/html)
2022-02-14 13:53 PST, ujwal koneru
no flags Details
drop shadow test clipping. (285 bytes, text/html)
2022-02-14 13:59 PST, ujwal koneru
no flags Details
current output (120.24 KB, image/png)
2022-02-16 22:00 PST, ujwal koneru
no flags Details
Output when full layer is copied by the tilerect (162.49 KB, image/png)
2022-02-16 22:05 PST, ujwal koneru
no flags Details
[screenshot] Safari Technology Preview 140 (114.77 KB, image/png)
2022-02-16 22:55 PST, Fujii Hironori
no flags Details
shadows third issue when blur radius is less than offset. (292 bytes, text/html)
2022-02-17 10:17 PST, ujwal koneru
no flags Details
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 Details
test case 2 (442 bytes, text/html)
2022-10-05 19:06 PDT, Fujii Hironori
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ujwal koneru 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.
Comment 1 ujwal koneru 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>
Comment 2 ujwal koneru 2022-02-14 13:59:17 PST
Created attachment 451942 [details]
drop shadow test clipping.

test case
Comment 3 ujwal koneru 2022-02-16 22:00:25 PST
Created attachment 452314 [details]
current output

current output where shadows are clipped.
Comment 4 ujwal koneru 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
Comment 5 Fujii Hironori 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
Comment 6 Fujii Hironori 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.
Comment 7 Fujii Hironori 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
Comment 8 ujwal koneru 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.
Comment 9 ujwal koneru 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.)
Comment 10 Fujii Hironori 2022-02-17 12:42:18 PST
Good catch. Filed: Bug 236800 – drop-shadow filter doesn't work correctly in tiled backing layer
Comment 11 Radar WebKit Bug Importer 2022-02-21 13:53:16 PST
<rdar://problem/89254871>
Comment 12 ujwal koneru 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.
Comment 13 ujwal koneru 2022-10-05 13:18:04 PDT
PR: https://github.com/WebKit/WebKit/pull/5047
Comment 14 Fujii Hironori 2022-10-05 19:06:48 PDT
Created attachment 462828 [details]
test case 2
Comment 15 Fujii Hironori 2022-10-05 19:10:57 PDT
204269@main (bug#189248) removed setHasSoftwareFilters calling code without a change log description.
Comment 16 Fujii Hironori 2022-10-05 19:15:31 PDT

*** This bug has been marked as a duplicate of bug 236758 ***
Comment 17 Fujii Hironori 2022-10-05 19:17:05 PDT
Oops. wrong bug id.
Comment 18 Fujii Hironori 2022-10-05 19:17:15 PDT

*** This bug has been marked as a duplicate of bug 118411 ***