Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2a8e0a3b3b2c6ffdd9c12c876b14bfa8ad105977
      
https://github.com/WebKit/WebKit/commit/2a8e0a3b3b2c6ffdd9c12c876b14bfa8ad105977
  Author: Yulun Wu <yulun...@apple.com>
  Date:   2025-08-22 (Fri, 22 Aug 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative-expected.txt
    M Source/WebCore/rendering/RenderImage.cpp
    M Source/WebCore/rendering/RenderImage.h
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/RenderReplaced.h

  Log Message:
  -----------
  [RenderReplaced][Interop] Coerce block sizing for degenerate aspect ratio 
SVGs.
https://bugs.webkit.org/show_bug.cgi?id=297457
<rdar://156339128>

Reviewed by Sammy Gill.

This PR fixes an issue where SVGs with 0px inline intrinsic size (width) were
being ignored in:

RenderReplaced::computeReplacedLogicalWidth()

This is incorrect as 0px is a valid intrinsic width for SVGs and has 
implications
for sizing the RenderReplaced block. Mishandeling this eventually resulted in
a failure to override the SVG's block direction intrinsic size (height) to 0px.

Per CSSWG resolution, degenerate aspect ratios derived from SVGs'
width and height (from 0px, or -Npx) should fall back to the viewbox
aspect ratio.
See: https://github.com/w3c/csswg-drafts/issues/6286#issuecomment-866986544%5C

Per CSSWG resolution, we should then use the aforementioned aspect ratio
to set the *block* size to match a valid *inline* size.

This means that degenerate aspect ratios resulting from a valid inline
size of 0px should result in a computed block size of 0px.

Note that degenerate aspect ratios from a valid block size of 0px
will instead be computed to respect the viewbox aspect ratio relative to
an explicit inline size.

Note that degenerate aspect ratios from invalid block sizes
(e.g. -1px) will not be respected.
See: https://github.com/w3c/csswg-drafts/issues/11236#issuecomment-2718502765

This PR introduces

shouldRespectZeroIntrinsicWidth()
shouldRespectZeroIntrinsicHeight()

to document this behavior.

* LayoutTests/TestExpectations:
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative-expected.txt:
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::shouldRespectZeroIntrinsicWidth const):
(WebCore::RenderImage::paint):
* Source/WebCore/rendering/RenderImage.h:
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldRespectZeroIntrinsicWidth const):
(WebCore::RenderReplaced::shouldRespectZeroIntrinsicHeight const):
(WebCore::RenderReplaced::paint):
* Source/WebCore/rendering/RenderReplaced.h:

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



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

Reply via email to