Bug 231754 - Repaint issue with animating SVG inside <img> with object-fit
Summary: Repaint issue with animating SVG inside <img> with object-fit
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2021-10-14 12:04 PDT by Simon Fraser (smfr)
Modified: 2021-10-21 12:05 PDT (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
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
-    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