New issue
Advanced search Search tips

Issue 624716 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 79180



Sign in to add a comment

[css-grid] Replaced elements don't properly resolve percentage heights

Project Member Reported by r...@igalia.com, Jun 30 2016

Issue description


Replaced elements use LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight()
to check if they can resolve their percentage heights.

We've some grid related ifs in LayoutBox::computePercentageLogicalHeight()
but they're not preset in LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight().

Similar issues have been fixed on Flexbox (see  bug #499766 ):
* https://codereview.chromium.org/2070823002/
* https://codereview.chromium.org/2086083002/

Attached example showing the issue (in a grid item and a child of a grid item),
check it live at: http://jsbin.com/saziwo/1/edit?html,css,output

 
replaced-elements-percentage-height.html
422 bytes View Download
replaced-elements-percentage-height-current.png
8.1 KB View Download
replaced-elements-percentage-height-expected.png
10.4 KB View Download

Comment 1 by r...@igalia.com, Jul 1 2016

Owner: r...@igalia.com
Status: Started (was: Available)
BTW, the weird effect on the expected result (the magenta line below the image on the 2nd grid) is a different bug.
I've just reported it as  bug #625102 .
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7886bec673ccae048c0ef5726ceb21c8fcbd86e0

commit 7886bec673ccae048c0ef5726ceb21c8fcbd86e0
Author: rego <rego@igalia.com>
Date: Wed Jul 13 02:14:17 2016

[css-grid] Fix percentage height resolution for replaced elements

The percentage heights for replaced elements were not working
as expected in grid items.
The patch fixes the different issues to make it work as expected.

If a replaced item is a grid item, it needs to resolve
the percentage height against its grid area.
When the replaced item is a child of a grid item,
and the grid item is stretched,
it needs to use that size to resolve the percentage height too.

BUG= 624716 
TEST=fast/css-grid-layout/grid-item-with-percent-height-replaced-element.html

Review-Url: https://codereview.chromium.org/2121173002
Cr-Commit-Position: refs/heads/master@{#404896}

[add] https://crrev.com/7886bec673ccae048c0ef5726ceb21c8fcbd86e0/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-with-percent-height-replaced-element.html
[modify] https://crrev.com/7886bec673ccae048c0ef5726ceb21c8fcbd86e0/third_party/WebKit/Source/core/layout/LayoutBox.cpp
[modify] https://crrev.com/7886bec673ccae048c0ef5726ceb21c8fcbd86e0/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
[modify] https://crrev.com/7886bec673ccae048c0ef5726ceb21c8fcbd86e0/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h

Comment 3 by r...@igalia.com, Jul 13 2016

Status: Fixed (was: Started)

Comment 4 by r...@igalia.com, Aug 16 2016

Status: Assigned (was: Fixed)
There're still more issues with replaced elements. If the image has a 100% height and the item has a percentage height too, the height of the image is not properly resolved.

Check the attached example or live at:
http://jsbin.com/yeqobemofu/1/edit?html,css,output
bug-percentage-height-image-item.html
416 bytes View Download
bug-percentage-height-image-item-current.png
2.2 KB View Download
bug-percentage-height-image-item-expected.png
1.4 KB View Download
Project Member

Comment 5 by bugdroid1@chromium.org, Oct 28 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c4dc5e50ffa3ca4bef23a105ae8dc8304926b312

commit c4dc5e50ffa3ca4bef23a105ae8dc8304926b312
Author: rego <rego@igalia.com>
Date: Fri Oct 28 22:08:15 2016

[css-grid] Fix percentage height resolution on replaced elements

More fixes on percentage heights for replaced elements.
The problem now was when you have a replaced element inside a grid item,
and both the replaced and the item have a percentage height.

The item has a definite height as its percentage can be resolved
against its grid area. So the replaced element percentage should be
resolved against the height of the item.

Current code was getting confused about this particular case,
now we reuse hasDefiniteLogicalHeight() to detect it properly.

Added new case to existent test.

BUG= 624716 
TEST=fast/css-grid-layout/grid-item-with-percent-height-replaced-element.html

Review-Url: https://codereview.chromium.org/2458023002
Cr-Commit-Position: refs/heads/master@{#428512}

[modify] https://crrev.com/c4dc5e50ffa3ca4bef23a105ae8dc8304926b312/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-with-percent-height-replaced-element.html
[modify] https://crrev.com/c4dc5e50ffa3ca4bef23a105ae8dc8304926b312/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
[modify] https://crrev.com/c4dc5e50ffa3ca4bef23a105ae8dc8304926b312/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h

Comment 6 by r...@igalia.com, Oct 29 2016

Status: Fixed (was: Assigned)

Sign in to add a comment