E470 [css-flexbox] content size suggestion of image flex items · Issue #6693 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-flexbox] content size suggestion of image flex items #6693

@davidsgrogan

Description

@davidsgrogan

This issue is about the height of the flex item in this case:

<div style="display: flex; flex-direction: column; width:100px; height: 0px;">
  <img src="300x150.png" style="height: 100px;">
</div>

Gecko and Blink both give the flex item height 100px. I think the current specs dictate height 50px.

The item has 0 available height and flex-shrink: 1. So the min-height of the item will be the item's final size.

I think all of us Gecko and Blink layout engineers agree so far. But we've had disagreement in something about what follows, so I am numbering steps for reference.

  1. The min-height is min(specified size suggestion, content size suggestion). specified size suggestion is clearly 100px, so min-height is min(100px, content size suggestion).

  2. Then, content size suggestion is just the min-content height.

  3. min-content height is defined to be the height of the image in this case:

<div style="height: 0px">
  <img src="300x150.png" style="width: 100px; float: left; min-height: 0px; max-height: none;">
</div>
  1. width:100px in step 3 is from flex 9.8.3 saying the "automatic preferred outer cross size of any stretched flex items is the flex container’s inner cross size". The flex container's inner cross size in the original example is 100px. The flex item in the original example has an "automatic preferred outer cross size".

  2. Both engines give that image height 50px. (width:100px in a 300/150 aspect ratio gives height 50px)

  3. So the min-content size of the image in the original example is 50px. So the final height of the flex item in the original example is min(100px, 50px) which is 50px. Both engines are wrong to give height 100px.

spec authors @tabatkins @fantasai: Is 50px wrong? Which step?

aforementioned layout engineers @aethanyc @dholbert @bfgeek @cbiesinger: Is 50px wrong? Which step?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0