Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec4f65f46d4515eb50ef2206085d8bb0a58ee5a9
      
https://github.com/WebKit/WebKit/commit/ec4f65f46d4515eb50ef2206085d8bb0a58ee5a9
  Author: Ahmad Saleem <[email protected]>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    A LayoutTests/fast/hidpi/image-srcset-fit-scale-down-expected.html
    A LayoutTests/fast/hidpi/image-srcset-fit-scale-down.html
    M Source/WebCore/rendering/RenderReplaced.cpp

  Log Message:
  -----------
  object-fit: scale-down is ignored when srcset attribute and w descriptor is 
used
https://bugs.webkit.org/show_bug.cgi?id=295203
rdar://154687132

Reviewed by Simon Fraser.

This patch aligns WebKit with Blink / Chromium.

Merge: 
https://chromium.googlesource.com/chromium/src.git/+/80441f0a1eb089bf4e9d755a7af5c3bfd3b787ec

The object-fit: scale-down property requires that the image be
sized to the smaller of "none" or "contain". When a srcset is used,
the intrinsicSize of the image is scaled such that the srcset fills
the expected area. This causes scale-down to consider the intrinsic
size to be bigger than the actual image, and size things too large.

This change modifies the intrinsic size for content-fit: scale-down
in RenderReplaced::replacedContentRect to un-apply the
imageDevicePixelRatio, that is the scale that resized the src.

* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox):
(WebCore::RenderReplaced::replacedContentRect):
* LayoutTests/fast/hidpi/image-srcset-fit-scale-down.html:
* LayoutTests/fast/hidpi/image-srcset-fit-scale-down-expected.html:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to