New issue
Advanced search Search tips

Issue 870634 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 6
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[css-grid] Content alignment during track sizing second pass

Project Member Reported by r...@igalia.com, Aug 3

Issue description


During the second pass we're not doing content alignment,
so if the size of the columns/rows change due to the second pass
they won't be properly aligned.

Check the attached example, the item should be horizontally centered
but it's not.

The spec is very clear about this (https://drafts.csswg.org/css-grid/#algo-overview).
In steps 3 and 4 it says that we should apply content alignment,
just like in steps 1 and 2.

Just following what the spec says fixes the problem.
 
css-grid-content-alignment-second-pass.html
306 bytes View Download
css-grid-content-alignment-second-pass-current.png
4.0 KB View Download
css-grid-content-alignment-second-pass-expected.png
3.0 KB View Download
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 6

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

commit 897a1265f189e3290865800ee428c3096eb0a07c
Author: Manuel Rego Casasnovas <rego@igalia.com>
Date: Mon Aug 06 16:10:14 2018

[css-grid] Apply content alignment during second pass

When we integrated content alignment in the track sizing algorithm
(r566412) we forgot to do it too when the 2nd pass is needed.

The patch is very simple and just adds the calls to apply
content alignment in LayoutGrid::RepeatTracksSizingIfNeeded()
for each axis.

The spec also mentions it in the new 3 and 4 steps:
https://drafts.csswg.org/css-grid/#algo-overview
So the new code just aligns with the spec.

BUG= 870634 
TEST=external/wpt/css/css-grid/alignment/grid-content-alignment-second-pass-001.html

Change-Id: Iccbcea5da1011eae37b4923bb78334cddc76d027
Reviewed-on: https://chromium-review.googlesource.com/1161925
Reviewed-by: Sergio Villar <svillar@igalia.com>
Commit-Queue: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#580890}
[add] https://crrev.com/897a1265f189e3290865800ee428c3096eb0a07c/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-content-alignment-second-pass-001.html
[modify] https://crrev.com/897a1265f189e3290865800ee428c3096eb0a07c/third_party/blink/renderer/core/layout/layout_grid.cc

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

Sign in to add a comment