RESOLVED FIXED 159258
[css-grid] Height percentages are not properly resolved for item's children
https://bugs.webkit.org/show_bug.cgi?id=159258
Summary [css-grid] Height percentages are not properly resolved for item's children
Manuel Rego Casasnovas
Reported 2016-06-29 03:49:59 PDT
This is very easy to reproduce, in a grid with just one cell (200px x 100px). The item will be stretching by default, so it takes the whole size of the cell. However if you've a child of the item with width and height 100%. The child doesn't take the whole height, only the whole width. See the attached example or check it live at: http://jsbin.com/cinili/1/edit?html,css,output This has been already fixed on Blink: https://codereview.chromium.org/2039223002
Attachments
Patch (7.36 KB, patch)
2016-06-29 03:58 PDT, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2016-06-29 03:58:30 PDT
Sergio Villar Senin
Comment 2 2016-07-06 02:54:56 PDT
Comment on attachment 282339 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=282339&action=review > Source/WebCore/rendering/RenderBox.cpp:2993 > + availableHeight = cb->overrideLogicalContentHeight(); Hmm it looks to me that this is only valid for direct children of a grid item, what happens if we have a child of a child of a grid item?
Manuel Rego Casasnovas
Comment 3 2016-07-06 03:35:20 PDT
Comment on attachment 282339 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=282339&action=review >> Source/WebCore/rendering/RenderBox.cpp:2993 >> + availableHeight = cb->overrideLogicalContentHeight(); > > Hmm it looks to me that this is only valid for direct children of a grid item, what happens if we have a child of a child of a grid item? Mmmm, I'm not sure if I follow you. It'd work like in any regular element. The child of a child of a grid item, has to resolve its percentage against the height of the child of the grid item. So we don't need anything special here. Example: <div style="display: grid; grid: 100px / 100px;> <div id="item"> <div id="subitem"> <div id="subsubitem"></div> </div> </div> </div> A percentage height in the "subitem" needs to be resolved against the "item" height. If the "item" is stretched (that's when we have hasOverrideLogicalContentHeight()), then we should use that height to resolve the "subitem" percentage. Imagine that the "subitem" has a 30% in the previous example, it should resolve against the 100px height of the stretched "item". A percentage height in the "subsubitem" has to be resolved against the "subitem" height. If the "subitem" height is "auto", it cannot be resolved, that's all.
WebKit Commit Bot
Comment 4 2016-07-06 06:03:19 PDT
Comment on attachment 282339 [details] Patch Clearing flags on attachment: 282339 Committed r202856: <http://trac.webkit.org/changeset/202856>
WebKit Commit Bot
Comment 5 2016-07-06 06:03:23 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.