[Webkit-unassigned] [Bug 233032] New: Percentage size inside a fit-content parent in quirk mode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 12 01:11:51 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=233032

            Bug ID: 233032
           Summary: Percentage size inside a fit-content parent in quirk
                    mode
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: cathiechen at igalia.com

We found the behavior of the following case is different in browsers.
The img and div size is 1x1 in Chrome.
While the img and div size is 1xA in Safari and FireFox, where A is the screen height.

Test case:
```
<div style="width:fit-content;height:fit-content;">
    <img style="width: 100%; height: 100%" src="https://w3c-test.org/images/green-1x1.png"/>
</div>
```
Or open https://output.jsbin.com/nodecov/quiet


We have discussed this in https://bugs.chromium.org/p/chromium/issues/detail?id=1268427

According to https://quirks.spec.whatwg.org/#the-percentage-height-calculation-quirk
The containing block is DIV.
Then according to https://www.w3.org/TR/CSS22/visudet.html#the-height-property
> If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the used height is calculated as if 'auto' was specified.

So the height of IMG is “Behaving as auto” (https://drafts.csswg.org/css-sizing-3/#behave-auto)
So the IMG size should be 1x1, so as to DIV's.

WDYT? Do we need a consistent here?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211112/7d2bbfb5/attachment-0001.htm>


More information about the webkit-unassigned mailing list