RESOLVED FIXED 112361
[CSS Grid Layout] computedUsedBreadthOfGridTracks doesn't fill all the grid tracks
https://bugs.webkit.org/show_bug.cgi?id=112361
Summary [CSS Grid Layout] computedUsedBreadthOfGridTracks doesn't fill all the grid t...
Julien Chaffraix
Reported 2013-03-14 10:32:05 PDT
The following code can be found in computedUsedBreadthOfGridTracks: const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows(); [...] Vector<GridTrack>& tracks = (direction == ForColumns) ? columnTracks : rowTracks; for (size_t i = 0; i < trackStyles.size(); ++i) { GridTrack& track = tracks[i]; const Length& minTrackBreadth = trackStyles[i].minTrackBreadth(); const Length& maxTrackBreadth = trackStyles[i].maxTrackBreadth(); [...] } While this will never read past |tracks| end, it's wrong as implicit rows / columns can make tracks.size() > trackStyles.size(). This means that implicit rows / columns are not set up properly prior to running the algorithm. The loop should actually be: for (size_t i = 0; i < tracks.size(); ++i) { GridTrack& track = tracks[i]; const GridTrackSize& trackSize = gridTrackSize(i, direction); const Length& minTrackBreadth = trackSize.minTrackBreadth(); const Length& maxTrackBreadth = trackSize.maxTrackBreadth(); [...] As a side note, we should investigate all the call sites iterating over the style's gridRows() / gridColumns() as they are probably wrong.
Attachments
Julien Chaffraix
Comment 1 2013-03-14 13:30:36 PDT
I am not sure this bug is visible now. That's because we allow a grid track's usedbreadth to go above its maxbreadth if there is some max-content max sizing function, which matches the specification. This is used e.g. to handle the case where the max sizing function is smaller than the min sizing function. Once we have implemented the default implicit sizing (bug 103333), it should be trivial to come up with a test case.
Julien Chaffraix
Comment 2 2013-03-21 14:18:42 PDT
This was fixed when implementing bug 103333 as it was required to pass the tests. The only call site using the style information is RenderGrid::maximumIndexInDirection which is legit as it estimates the grid size based on the style information.
Note You need to log in before you can comment on or make changes to this bug.