New issue
Advanced search Search tips
Starred by 2 users
Status: Fixed
Owner:
Closed: Jun 30
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment
[css-grid] grid-template-areas makes grid placement to ignore the default index for line names
Project Member Reported by jfernan...@igalia.com, Jun 15 Back to list
Chrome Version: 60.0.3112.20
OS: Linux

What steps will reproduce the problem?
(1) Load the attached test case

What is the expected result?

The red item should placed at the 1st column of second row.

What happens instead?

The red item is placed at the 4th column of second row.

 
grid-template-area-issue.html
561 bytes View Download
According to the Grid specs, custom-ident line names must use "1" as default index for resolving conflicts when there are several lines with the same name.

https://drafts.csswg.org/css-grid/#grid-placement-slot
"Otherwise, treat this as if the integer 1 had been specified along with the <custom-ident>."

The issue is not reproducible if we don't use the grid-template-areas property.

It's also surprising that even using the grid-template-areas property, the issue is not reproducible when declaring only 4 items and 3 columns. 
Components: Blink>Layout>Grid
Status: Available
Owner: jfernan...@igalia.com
Status: Assigned
I'm working on this and already found out a preliminary approach to solve the issue.
Project Member Comment 6 by bugdroid1@chromium.org, Jun 30
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ccf30955351cc421d3ee6e334595e01f65fecc05

commit ccf30955351cc421d3ee6e334595e01f65fecc05
Author: Javier Fernandez <jfernandez@igalia.com>
Date: Fri Jun 30 11:54:21 2017

[css-grid] Use a reference to sort the actual named grid lines vector

When using the grid-template-{columns,rows} properties we create
internally 2 hashmaps; 'NamedGridLines' associates a named line with the
different grid lines such name is used, and 'OrderedNamedGridLines' that
associates a grid line with the different names it has.

When using the grid-template-areas we use the 'OrderedNamedGridLines' to
extract the information about which names are associated to each grid
line.

The spec states that when using the same name for different lines, an
item located a such name will be placed in the first line associated to
that name. Because of this, we need to internally create an index vector
from the 'OrderedNamedGridLines' and we need to sort it ascendantly.

We were wrongly using a copy of the index vector, so we weren't actually
sorting the actual indexes. This patch solves the issue by using a
reference type for the indexes variable, hence, sorting the actual data
of the hashmap.

Bug:  733577 
Change-Id: I4af516420c04565ba4f5b9fc0d267e7c63a2b7aa
Reviewed-on: https://chromium-review.googlesource.com/553777
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#483679}
[add] https://crrev.com/ccf30955351cc421d3ee6e334595e01f65fecc05/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/placement/grid-placement-using-named-grid-lines-001.html
[add] https://crrev.com/ccf30955351cc421d3ee6e334595e01f65fecc05/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-template-areas-must-keep-named-columns-order-expected.html
[add] https://crrev.com/ccf30955351cc421d3ee6e334595e01f65fecc05/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-template-areas-must-keep-named-columns-order.html
[modify] https://crrev.com/ccf30955351cc421d3ee6e334595e01f65fecc05/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

This issue should be FIXED now.
Status: Fixed
Sign in to add a comment