Bug 235058 - automatic minimum block-size aspect-ratio rules should not apply to replaced elements
Summary: automatic minimum block-size aspect-ratio rules should not apply to replaced ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Cameron McCormack (:heycam)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-10 19:57 PST by Cameron McCormack (:heycam)
Modified: 2022-01-13 18:54 PST (History)
11 users (show)

See Also:


Attachments
Patch (7.11 KB, patch)
2022-01-10 21:18 PST, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch (7.18 KB, patch)
2022-01-12 15:51 PST, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].