Bug 231754

Summary: Repaint issue with animating SVG inside <img> with object-fit
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, bfulgham, contact, karlcow, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=227682
Attachments:
Description Flags
rendering in safari none

Description Simon Fraser (smfr) 2021-10-14 12:04:32 PDT
https://codepen.io/benfrain/pen/PoKPbPR shows a repaint issue that is related to object-fit on the <img>
Comment 1 Simon Fraser (smfr) 2021-10-14 12:16:33 PDT
Partial fix:

diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp
index 4e89c2e80b7801407d8eea0ae06c349666125012..5c8730151f09b77a03da0e02a38d1ccc5d792c73 100644
--- a/Source/WebCore/rendering/RenderImage.cpp
+++ b/Source/WebCore/rendering/RenderImage.cpp
@@ -371,7 +371,7 @@ void RenderImage::repaintOrMarkForLayout(ImageSizeChangeType imageSizeChange, co
         updateInnerContentRect();
     }
 
-    LayoutRect repaintRect = contentBoxRect();
+    LayoutRect repaintRect = replacedContentRect();
     if (rect) {
         // The image changed rect is in source image coordinates (pre-zooming),
         // so map from the bounds of the image to the contentsBox.


There's a bad initial repaint, and this needs tests.
Comment 2 Radar WebKit Bug Importer 2021-10-21 12:05:17 PDT
<rdar://problem/84517855>
Comment 3 Karl Dubost 2022-12-22 17:45:39 PST
Created attachment 464167 [details]
rendering in safari

This shows the remanent image in the background
Comment 4 Ahmad Saleem 2023-12-31 22:26:27 PST
Can we pick tests from these two blink commit, which did similar looking changes in 'RenderImage'?

https://src.chromium.org/viewvc/blink?revision=180015&view=revision & https://chromium.googlesource.com/chromium/blink/+/889169f1b0b5ef4fb9e126fea64c48d68f584456

I haven't checked whether they fail currently or not.