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?
<rdar://problem/85591164>
Created attachment 471965 [details] Test Case