New issue
Advanced search Search tips

Issue 709902 link

Starred by 2 users

Issue metadata

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

Blocking:
issue 412410



Sign in to add a comment

[css-grid] Changing items alignment to baseline after layout causes wrong result

Project Member Reported by r...@igalia.com, Apr 10 2017

Issue description


If you have a grid with items stretched (by default) and then you change the alignment to "baseline", it applies baseline for the position, but the size of the items is still the stretched one when it shouldn't.

In the attached example both grids should have the same output and they don't.
 
test-baseline.html
586 bytes View Download
test-baseline.png
8.5 KB View Download

Comment 1 by r...@igalia.com, Apr 10 2017

Description: Show this description
Status: Started (was: Assigned)
This is on my plate now.
Project Member

Comment 4 by bugdroid1@chromium.org, May 2 2017

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

commit 00833a5660df5bddeb6dabc8a2dfe9fbb94662ff
Author: jfernandez <jfernandez@igalia.com>
Date: Tue May 02 16:27:00 2017

[css-grid] Clearing the override height before layout

The stretching logic sets an override height to the grid item so it's
used instead of the regular one, computed in the LayoutBox class. This
override height is computed using the 'grid area' abstraction as item's
containing block.

It's expectable that a style update where item's Self Alginment CSS
properties change from 'stretch' to any other value implies recomputing
the item's size.

The currently implemented stretching logic clears the override flags
before determining whether to assign an stretched override height. We
expect that the layout performed later will adjust the grid item's
height.

However, if the grid item has been laid out already it doesn't adjust
its height, even though the override has been cleared already. This is
precisely the situation detected in the bug, because the Baseline
Alignment logic performs a layout of the grid item before computing the
baseline offsets. This layout causes that the grid item's size is not
computed again after clearing the override flag.

There may be other cases like the one detected in the bug, so with this
patch we are clearing the override flag at the beginning of the layout.
This is a change we wanted to do ling time ago, since the override flags
should be more consistent and not affecting intermediate operations,
even repeating the layout operation.

BUG= 709902 

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

[add] https://crrev.com/00833a5660df5bddeb6dabc8a2dfe9fbb94662ff/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-change-alignment-from-stretch.html
[modify] https://crrev.com/00833a5660df5bddeb6dabc8a2dfe9fbb94662ff/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
[modify] https://crrev.com/00833a5660df5bddeb6dabc8a2dfe9fbb94662ff/third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Status: Fixed (was: Started)
This issue should be FIXED now.

Sign in to add a comment