Bug 235058

Summary: automatic minimum block-size aspect-ratio rules should not apply to replaced elements
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: Layout and RenderingAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cathiechen, changseok, esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Cameron McCormack (:heycam) 2022-01-10 19:57:34 PST
We apply the https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum rule in RenderBox::constrainLogicalHeightByMinMax and RenderBox::constrainLogicalWidthInFragmentByMinMax, but we don't correctly check first that the element is non-replaced.  For RenderBox::constrainLogicalHeightByMinMax, this can have the effect of increasing the computed min-height of a replaced element with an aspect-ratio to intrinsicContentHeight, if the element has a child.  (The code that increases the automatic min-height to at least intrinsicContentHeight seems to be part of the unwritten rules about how `min-content: auto` applies to block elements.)

Normally, replaced elements don't have children, but the way we check (looking at `firstChild()`) can return true for <video> elements with controls, <img> elements that have text recognition overlays, and possibly other cases where a UA shadow root has been attached.
Comment 1 Cameron McCormack (:heycam) 2022-01-10 20:05:14 PST
rdar://85505101
Comment 2 Cameron McCormack (:heycam) 2022-01-10 21:18:24 PST
Created attachment 448830 [details]
Patch
Comment 3 Cameron McCormack (:heycam) 2022-01-12 15:51:36 PST
Created attachment 449009 [details]
Patch
Comment 4 cathiechen 2022-01-12 18:30:36 PST
Comment on attachment 449009 [details]
Patch

Hi Cameron, thanks for working on this! The patch looks good to me.
Comment 5 zalan 2022-01-13 16:07:22 PST
Comment on attachment 449009 [details]
Patch

rs=me
Comment 6 EWS 2022-01-13 18:54:32 PST
Committed r288003 (246029@main): <https://commits.webkit.org/246029@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 449009 [details].