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

Cameron McCormack (:heycam)
Reported 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.
Attachments
Patch (7.11 KB, patch)
2022-01-10 21:18 PST, Cameron McCormack (:heycam)
no flags
Patch (7.18 KB, patch)
2022-01-12 15:51 PST, Cameron McCormack (:heycam)
no flags
Cameron McCormack (:heycam)
Comment 1 2022-01-10 20:05:14 PST
Cameron McCormack (:heycam)
Comment 2 2022-01-10 21:18:24 PST
Cameron McCormack (:heycam)
Comment 3 2022-01-12 15:51:36 PST
cathiechen
Comment 4 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.
alan
Comment 5 2022-01-13 16:07:22 PST
Comment on attachment 449009 [details] Patch rs=me
EWS
Comment 6 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].
Note You need to log in before you can comment on or make changes to this bug.