Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8702a3f2ef9cf5c1e86285072d8a5a8458fb484d
https://github.com/WebKit/WebKit/commit/8702a3f2ef9cf5c1e86285072d8a5a8458fb484d
Author: Sammy Gill <[email protected]>
Date: 2025-05-29 (Thu, 29 May 2025)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/image-max-width-and-height-behaves-as-auto-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/image-max-width-and-height-behaves-as-auto.html
M Source/WebCore/rendering/RenderReplaced.cpp
Log Message:
-----------
ptv.com.pk: Image in headline is stretched vertically.
https://bugs.webkit.org/show_bug.cgi?id=293644
rdar://143186330
Reviewed by Alan Baradlay.
Consider the following content:
<div style="width: 100px;">
<img style="max-width: 100%; height: 100%;"> (assume natural sizes are
200x200)
</div>
Since the width of the replaced element is auto and the height behaves
as auto, the size of the image would come from its natural sizes after
being constrained by min/max width/height properties. In this case, the
width would get constrained to 100% of its containing block, and that
same constraint would get transferred to the other dimension in order to
maintain the aspect ratio.
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicSizesConstrainedByTransferredMinMaxSizes):
This method is used to compute the transferred constraints from the
opposite dimension and clamps the logical width/height according to
those constraints. This gets fed as input to resolving the final logical
width/height of the element, which also includes respecting any min/max
constraints in the dimension we are computing the size for.
Currently, this function checks to see if the computed logical
width/height is auto in order to compute these transferred constraints
but fails to take into consideration when the logical height may behave
as auto in cases where it is not resolvable. We can cover this case by
expanding this logical to check if the computed logical height is
percent or calculated and whether or not it is resolvable. If it is not
then it would behave the same as height: auto meaning we should compute
any constraints from the opposite dimension.
Canonical link: https://commits.webkit.org/295550@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